Class 11 Computer Science · Chapter 2 · Test 3
Decisions and Loops
38 MCQs Covers if, if-else, elif, short-hand and nested decisions. Also covers while and for loops, range(), break/continue and code-output questions
38 questions · 30 min · 38 marks
Want to try first? Take the free Computer Science test: SDLC and Waterfall Model
Sample questions
The first 5 of 38. Try each one, then tap to see the answer.
Question 1
What is the output of the following code? temperature = 35 | if temperature > 30: | print("It's hot")
- AIt's cold
- BIt's hot
- CNothing
- DError
Show answerHide answer
Answer: B
35 > 30 is True, so the message is printed. (Textbook MCQ 19.)
Question 2
Which statement checks multiple conditions in Python?
- Aif
- Bfor
- Cwhile
- Delif
Show answerHide answer
Answer: D
elif lets you test further conditions after an if.
Question 3
Which loop runs until a condition becomes false?
- Awhile
- Bfor
- Cloop
- Dif
Show answerHide answer
Answer: A
A while loop repeats as long as its condition is True.
Question 4
What does the range(5) function return?
- ANumbers from 1 to 5
- B5 only
- CNumbers from 0 to 4
- DNothing
Show answerHide answer
Answer: C
range(5) starts at 0 and stops before 5.
Question 5
Which keyword is used to skip the rest of the loop body and move to the next iteration?
- Astop
- Bcontinue
- Cskip
- Dnext
Show answerHide answer
Answer: B
continue skips the remaining statements of the current iteration.
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.