Page 94 - Digicode_AI_class_8
P. 94
TeCh Ready
A. Tick ( ) the correct option.
1. What do while loop do?
(i) Repeat a chunk of code a given number of times
(ii) Repeat a chunk of code until a condition is true
(iii) Repeat a chunk of code until a condition is false
(iv) Repeat a chunk of code indefinitely
2. Which of the following is a looping statement in Python?
(i) for statement (ii) while statement
(iii) if statement (iv) break statement
3. Which of the following statements allow to repeat a task for a fixed number of times?
(i) for statement (ii) while statement
(iii) if…else statement (iv) continue statement
4. Which of the following statements terminates the execution of the loop?
(i) if (ii) for
(iii) break (iv) continue
B. Fill in the blanks using the words given below.
infinite break while continue non-zero false
1. The statement executes a set of statements repeatedly, until the logical expression
remains true.
2. Any value in the while loop indicates an always true condition whereas zero
indicates condition.
3. The loop never ends.
4. The and are the jump statements in Python.
C. State whether these statements are true or false.
1. The range( ) function is used in the for loop to iterate over the numbers.
2. The continue statement breaks the loops one by one.
3. To come out of the infinite loop, we can either close the program window or press Ctrl + C.
4. A sequence is a succession of values bound together by a single name.
5. The while statement is the looping statement.
92 DigiCode AI-VIII

