exam questions

Exam PCEP-30-02 All Questions

View all questions & answers for the PCEP-30-02 exam

Exam PCEP-30-02 topic 2 question 21 discussion

Actual exam question from Python Institute's PCEP-30-02
Question #: 21
Topic #: 2
[All PCEP-30-02 Questions]

What is the output of the following code?

  • A. The program will cause an error.
  • B. False
  • C. None
  • D. True
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
hovnival
1 month, 1 week ago
Selected Answer: D
Let's analyze the code step by step: 1. `a = 10`: This assigns the value 10 to the variable `a`. 2. `b = 20`: This assigns the value 20 to the variable `b`. 3. `c = a > b`: This compares whether `a` is greater than `b`. Since `10` is not greater than `20`, the result is `False`. Therefore, `c` is assigned the value `False`. 4. `print(not(c))`: This prints the logical negation of `c`. Since `c` is `False`, `not(c)` is `True`. Therefore, the output of the code is: True
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago