wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Programming Quiz

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What type of programming does Python support?

a)

All of the above

b)

Functional programming

c)

Object-oriented programming

d)

Procedural programming

2.

Which of the following is a valid way to print a string in Python?

a)

print[Hello World]

b)

print(Hello World)

c)

print

d)

print('Hello World')

3.

What symbol is used to concatenate strings in Python?

a)

+

b)

&

c)

||

d)

%

4.

Which of the following is NOT a valid variable name in Python?

a)

my_variable

b)

2nd_variable

c)

myVariable2

d)

_myVariable

5.

What is the output of the following code: print('Hello' + ' World')?

a)

Hello World

b)

HelloWorld

c)

Hello + World

d)

Error

6.

Which function is used to get user input in Python?

a)

scan()

b)

get()

c)

input()

d)

read()

7.

What is the purpose of the 'if' statement in Python?

a)

To create loops

b)

To make decisions

c)

To declare variables

d)

To define functions

8.

Which of the following data types is used to represent true/false values in Python?

a)

str

b)

float

c)

int

d)

bool

9.

What will be the output of the following code: print(10 > 5)?

a)

True

b)

False

c)

10

d)

5

10.

Which operator is used for addition in Python?

a)

-

b)

+

c)

*

d)

/

11.

What is the correct way to define a list in Python?

a)

list = {}

b)

list = <>

c)

list = []

d)

list = ()

12.

What will the following code output: print('Hello World')?

a)

Error

b)

HelloWorld

c)

Hello World

d)

Hello World

13.

What is the output of print(5 * 2)?

a)

10

b)

7

c)

Error

d)

12

14.

What does the 'break' statement do in a loop?

a)

Continues to the next iteration

b)

Ends the loop

c)

Exits the program

d)

Starts the loop over

15.

Which of the following is used to comment a single line in Python?

a)

#

b)

//

d)

/*

16.

What is the output of the following code: print(3 == 3)?

a)

True

b)

False

c)

3

d)

Error

17.

Which of the following is a built-in function in Python?

a)

print()

b)

All of the above

c)

len()

d)

input()

18.

What is the purpose of the 'return' statement in a function?

a)

To end the function

b)

To return a value

c)

To call another function

d)

To print a value

19.

Which of the following is a correct way to create a tuple in Python?

a)

my_tuple = ()

b)

my_tuple = {}

c)

my_tuple = <>

d)

my_tuple = []

20.

What will be the output of print('Hello' * 3)?

a)

HelloHelloHello

b)

Hello 3

c)

3 Hello

d)

Error