wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Control Structure

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

for word in "Jump Statement":

if word == "_": ------------> 1

_____--------------------> 2

print (word, end='')

Choose the correct option to fill the missing values(1,2) in the above code to get the below output


Jup Stateent

a)

mm,break

b)

mm,continue

c)

m,break

d)

m,continue

2.

Predict the output of following code

for word in "Jump Statement":

if word == "e":

continue

print (word, end='')

a)

Jump Statement

b)

Jump Statmnt

c)

Jump

d)

Statmnt

3.

What is the output of the following code?

for word in "Jump Statement":

if word == "u":

break

print (word, end='')

a)

Jump Statement

b)

Jump

c)

J

d)

Ju

4.

What is the output of the following snippet?

i=1

while True:

if i%3 ==0:

break

print(i,end='')

i +=1

a)

12

b)

123

c)

1234

d)

124

5.

Predict the output of following code

i=0

while (i<=10):

for j in range (0,i,2):

print (j,end='\t')

print (end='\n')

i +=2

a)

0

0 2

0 2 4

0 2 4 6

0 2 4 6 8

0 2 4 6 8 10

b)

0

0 2

0 2 4

0 2 4 6

0 2 4 6 8 10

c)

0

0 2

0 2 4

0 2 4 6

0 2 4 6 8

d)

no output

6.

Which of the following jump statement is used to terminate the loop?

a)

continue

b)

goto

c)

pass

d)

break

7.

Which amongst this is not a jump statement ?

a)

for

b)

break

c)

continue

d)

pass

8.

Is it possible place while loop inside a for loop and vice versa?

a)

yes

b)

no

c)

impossible

d)

may be

9.

Which of the following nested loops are valid?

a)

while within while

b)

for within for

c)

while within for

d)

for within while

10.

Which of the following function is used in python for loop to specify the initial, final and increment values?

a)

range

b)

print

c)

format

d)

input

11.

What plays a vital role in Python programming?

a)

Statements

b)

Structure

c)

Control

d)

Indentation

12.

Which statement is generally used as a placeholder?

a)

continue

b)

pass

c)

break

d)

goto

13.

The condition in the statement should be in the form of

a)

Arithmetic r relational expression

b)

Arithmetic or Logical expression

c)

Relational or Logical expression

d)

Arithmetic

14.

_____ statement is used to skip the remaining part of the loop and start with next iteration.

a)

Pass

b)

break

c)

continue

d)

range

15.

____ statement in Python programming is a null statement.

a)

continue

b)

pass

c)

break

d)

for