wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Text, Math and Loops

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Which of these lines will get Python to display the message Hello World! on the screen?

a)

print("Hello World!")

b)

print(Hello World!)

c)

print"Hello World!"

d)

print=("Hello World!")

2.

What does \n do in Python?

a)

It allows us to display the letter n in a print statement

b)

It means "not equal to"

c)

Divide by n

d)

Moves to the next line

3.

In Python, what is 2 * 8

a)

2

b)

4

c)

8

d)

16

4.

In Python, what is 20 / 8?

a)

2

b)

2.5

c)

3

d)

4

5.

In Python, what is 20 // 8?

a)

2

b)

2.5

c)

3

d)

4

6.

In Python, what is 20 % 8?

a)

2

b)

4

c)

8

d)

16

7.

What is a string in Python?

a)

A number with a decimal point

b)

A variable

c)

A number without a decimal point

d)

A snippet of text

8.

What do we call numbers with decimal points in Python?

a)

Integers

b)

Fractions

c)

Variables

d)

Floats

9.

Which of the below options is the correct way to type in a string in Python?

a)

"I'm the one"

b)

(it's me)

c)

this one

d)

("correct")

10.

Which of the below options is false when it comes to variables?

a)

Variable values can be changed once they have been set

b)

Variables are stored in the computer's memory

c)

Variables have names and values

d)

Variable names can be changed once they have been created

11.

What does a while loop do?

a)

It keeps repeating a piece of code forever

b)

It keeps repeating a piece of code until it reaches a pre-set amount of rounds

c)

It keeps repeating a piece of code until a certain condition is met

d)

It keeps repeating a piece of code for a while

12.

Which of the below symbols does a while loop need in order to function properly in Python?

a)

=

b)

:

c)

==

d)

<

13.

Which symbol does a variable need in order to function properly in Python?

a)

=

b)

:

c)

==

d)

<

14.

What does =! mean in Python?

a)

Nothing

b)

Never

c)

None of the other answers

d)

Not equal to

15.

Which of the below while loops will be correctly understood by Python?

a)

while mrTolak = happy:

b)

while "mrTolak" == "happy"

c)

while "mrTolak" = "happy":

d)

while mrTolak == "happy":