wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

KS3 Year 9 Python Quiz 02

Total questions: 8

Worksheet time: 4mins

Name
Class
Date
1.

What is the correct way to print a message in Python?

a)

print message "Hello World"

b)

print("Hello World")

c)

echo "Hello World"

d)

printf("Hello World")

2.

How do you read a user's input and store it in a variable named 'name'?

a)

name = input("Enter your name: ")

b)

input("Enter your name: ") -> name

c)

name <- input("Enter your name: ")

d)

get("Enter your name: ") as name

3.

Which of the following is a valid variable assignment in Python?

a)

5 = x

b)

x = 5

c)

int x = 5

d)

var x = 5

4.

What will the code print?

a)

Smaller

b)

Greater

c)

Error

d)

Nothing

5.

In Python, 'elif' is short for:

a)

else if

b)

else information

c)

either if

d)

else in function

6.

What will code output?

a)

Adult

b)

Child

c)

Teenager

d)

Error

7.

What does the 'input()' function in Python do?

a)

Outputs data to the screen

b)

Reads text from a file

c)

Takes user input

d)

Calculates numeric input

8.

Which operator checks for equality in Python?

a)

=

b)

==

c)

===

d)

!=