ProgrammingVery hardJEE Advanced · CAT placement

What is printed?

What is printed?
from math import gcd, lcm
print(gcd(-12, 18), gcd(0, 0), lcm(4, 6), gcd(2**100, 6**50) == 2**50)
  1. A. 6 0 12 False
  2. B. 6 1 12 True
  3. C. 6 0 24 True
  4. D. 6 0 12 True

Correct answer: D. 6 0 12 True

gcd ignores the sign, and gcd(0, 0) is 0. 6**50 contains 2**50 as its power of two, which is the smaller of the two powers, so gcd is 2**50.

More Python Programming questions

Exams that ask this topic