Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Page 1

Total questions: 14

Worksheet time: 7mins

Name
Class
Date
1.

Which function is used to display text on the screen?

a)

input()

b)

show()

c)

print()

d)

display()

2.

What does the input() function wait for the user to do?

a)

Click the mouse

b)

Press Enter

c)

Turn off the computer

d)

Type a number only

3.

True or False: Python function names like print and input must always be written in lowercase.

a)

True

b)

False

4.

According to the "Rules for Naming," which variable name is valid?

a)

first name

b)

first_name

c)

"first_name"

d)

1stname

5.

What data type does the input() function always return?

a)

String

b)

Integer

c)

Boolean

d)

Float

6.

Which symbol is the "Assignment Operator" used to store a value in a variable?

a)

==

b)

:

c)

=

d)

%

7.

Topic 3: Logic & Selection (If/Else). Which keyword handles the "Plan B" (runs only if all other conditions are false)?

a)

if

b)

elif

c)

else

d)

then

8.

Topic 3: Logic & Selection (If/Else). What character must appear at the end of an if or else line?

a)

; (semicolon)

b)

. (period)

c)

: (colon)

9.

What does the % operator do in Python?

a)

Calculates percentage

b)

Divides two numbers

c)

Finds the remainder (Modulus)

d)

Multiplies two numbers

10.

Which operator checks if two values are equal?

a)

=

b)

==

c)

!=

d)

<>

11.

In the expression length = length + 5, what happens to the variable?

a)

It stays the same

b)

It is reset to 5

c)

It increases by 5

d)

It becomes a string

12.

Which library would you import to generate random numbers for a game?

a)

math

b)

turtle

13.

How many times will for i in range(4): repeat the code block?

a)

3 times

b)

4 times

c)

5 times

d)

0 times

14.

To use a library like turtle, what command must you use first?

a)

get turtle

b)

start turtle

c)

import turtle

d)

open turtle