Page 264 - Computer Science Class 11 With Functions
P. 264
Solved Exercise
A. Multiple Choice Questions
1. A ____________ construct is used for repeated execution of statements:
a. Looping b. Selection c. Sequential d. None of these
2. Which of the following statements will terminate a loop?
a. pass b. continue c. break d. All of these
3. The expression range(10, 2, -4) will yield the sequence:
a. 10, 6, 2 b. 9, 5, 2 c. 10, 6 d. 9, 5
4. How many values will be printed on execution of the following loop?
for z in range(3):
print(z)
a. 4 b. 2 c. 3 d. None of these
5. What will be the value of num after the following loop is executed?
for num in range(5):
pass
a. 6 b. 4 c. 5 d. None of these
6. Which of the following is a jump statement?
a. while b. for c. continue d. if
7. What will be the value of var after the following loop is executed?
var=5
while(var<=10):
var=var+1
a. 12 b. 11 c. 10 d. 5
8. Which of the following is the correct example of nested loop?
a. for x in range(1,5):
for y in range(x):
print(x)
b. for x in range(1,5):
for y in range(x):
print(x)
c. for x in range(1,5):
print(x)
for y in range(x):
print(y)
d. for x in range(1,5):
for y in range(x):
print(x)
9. A loop becomes an infinite loop if the test condition never becomes ____________.
a. True b. False c. Null d. None
B. State whether the following statements are True or False:
1. The body of the loop can have only one statement. __________
2. The range() generates a sequence of numbers within a given range. __________
3. The default start value of range() is 1. __________
262 Touchpad Computer Science-XI

