wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Year 8 Python

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

print(“hello world”)

a)

This code will work

b)

This code will not work

2.

print(hello world)

a)

This code will work

b)

This code will not work

3.

print("Hello World")

a)

This will print "Hello World" to the display

b)

This code will not work

4.

print(12 + 13)

will output...

a)

25

b)

1213

c)

12 + 13

d)

Error

5.

print("12 + 13")

will output...

a)

25

b)

1213

c)

12 + 13

d)

Error

6.

print("12" + "13")

will output...

a)

25

b)

1213

c)

12 + 13

d)

Error

7.

print("12" + "13)

will output...

a)

25

b)

1213

c)

12 + 13

d)

Error

8.

print(“Hello \n World”)

What does the \n part do?

a)

Creates a new line

b)

Nothing at all

c)

Creates an error

d)

Creates a space

9.

You can create a new line with a special character when using the print function. What is it?

a)

\t

b)

\s

c)

\n

d)

\b

10.

Back slash?

a)

/

b)

\

11.

Forward slash?

a)

/

b)

\

12.

message = “Hello World”

print(message)

a)

Prints "Hello World"

b)

Prints "Message"

c)

Prints "message"

d)

The code will not work

13.

message = Hello World

print(message)

a)

Prints "Hello World"

b)

Prints "Message"

c)

Prints "message"

d)

The code will not work

14.

message = "Hello World"

print(Message)

a)

Prints "Hello World"

b)

Prints "Message"

c)

Prints "message"

d)

The code will not work

15.

temperature = 18

temperature = temperature + 1

print(temperature)

a)

18

b)

19

c)

"temperature"

d)

This code will not work

16.

Create a variable called "city" with the value of "Hull"

a)

city = "Hull"

b)

city = Hull

c)

"city" = "Hull"

d)

city == "Hull"

17.

Create a variable called "name" with the value of "John"

a)

name = "John"

b)

name = John

c)

name = "john"

d)

name == "John"

18.

What symbol is used to multiply?

a)

x

b)

*

c)

/

d)

=

19.

What symbol is used to divide?

a)

x

b)

*

c)

/

d)

=

20.

What is a variable?

a)

A place in the memory you can use to store data

b)

A function such as print() that you can use in your program

c)

Something that can vary

d)

A hidden part of the computer that can change what your program does

21.

Variables must NOT...

a)

Have spaces in their names

b)

Have names beginning with a number

c)

Use capital letters

d)

Have reserved names like "print" and "input"

22.

What value will this program output?

a)

10

b)

15

c)

25

d)

30

e)

55

23.

What value is stored in variable 'x'?

a)

10

b)

15

c)

25

d)

30

e)

55

24.

What value is stored in variable 'y'?

a)

10

b)

15

c)

25

d)

30

e)

55

25.

What value is stored in variable 'a'?

a)

10

b)

15

c)

25

d)

30

e)

55

26.

What value is stored in variable 'b'?

a)

10

b)

15

c)

25

d)

30

e)

55

27.

How many variables are there in this program?

a)

2

b)

4

c)

5

28.

Will this program work?

a)

Yes

b)

No

29.

What is the name of the variable used in this program?

a)

input

b)

print

c)

answer

30.

Joe runs this program and types in his name when asked. What will be the output?

a)

Hello name

b)

Hello Joe

c)

Hello, Joe

d)

Hello + name