wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz 2

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

What is the output of the following code?

a)

Well Done!

b)

Wrong

c)

The code will have no output

d)

The code throws an Error

2.

Which loop(s) is/are not available in Python?

a)

For Loop

b)

While Loop

c)

Do While Loop

3.

What happens when we execute the following code?

a)

This is not syntactically correct Python code

b)

The code will throw an error

c)

The code executes properly and prints the value of result

d)

The code gets stuck in an infinite loop

4.

Which keyword in Python is used to create empty loops, empty functions, or empty continual statements?

a)

break

b)

continue

c)

pass

d)

raise

5.

What arguments shall you pass in a for loop range function to print all even numbers between 11 and 30(included)?

# Code Syntax

for i in range(x,y,z):

print(i)

The respective values of x y z are mentioned in the following options with a space in between each value of x, y, and z. Choose the correct option.

a)

12 31 1

b)

11 30 2

c)

12 31 2

d)

11 31 2

6.

What is the output of the following code?

a)

*

***

****

*****

b)

*

***

****

*****

c)

*

**

***

****

*****

d)

Error

7.

What is the output of the following code?

a)

1 2 3 4 5

1 2 3 4 5

1 2 3 4 5

1 2 3 4 5

1 2 3 4 5

b)

5 4 3 2 1

5 4 3 2 1

5 4 3 2 1

5 4 3 2 1

5 4 3 2 1

c)

0 1 2 3 4

0 1 2 3 4

0 1 2 3 4

0 1 2 3 4

0 1 2 3 4

d)

None of the above

8.

What is the output of the following code?

a)

20 60 310

b)

17 60 400

c)

17 50 310

d)

The code will throw an Error

9.

Which of the following string methods is used for inserting values into placeholders inside a string?

a)

split()

b)

format()

c)

join()

d)

print()

10.

What is the name of the built-in Python module that provides the classes/functions date, timedelta, and timezone?

a)

datetime

b)

date

c)

time

d)

dataclasses