0% found this document useful (0 votes)
34 views

XI CS WS CH6 Flow of Control 1-23-24

This document contains a worksheet on computer science chapter 5, which covers flow of control statements in Python like loops and conditional statements. It includes fill-in-the-blank, multiple choice, true/false, and short answer questions about topics like for loops, while loops, if/else statements, break, continue, pass, range(), and nested loops. The questions test understanding of how these control flow statements work, when different clauses like else get executed, and how to write simple programs using these statements.

Uploaded by

Dhairya Baliyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

XI CS WS CH6 Flow of Control 1-23-24

This document contains a worksheet on computer science chapter 5, which covers flow of control statements in Python like loops and conditional statements. It includes fill-in-the-blank, multiple choice, true/false, and short answer questions about topics like for loops, while loops, if/else statements, break, continue, pass, range(), and nested loops. The questions test understanding of how these control flow statements work, when different clauses like else get executed, and how to write simple programs using these statements.

Uploaded by

Dhairya Baliyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SESSION: 2023-24

CLASS: XI (Worksheet )

Computer Science-083

Ch5: Flow of Control 1

Fill in the blanks.

1. Statements or instructions that are executed one after another in a serial order are called
______________ control flow statements.
2. An iterative statement ________________ a block of statements for specific number of times.
3. _______________________ are used to indent the Python code.
4. The 'else' block will be executed if the condition returns to
5. The _______________loop evaluates the test expression first and then executes the body of the loop.
6. ___________ and ________________ are known as Python Jump Statements.
7. A _____________ statement is the type of statement in Python that does nothing.
8. A loop within the loop is called _____________loop.
9. In Python, loops can have the _____________ clause and it will execute only when the loop
terminates normally.
10. The ______________ statement skips the current iteration and resumes the loop from the next
iteration.

Multiple choice questions:


1 Select which of the following is true for "for loop:
a. The 'for' loop is used to iterate over items of string data type only.
b. The 'else' clause of the for loop is executed when the loop terminates naturally.
c. The 'else' clause of the for loop is executed when the loop terminates abruptly.
d. You can use the 'for' loop when you want to perform a task indefinitely until a particular
condition is met.

2 _____________ refers to the whitespaces or tabs that are used to place at the beginning of a block
of statements.
a. Comments b. Indentation c. Loops d. Statements

3 Observe the following syntax carefully and state which statement is true:
if <expr> :
<statement>

a. <expr> contains only arithmetic operators


b. <expr> is optional
c. <expr> evaluates and returns only True or False
d. <expr> evaluates and returns only True

Page 1 of 3
4 range(8) is equivalent to ___________
a. range(1,8) b. range(0,8) c. range(0,8,2) d. range(1,8,1)

5 What will be the output of the following code?

for i in range(55, 50, -2) :


print(i)

a. 55 54 53 52 51
b. 55 54 53 52 51 50
c. 55 53 51
d. 51 53 55

6 What will happen when the following code gets executed

a. hello b. no output c. error d. hello (infinite times)

7 The statement that helps to skip the iteration and resume the loop with the next iteration is called
______________.
a. continue b. break c. exit d. pass

8 How many times the following code executes?

a. 2 b. 3 c. 10 d. 20

State True or False

1. In the 'if-else' construct, you can place two else statements with one if.
2. You can add multiple 'elif blocks in the 'if-elif-else' statement.
3. The 'in' operator can only be used with the 'for' loop.
4. The range( ) function can only be used with the 'while' loop.
5. The break statement stops the loop in between.
6. The continue statement does nothing and it is called an empty statement.
7. In Python, indentation is required to make the code look good only.
8. The 'while' loop is called an entry-controlled loop.
9. The 'for' loop gets executed at least once in Python.
10. The loop that repeats forever is called an infinite loop.
11. You can also declare the range() function with a negative value.
12. In Python, pass is considered as an empty statement.
13. In Python, comment and pass are similar.
14. A loop within a loop is called a nested loop.
15. You cannot create an 'if-else' block inside another 'if-else' block.

Page 2 of 3
Short Answer Types Questions (2 markers)

1. What is the purpose of range() function? How is the range(10, 20) evaluated?
2. Why is while loop called the entry controlled loop?
3. What is an infinite loop? Give an example.
4. Write a program to obtain a number from user and check whether he has entered a two digit, three
digit or four digit number.
5. What goes the range(start, stop, step_size) function signify?

6. What is the flow of while loop?


7. What is the difference between pass statement and comments in PYTHON?
8. Write a program to check whether a number is divisible by 7 or not?
9. Write a program that obtain ten numbers from the user and display their average.
10. Write a program that accepts percentage from the user and display the grade according to the
following criteria:
Marks Grade
>=90 A
>=80 and < 90 B
>= 60 and < 80 C
Below 60 D

Page 3 of 3

You might also like