LearnFrenzy
Sign in Take a free test

Operators and Expressions · Exercise 1 of 4

Operators and Expressions Operators and Expressions MCQ

  • 15 questions
  • Page 1 of 2
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Fifteen multiple-choice questions on Python operators: division, modulo and power, precedence, chained comparisons, logical and bitwise operators, identity, membership and the walrus operator. Pick an option to check your answer instantly.

Question 1 Easy

What does 8 / 4 return in Python 3?

A 2
B 2.0
C "2"
D 2 or 2.0 depending on the platform
Question page & discussion
Question 2 Medium

What is the value of -9 // 4?

A -2
B -2.25
C 2
D -3
Question page & discussion
Question 3 Medium

What is -10 % 3 in Python?

A 2
B -1
C 1
D -2
Question page & discussion
Question 4 Medium

How is 2 ** 3 ** 2 evaluated?

A 2 ** (3 ** 2) = 512
B (2 ** 3) ** 2 = 64
C It is a SyntaxError
D 2 * 3 * 2 = 12
Question page & discussion
Question 5 Medium

What is the value of -3 ** 2?

A 9
B 6
C -9
D -6
Question page & discussion
Question 6 Easy

What does 0 < x <= 100 mean in Python?

A (0 &lt; x) &lt;= 100, comparing a bool with 100
B It is a SyntaxError
C 0 &lt; x or x &lt;= 100
D 0 &lt; x and x &lt;= 100
Question page & discussion
Question 7 Medium

What is the value of "" or "Guest"?

A "Guest"
B True
C False
D ""
Question page & discussion
Question 8 Medium

In x != 0 and 10 / x > 1, what happens when x is 0?

A ZeroDivisionError
B The division is never evaluated, and the result is False
C The result is True
D The result is None
Question page & discussion
Question 9 Easy

What does 5 ^ 2 compute in Python?

A 7 (bitwise XOR of 101 and 010)
B 25 (5 squared)
C 10
D 3
Question page & discussion
Question 10 Medium

What is ~7?

A -7
B 0
C 8
D -8
Question page & discussion

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links