wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

python

Total questions: 50

Worksheet time: 23mins

Name
Class
Date
1.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
2.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
3.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
4.
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
5.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
6.
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
7.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
8.
Which statement correctly assigns the string "Tanner" to the variable name?
a)
name  = print( "Tanner")
b)
input("Tanner")
c)
name = "Tanner"
d)
name = input("Tanner")
9.
What is Python?
a)
text based programming language
b)
word processor 
c)
spreadsheet
d)
block based programming language
10.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

11.
What is python named after
a)
The snake
b)
Television show called Monty Python
12.
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
13.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
14.
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
15.
What does the term 'debug' mean?
a)
Identify errors and fix them.
b)
Making a calculation
c)
A set of instructions
d)
Looking at code
16.
What does the print function do in python?
a)
It's a variable.
b)
It can input data.
c)
It displays something like a string or integer
d)
It loops the code.
17.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
18.
What syntax can you use to insert a line break between strings so that they appear over multiple lines?
a)
/
b)
\n
c)
\l
d)
n
19.

What is a Count-Controlled loop?

a)

for loop

b)

while loop

20.

A count controlled loop will..

a)

Repeat code until a condition is met

b)

Repeat code a specific amount of times

c)

Repeat code a random amount of times

d)

None of the above

21.

What will this code do?

a)

Print Numbers 1-11

b)

Print Numbers 1-10

c)

Print Numbers 2-10

d)

Print Error

22.

What sort of loop is this?

a)

Count Controlled

b)

Condition Controlled

23.

What will this code print?

a)

Print the word 'letter'.

b)

Print a user input on one line.

c)

Print a user input one letter at a time.

d)

Print an Error.

24.

Which of these is NOT a loop in python?

a)

for loop

b)

while loop

c)

nested loop

d)

if loop

25.

Which of these operators means EQUAL TO?

a)

'='

b)

'=>'

c)

'<='

d)

'=='

26.

What will be the output of this code?

a)

1,2,3,4,5,6,7,8,9,10,11,12

b)

0,2,4,6,8,10

c)

2,4,6,8,10,12

d)

2,4,6,8,10

27.

What does the '#' allow you to do?

a)

Repeat code

b)

Comment on code

c)

Print code

d)

End code

28.

Which of these will allow me to count from 0-20 in steps of 5?

a)

for x in range(0,20):

print(x)

b)

while x = (0,20,5):

print(x)

c)

for x in range(0,21,5):

print(x)

d)

for x in range(0,21,5):

print(y)

29.

If i want to continuously check for a correct answer, what loop would i use?

a)

for loop

b)

while loop

30.

What is the error in this code?

a)

incorrect variable name

b)

incorrect indentation

c)

incorrect speech marks

d)

incorrect loop

31.

A condition controlled loop is...

a)

A while loop

b)

A for loop

32.

Which python operator means 'less than or equal to'?

a)

>=

b)

>

c)

<

d)

<=

33.

What is the value of the expression 100 / 25?

a)

4

b)

4.0

c)

"4.0"

d)

'4.0'

34.

What is the output of the following code :


print 9//2

a)

4.5

b)

4.0

c)

4

d)

3

35.

Which is the correct operator for power(x^y)?

a)

X^y

b)

X**y

c)

X^^y

d)

None of the mentioned

36.

Which one of these is floor division?

a)

/

b)

//

c)

%

d)

None of the mentioned

37.

What is the answer of this expression, 22 % 3 is?

a)

7

b)

1

c)

0

d)

5

38.

x = 4.5

y = 2

print(x//y)

a)

2.0

b)

2

c)

9

d)

9.0

39.

x = 5


print(x > 3 and x < 10)

a)

True

b)

False

40.

x = 10


print(x > 3 and x < 9)

a)

True

b)

False

41.

x = 8


print(x > 3 or x < 20)

a)

True

b)

False

42.

x = 14


print(x > 10 or x < 3)

a)

True

b)

False

43.

x = 5


print(x < 2 or x < 3)

a)

True

b)

False

44.

x = 5


print(not(x > 3 and x < 10))

a)

True

b)

False

45.

x = 5


print(not(x > 3 or x < 2))

a)

True

b)

False

46.

x = 5


print(not(x > 6 or x < 3 ))

a)

True

b)

False

47.

x = 5

y = 3


print(x == y)

a)

True

b)

False

48.

x = "5"

y = 5


print(x == y)

a)

True

b)

False

49.

x = 5

y = 3


print(x != y)

a)

True

b)

False

50.

x = 10

y = 10


print(x != y)

a)

True

b)

False