Conditional Statements and Loops Quiz - CBSE Class 10 Computer Science
Free practice quiz: Conditional Statements and Loops (CBSE Class 10 Computer Science). 18 multiple-choice questions with answers and explanations. Play online, no sign-up needed.
Play all 18 questions freeSample questions
What is a conditional statement in programming?
- A statement that performs different actions based on a condition
- A statement that repeats actions
- A statement that defines variables
- A statement for input/output
Show answer
Answer: A. A statement that performs different actions based on a condition
Conditional statements decide the flow of control depending on a condition being true or false.
Which loop is known as a definite loop in Python?
- for loop
- if loop
- while loop
- do-while loop
Show answer
Answer: A. for loop
A for loop is used for iterating over a sequence (like a list, tuple, or string), where the number of iterations is definite.
Which statement will terminate a while loop or for loop prematurely?
- stop
- pass
- break
- exit
Show answer
Answer: C. break
The 'break' statement in Python is used to end the loop prematurely, moving control to the next statement following the loop.
Which of the following can act as a loop control statement in Python?
- break
- return
- pass
- None of the above
Show answer
Answer: A. break
In Python, 'break' is the only valid loop control statement that can alter the flow of a loop by terminating it.
When is else statement not executed in loops?
- When the loop completes normally
- Whenever the continue statement is encountered
- Whenever the break statement is encountered
- After return is called
Show answer
Answer: C. Whenever the break statement is encountered
When a break statement is executed, the control exits the loop, and the else clause will not be executed.