LearnFrenzy
Sign in Take a free test

Operators and Expressions · Exercise 1 of 4

Operators and Expressions Operators and Expressions MCQ

  • 15 questions
  • Page 2 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 11 Medium

With d = {"a": 1, "b": 2}, what does 2 in d return?

A False, because in tests the keys
B True, because 2 is a value
C KeyError
D TypeError
Question page & discussion
Question 12 Easy

How do you add 1 to count in Python?

A count += 1
B count++
C ++count
D increment(count)
Question page & discussion
Question 13 Medium

What does the walrus operator := do?

A Assigns a value to a name and returns that value, inside an expression
B Compares two values
C Declares a constant
D Swaps two variables
Question page & discussion
Question 14 Hard

How does Python group not a or b and c?

A not (a or (b and c))
B (not a) or (b and c)
C ((not a) or b) and c
D not ((a or b) and c)
Question page & discussion
Question 15 Hard

If x = 4, what is x after x *= 2 + 3?

A 11
B 20
C 14
D 24
Question page & discussion
Up next · Exercise 2Predict the Output15 questions

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links