Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Flow of Control

Total questions: 18

Worksheet time: 9mins

Name
Class
Date
1.

In a Python program , a control structure:

a)

directs the order of execution of the statements in the program

b)

dictates what happens before te program starts and after it terminates

c)

defines program-specific data structures

d)

manages the input and output of control characters

2.

An empty/null statement in python is ____________

a)

go

b)

pass

c)

over

d)

;

3.

The order of statement execution in the form of top to bottom , is known as ______ construct

a)

selection

b)

repetition

c)

sequence

d)

flow

4.

The ___________ construct allows to choose statements to be executed , depending upon the result of a condition.

a)

selection

b)

repetition

c)

sequence

d)

flow

5.

Which of the following statements will make a selection construct ?

a)

if

b)

for

c)

if-else

d)

while

6.

What is the output of the above program ?

a)

Am I here?

b)

Or here ?

c)

Am I here ? Or here ?

d)

Or here ? Or over here ?

7.

If the user inputs : 2<Enter> , what does the following code snippet print ?

a)

Yes

b)

No

c)

May be

d)

Nothing printed

e)

Error

8.

Function range(3) is equivalent to "

a)

range(1,3)

b)

range(0,3)

c)

range(0,3,1)

d)

range(1,3,0)

9.

In for a in _________ : , the blank can be filled with

a)

an iterable sequence

b)

a range() function

c)

a single value

d)

an expression

10.

Consider the following loop given below :


for i in range(5):

print(i)


How many times will this loop run ?

a)

5

b)

0

c)

infinite

d)

Error

11.

The program snippet above is syntactically correct

a)

False

b)

True

12.

You should be at least 18 years to vote. What should be the expression in the if statement that will print


can vote.

a)

age >= 18

b)

age = 18

c)

age == 18

13.

What is the output of the program above.

a)

can vote

b)

can drink

c)

can vote can drink

14.

What is the output of the above program

a)

can vote

can drink

b)

can vote

c)

can drink

d)

none of the above

15.

What is the output of the above program

a)

can vote

can drink

b)

can vote

c)

can drink

d)

none of the above

16.

What is the output of the code above

a)

go watch cartoons

b)

can vote

c)

go get a girlfriend/boyfriend

17.

The program above will print

a)

Nothing

b)

tends to drink

c)

tends to chitchat

18.

The code above will print

a)

python

b)

java

c)

None