Class 11 Computer Science · Chapter 2 · Test 2
Operators and Precedence
39 MCQs Covers arithmetic, comparison, assignment and logical operators. Also covers precedence, evaluating expressions and code-output questions
39 questions · 35 min · 39 marks
Want to try first? Take the free Computer Science test: SDLC and Waterfall Model
Sample questions
The first 5 of 39. Try each one, then tap to see the answer.
Question 1
What is the value of 10 % 3 in Python?
- A3
- B1
- C0
- D10
Show answerHide answer
Answer: B
% gives the remainder: 10 = 3×3 + 1.
Question 2
What does the ** operator do in Python?
- AModulus
- BDivision
- CFloor division
- DExponentiation
Show answerHide answer
Answer: D
** raises the first number to the power of the second.
Question 3
What is the result of the expression 3 + 2 * 5 in Python?
- A13
- B25
- C15
- D30
Show answerHide answer
Answer: A
Multiplication has higher precedence: 2 * 5 = 10, then 3 + 10 = 13.
Question 4
Which of the following is a comparison operator?
- Aand
- B+
- C==
- D=
Show answerHide answer
Answer: C
== compares two values; = assigns and 'and' is logical.
Question 5
What does a += 5 mean?
- Aa = a * 5
- Ba = a + 5
- Ca = a - 5
- Da = 5
Show answerHide answer
Answer: B
+= adds the right side to the variable and stores the result.
More tests in Python Programming
Practise with a free account
Save your scores, see which chapters need work, and keep a notebook of every question you got wrong.