wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Review Python_G8

Total questions: 28

Worksheet time: 19mins

Name
Class
Date
1.

What will this code output?

a)

A number from 0 to 1

b)

A number from 0 to 100

c)

A number from 1 to 100

d)

error

2.

What will this code output?

a)

error

b)

A number from 0 to 6

c)

A number from 1 to 5

d)

A number from 1 to 6

3.

What will this code output?

a)

A number from 1 to 1.1

b)

1

c)

1.1

d)

error

4.

Which of the following would allow the user to enter data?

a)

elif

b)

output

c)

print

d)

input

5.

Which of the following symbols means more than?

a)

<

b)

>

c)

==

d)

!=

6.

Which of the following is correct?

a)

if colour==blue

b)

if colour=blue:

c)

if colour=="blue":

d)

if color=blue

7.

Which code would display 'Hello World'

a)

Print("Hello World")

b)

print("Hello World")

c)

print(Hello World)

d)

print=("hello world")

8.

If you type 6//2 what result would you get in python.

a)

3.0

b)

4

c)

3

d)

0

9.

If you type 10/5 what result would you get in python?

a)

2

b)

2.0

c)

0

d)

15

10.

if you type print("4"+"9") what result would you get

a)

49

b)

13

c)

error

d)

0

11.

What is a variable?

a)

A named memory location

b)

a value

c)

a number

d)

a letter

12.

Which of the following is NOT a suitable variable name?

a)

num1

b)

Num1

c)

MyName

d)

My name

13.

if you entered 7%2 what result would you get in python?

a)

3

b)

1

c)

2

d)

0

14.

Which of the following would generate a random number?

a)

number =random.randit

b)

number=randon.randnt(0,100)

c)

number=random.randint(0,100)

d)

number=random(0,100)

15.

Which of the following means not equal to?

a)

==

b)

=

c)

!=

d)

<

16.

Which commands might be correct? (Multiple answers)

a)

random. random(1, 10)

b)

print(random.random( ))

c)

print(random. randint(1,10))

d)

import.random(2.7)

17.

What symbol is used in python to assign values to a variable?

a)

:

b)

*

c)

=

d)

==

18.

What is the end after if statements?

a)

if

b)

Elif

c)

Else

d)

While

19.

Which of the following is a correctly-formatted comment?

a)

*Comment

b)

"Comment"

c)

#comment

d)

(comment)

20.

A data type than can have one of two values: True or False

a)

Boolean

b)

Basic Calculation

c)

For

d)

While

21.

Data type for a whole number

a)

Float

b)

Boolean

c)

Integer

d)

String

22.

A Python data type that holds positive and negative whole numbers

a)

String

b)

int

c)

str

d)

input

23.

The Boolean operator that returns true if EITHER of its operands are true

a)

and

b)

or

c)

not

d)

equal

24.

Which of the following sequences would be generated by the given line of code?

range (10, 0, -5)

a)

10,9,8,7,6,5

b)

10, 5

c)

0, 5, 10

d)

10, 5, 0

25.

In a Python program, what would be the increment value for the looping variable in the FOR LOOP code?

for x in range (25, 10, -5)

a)

10

b)

-5

c)

25

d)

5

26.

Which of the following pieces of code defines a list of all the numbers from 4 to 12?

a)

range(4,12)

b)

range(4, 13)

c)

range( 3,12)

d)

range(3, 13)

27.

// means:

a)

two times division

b)

integer division

c)

exact division with floating number

d)

Put a slash

28.

What does symbol % do?

a)

Integer exact division

b)

Percentage

c)

Division

d)

Remainder