wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Quiz

Total questions: 60

Worksheet time: 31mins

Name
Class
Date
1.
The number or word we give to a variable
a)
Value
b)
Bug
c)
Information
d)
Text
2.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
3.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
4.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
5.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
6.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
7.
Python is an example of a....
a)
Text-based programming language
b)
Object orientated programming language
c)
language written in java script
d)
Visual-based programming language
8.
What would print (10 + 16) produce?
a)
20
b)
22
c)
24
d)
26
9.
What button do you press to compile (run) your program so that it runs in the shell?
a)
F3
b)
F5
c)
F7
d)
F9
10.

Which is the Python logo?

a)
b)
c)
d)
11.

What is a input?

a)

A function that allows us to ask the user to enter some data.

b)

To plug in something.

c)

Data displayed on a screen.

d)

A function

12.

What function is used to output a message in python?

a)

print("")

b)

input=name

c)

print

d)

name=input

13.

x = 5

y = 6

print(x*y)


The code above displays the following:

a)

11

b)

x*y

c)

Syntax Error

d)

30

14.

Operators used in python:


divide, multiply, add, subtract

a)

/, *, +, -

b)

div, mul, +, -

c)

\, x, +, -

d)

~, *, +, -

15.
How would would you print a text string?
a)
output "Hello!"
b)
print ("Hello!")
c)
print (Hello!)
d)
output (Hello!)
16.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
17.
What is the name of the environment in Python that write your programs and then test them out?
a)
Shell
b)
Window
c)
IDLE
d)
CLI
18.

What is a input?

a)

A function that allows us to ask the user to enter some data.

b)

To plug in something.

c)

Data displayed on a screen.

d)

A function

19.

What is a output?

a)

A piece of data that is shown on the screen.

b)

Data that the user enters

c)

An output

d)

A orange

20.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
21.
What will be the output?
name = 'Dave'
greeting = "Good morning" + name
print (greeting)
a)
Good moning 'Dave'
b)
Good morning Dave
c)
Good morning name
d)
Good morning + Dave
22.
When you have an error in your code what is the term to summarise finding and fixing that error?
a)
Error checking
b)
Debugging
c)
Syntax finder
d)
Error finder
23.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
24.
How do you display text?
a)
input
b)
output
c)
print
d)
variable 
25.

people = ["John", "Rob", "Bob"]

print (people[1])

what would this result be?

a)
John
b)
Rob
c)
Bob
26.

To display the following on screen

Hello World!

the following command should be used:

a)

print(Hello World!)

b)

print("Hello World!")

c)

print("Hello World" + !)

d)

print"(Hello World!)"

27.

x = 5

y = 6

print(x*y)


The code above displays the following:

a)

11

b)

x*y

c)

Syntax Error

d)

30

28.

x = 5

y = 6

print(x*y)


Select the correct answer(s):

a)

x is a variable

b)

x is a value

c)

print() is a funciton

29.
How would you assign an integer to a variable?
a)
new_var = 4
b)
new_var == 4
c)
new_var = "4"
d)
new var "4"
30.
To create a variable named new_var and assign it a value of 81 divided by 9, which statement would you use?
a)
new_var = 81 \ 9
b)
new_var = "81 / 9"
c)
new_var = "81 \ 9"
d)
new_var = 81 / 9
31.
Choose the statement that assigns 4 to the power of 3 to the variable new_var...
a)
new_var = 4 ** 3
b)
new_var = 3 ** 4
c)
new var = 3 ** 4
d)
new_var = 4 ^^ 3
32.
Which of the following is a float?
a)
new_var = 1234
b)
new_var = True
c)
new_var = 1.234
d)
new_var = "True"
33.
Which of the following is not a string?
a)
new_var = "True"
b)
new_var = "3123"
c)
new_var = "3.123"
d)
new_var = False
34.
Which of the following text strings is correct?
a)
new_var = "Tim/'s Computer"
b)
new_var = "Tim\'s Computer"
c)
new_var = "Tim's Computer"
d)
new_var = Tim's Computer
35.
Numbers with a decimal point belong to a type called...
a)
pointing
b)
integers
c)
decimal
d)
float
36.
To create a newline at the end of a prompt, you can use which of the following expressions?
a)
\new
b)
\return
c)
\break
d)
\n
37.
A _____________ expression is an expression that is either true or false. 
a)
boolean
b)
truth
c)
variable
d)
conditional
38.
What does an IF statement do?
a)
Closes the program
b)
Makes a decision
c)
Asks a question
39.
Which of these would be used to loop through instructions a set number of times?
a)
IF statement
b)
WHILE loop
c)
FOR loop
40.

Everything that we want do display in a print() function must:

a)

be inside parentheses - ()

b)

quotation marks - ""

c)

be inside single quotation marks - ''

d)

be inside hash marks - #

41.

An Operator is:

a)

A person that performs operations

b)

a symbol that specifies the operation to perform

c)

a symbol that means the code will run

d)

a line of code

42.

An Expression is:

a)

A combination of values, operators or functions that can be calculated to give a single value

b)

A printed line of code

c)

A combination of operations that give multiple values

d)

A single value in python

43.

Which operator performs a multiplication?

a)

+

b)

/

c)

X

d)

*

44.

Which operator checks if a value is equal to another value?

a)

+

b)

=

c)

==

d)

!=

45.

Which operator checks if a value is not equal to another value?

a)

==

b)

+=

c)

!=

d)

=

46.

Why did Guido van Rossum call his programming language Python?

a)

He thinks Pythons were cool

b)

He couldn't think of anything else

c)

A friend suggested it

d)

He loves Monty Python

47.

What will:

answer = input("Give me a number")

print(answer * 5)

output?

a)

An error message

b)

The value of answer multiplied by 5

c)

answer * 5

d)

The value of answer repeated 5 times

48.

What does == mean?

a)

Assign a value to a variable

b)

Nothing, it's an error caused by typing == instead of =

c)

Check that the value on the right of the == matches the value on the left

49.

What can a variable not start with?

a)

A special character

b)

A capital letter

c)

A number

d)

A lower case letter

50.

What arithmetic operations does % perform in Python?

a)

Percentage

b)

Floor Division

c)

Remainder

d)

Multiplication

51.

Which of these isn't a Python variable type?

a)

Integer

b)

String

c)

List

d)

Decimal

52.

Which of these is true?

a)

A syntax error will stop a program running

b)

A logic error will stop a program running

c)

A syntax error will let the program run but may have unexpected outcomes

d)

The program will always show an error message for a logic error

53.

What does != represent?

a)

Possibly equal to

b)

Not equal to

c)

Check for error

d)

Don't assign a value

54.

What is the name of the variable in this program?

a)

print

b)

colour

c)

input

d)

" "

55.

What is the correct programming name of this symbol?


()

a)

brackets

b)

parenthesis

c)

quotation marks

d)

smiley emoji

56.

What is the correct term for this symbol?


" "

a)

Quotation marks

b)

Bunny fingers

c)

Parenthesis

d)

Exclamation mark

57.

What is the correct name for this symbol?


==

a)

Assignment

b)

Equal to

c)

Greater than

d)

Less than

58.

What will this symbol do?


\n

a)

Print

b)

Not

c)

New line

d)

Does nothing

59.

The result of this program:

Friday = False

if Friday:

print "Jeans day!"

else:

print "Uniform day"

a)

Jeans day

b)

Today is Friday

c)

Uniform day

d)

Not Friday

60.
What will the output be from the following code?
print("Hello world!\nHello world!")
a)
Hello world! Hello world!
b)
Hello world!
Hello world!
c)
SyntaxError
d)
Hello world!