wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Programming Quiz

Total questions: 20

Worksheet time: 18mins

Name
Class
Date
1.

Can a number be a string? True or False.

a)

True

b)

False

2.

_______ is the process of reducing complexity by hiding unnecessary information and focusing on what is needed to make it work.

a)

Loop

b)

Formality

c)

Abstraction

d)

Function

3.

What does the % operator do in Python?

a)

Calculates the leftovers

b)

Calculates the dividend

c)

Calculates the product

d)

Calculates the remainder

4.

What will be the output of print("hello" + 1 + 2 + 3)?

a)

Error

b)

hello123

c)

hello6

d)

"hello"123

5.

Which of the following checks if x is equal to y?

a)

if x = y:

b)

if x == y:

c)

if x != y:

d)

if x >= y:

6.

Which command will correctly ask the user for their age and save it as an integer?

a)

age = input("What is your age?")

b)

age = int(input("What is your age?"))

c)

age = float(input("What is your age?"))

d)

age = int(input("What is your age?"))

7.

Which of the following checks if x is not equal to y?

a)

if x not = y:

b)

if x == y:

c)

if x =! y:

d)

if x != y:

8.

___________ is a collection of Python code that is developed to add functionality to a program.

a)

module

b)

parameter

c)

variable

d)

chain

9.

What is the result of 22 % 3?

a)

0

b)

1

c)

2

d)

3

10.

Code to check if the variable x is less than 20.

a)

if x <> 20:

b)

if x <= 20:

c)

if x <= 20

d)

if x < 20:

11.

What is the term for a collection of commands given a name, for example, input()?

a)

Function

b)

Module

c)

Export

d)

Import

12.

A placeholder in computer memory that holds the input from a user.

a)

variable

b)

function

c)

parameter

d)

if-else

13.

Which operator performs division, but returns the remainder?

a)

%

b)

\

c)

/

d)

//

14.

Which operator performs an integer division?

a)

#

b)

%

c)

//

d)

*

15.

Which operator performs multiplication?

a)

#

b)

%

c)

//

d)

*

16.

Which operator performs exponentiation?

a)

**

b)

*

c)

%

d)

/

17.

What does the symbol '#' do?

a)

Adds a comment

b)

Divides

c)

Calculates the remainder

d)

Multiplies

18.

Which keyword pulls in modules to add functions to your code?

a)

export

b)

import

c)

variable

d)

function

19.

Takes the square root of x and returns a float.

a)

math.random(x)

b)

import.math(x)

c)

sqrt.math(x)

d)

math.sqrt(x)

20.

A ____________ is used to pass information to a function.

a)

module

b)

parameter

c)

variable

d)

x