ProgrammingVery hardJEE Main · CAT placement
What is printed?
What is printed?
print((1 + 2j) * (3 - 1j), abs(3 + 4j), (1 + 2j).conjugate())
- A. (5+5j) 5 (1-2j)
- B. (5+5j) 5.0 (1-2j)
- C. (5-5j) 5.0 (1+3j)
- D. (7+5j) 5.0 (1-2j)
Correct answer: B. (5+5j) 5.0 (1-2j)
(1 + 2j)(3 - j) = 3 - j + 6j - 2j**2, and since j**2 is -1 this is 5 + 5j. abs of a complex number gives a float, and the conjugate flips the sign of the imaginary part.
More Python Programming questions
- What is printed? python print(list(zip([1, 2, 3], 'ab')), list(zip('ab', [1, 2, 3], [True])), len(list(zip())))
- What is printed? python try: list(zip([1, 2], [3], strict=True)) except ValueError: print('length mismatch') print(list(zip([1, 2], [3])))
- What is printed? python print([f'{i}{ch}' for i, ch in enumerate('ab', 1)])
- What is printed? python from itertools import groupby print([(k, len(list(g))) for k, g in groupby('aabbaa')])
- What is printed? python print('a,b'.split(',', -1), 'a,b,c'.split(',', 0), 'a b c'.split(maxsplit=1))
- What is printed? python print(bytes.fromhex('de ad'), (255).tobytes(2), bytes([1, 2]).hex(' '))