wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Quiz-2

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the syntax of if

a)

if(conditions) then

statements

b)

if(conditions):

statements

c)

if conditions:

statements

d)

if:(conditions)

statements

2.

What is the syntax of if-else

a)

if(conditions)

statements

else:

statements

b)

if(conditions):

statements

else

statements

c)

if(conditions):

statements

else:

statements

d)

if(conditions)

statements

else

statements

3.

What is the syntax of if-else ladder

a)

if(conditions):

statements

elif(conditions):

statements

else:

statements

b)

if(conditions):

statements

elif(conditions)

statements

else:

statements

c)

if(conditions):

statements

elif(conditions):

statements

else

statements

d)

if(conditions)

statements

elif(conditions):

statements

else:

statements

4.

what is the syntax for --for loop

a)

for var in range(startvalue,endvalue,value)

statements

b)

for var in range(startvalue,value)

statements

c)

for var in range(startvalue,endvalue,value):

statements

d)

for i in range(endvalue,value)

statements

5.

what is the syntax of while loop

a)

initialization;

while(condition):

statements

itteration

b)

initialization

while(condition)

statements

itteration

c)

initialization;

while condition:

statements

itteration

d)

initialization

while condition

statements

itteration

6.

What is the use of format function

a)

Int Converts float to other datatype

b)

Int Converts string to other datatype

c)

Int Converts int to other datatype

d)

Int Converts other datatype string

7.

What is the use of input function

a)

It is used to assign a value to variable

b)

It is used to input a value to variable

c)

It is used to dis assign a value to variable

d)

It is used to input a expression to variable

8.

In python do-while can be possible

a)

yes

b)

no

9.

What is the out put of the following program if you provide value -28

print("Enter Your Age")

age=input()

if (age>=1 and age<=100):

print("{0} is valid age".format(age))

else:

print("{0} is Invalid age".format(age))

a)

-28 is valid Age

b)

28 is valid Age

c)

-28 is Invalid Age

d)

28 is Invalid Age

10.

What is the output of following program

for i in [1,2,3,4,5,6,7]:

if i==5:

pass

print i,

a)

1 2 3 4 5 5 6 7

b)

1 2 3 4 6 7

c)

1 2 3 4

d)

1 2 3 4 5 6 7