nerdexam
Python_Institute

PCEP-30-02 · Question #70

Which of the following statements are true? (Choose two.)

The correct answer is B. The ** operator uses right-sided binding. C. The right argument of the % operator cannot be zero. B is correct because Python's exponentiation operator (`) evaluates right-to-left, so 2 3 2 equals 2 9 = 512, not 8 2 = 64. C is correct because dividing by zero with the modulo operator raises a ZeroDivisionError - the right operand must never be zero. A is wrong* because / in…

Question

Which of the following statements are true? (Choose two.)

Options

  • AThe result of the / operator is always an integer value.
  • BThe ** operator uses right-sided binding.
  • CThe right argument of the % operator cannot be zero.
  • DAddition precedes multiplication.

How the community answered

(24 responses)
  • A
    17% (4)
  • B
    75% (18)
  • D
    8% (2)

Explanation

B is correct because Python's exponentiation operator (**) evaluates right-to-left, so 2 ** 3 ** 2 equals 2 ** 9 = 512, not 8 ** 2 = 64. C is correct because dividing by zero with the modulo operator raises a ZeroDivisionError - the right operand must never be zero.

A is wrong because / in Python 3 always performs float division (e.g., 4 / 2 returns 2.0, not 2); use // for integer (floor) division. D is wrong because multiplication precedes addition in standard operator precedence - just like in mathematics (PEMDAS/BODMAS).

Memory tip: Think "right-to-right for power" (right-sided binding for **), and "zero breaks modulo" just as it breaks regular division - both % and / crash on a zero right operand.

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice