Thursday , September 19 2024

Which of the following statements are true? (Select two answers)

Questions BankCategory: Python Essentials 1Which of the following statements are true? (Select two answers)
Which of the following statements are true? (Select two answers)

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

Explanation: The % operator (modulus) returns the remainder of a division, and because you cannot divide by zero, the right operand must be a non-zero number. Otherwise, a ZeroDivisionException will be raised.

The ** operator uses right-sided binding, which means the expression 2**2**3 is evaluated from right to left: 2**3 = 8, and 2**8 = 256.

More Questions: Python Essentials 1 – Module 2 Test