PCEP-30-02 · Question #78
What is the output of the following code? a = 10 b = 20 c = a > b print(not(c))
The correct answer is D. True. a > b evaluates to False because 10 is not greater than 20, so c = False. Applying not() to False flips it to True, which is what gets printed - making D correct. Option B (False) is wrong because it confuses c with not(c), stopping one step too early. Option A is wrong because…
Question
Options
- AThe program will cause an error.
- BFalse
- CNone
- DTrue
How the community answered
(20 responses)- A5% (1)
- B5% (1)
- C15% (3)
- D75% (15)
Explanation
a > b evaluates to False because 10 is not greater than 20, so c = False. Applying not() to False flips it to True, which is what gets printed - making D correct. Option B (False) is wrong because it confuses c with not(c), stopping one step too early. Option A is wrong because the code is syntactically valid Python with no errors. Option C (None) is wrong because print() outputs the value of its argument, not None - it only returns None, which is never displayed here. Memory tip: Think of not as a light switch - it flips the boolean to its opposite, so not(False) is always True.
Community Discussion
No community discussion yet for this question.