Control Structures Quiz - CBSE Class 11 ICT
Free practice quiz: Control Structures (CBSE Class 11 ICT). 14 multiple-choice questions with answers and explanations. Play online, no sign-up needed.
Play all 14 questions freeSample questions
Which control structure is used to repeatedly execute a block of code?
- if-else
- switch
- loop
- function
Show answer
Answer: C. loop
Loops (like 'for' and 'while') are designed for repetitive execution of code blocks.
What is the difference between 'while' and 'do-while' loops?
- There is no difference
- 'while' checks the condition before each iteration, 'do-while' checks after
- 'do-while' checks the condition before each iteration, 'while' checks after
- They are used in different programming languages
Show answer
Answer: B. 'while' checks the condition before each iteration, 'do-while' checks after
'while' loop checks the condition first, 'do-while' executes the loop body at least once.
What is nested loop?
- A loop inside another loop
- A loop that never ends
- A loop with multiple conditions
- A loop that executes only once
Show answer
Answer: A. A loop inside another loop
A nested loop is a loop placed inside another loop.
What is an infinite loop and how can you prevent it?
- A loop with a condition that always evaluates to false
- A loop with a condition that always evaluates to true
- A loop that executes only once
- A loop with multiple conditions
Show answer
Answer: B. A loop with a condition that always evaluates to true
An infinite loop occurs when the loop condition never becomes false; proper loop termination conditions are essential to prevent it.
How can you improve the efficiency of a recursive function?
- Avoid using recursion altogether
- Use memoization to store previously calculated results
- Increase the recursion depth
- Ignore optimization techniques
Show answer
Answer: B. Use memoization to store previously calculated results
Memoization improves efficiency by storing and reusing previously computed results, thus avoiding redundant calculations.