ProgrammingVery hardProduct-company MCQ pattern
What is printed?
What is printed?
print(0b1111 ^ 0b1010 & 0b0110, (0b1111 ^ 0b1010) & 0b0110, 6 & 3 | 4 ^ 1)
- A. 13 4 5
- B. 13 4 7
- C. 11 4 7
- D. 13 2 7
Correct answer: B. 13 4 7
& binds tighter than ^, so 0b1010 & 0b0110 is 2 and 15 ^ 2 is 13. In 6 & 3 | 4 ^ 1 the ^ comes before |, giving 2 | 5 = 7.
More Python Programming questions
- What is printed? python print(1 << 2 + 1, (1 << 2) + 1, 4 >> 1 - 1, 2 3 % 4 2 // 3)
- What is printed on the first line? python print(0.5 + 0.25 == 0.75, 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0)…
- What is printed? python print(round(0.5), round(1.5), round(2.5), round(-2.5), round(2.5 + 1e-15))
- What is printed? python print(round(12345, -2), round(12350, -2), round(12250, -2), round(-1234.5, -1))
- What is printed? python print(format(1234.5678, '.2f'), format(1234.5678, '.2e'), format(0.000012345, '.3g'), format(12345.6789, ',.1f'))
- What is printed? python print(str(1.0), str(1e2), str(1.5e-7), str(123456789012345678.0), str(0.1 + 0.7))