wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Program Development - Python: Code Tracing

Total questions: 35

Worksheet time: 26mins

Name
Class
Date
1.
Which part is the inbuilt Python command?
a)
Written in purple
b)
Written in green
c)
The text in brackets
d)
The text in speech marks
2.
Which part is the string?
a)
Written in purple
b)
Written in green
c)
The text in brackets
d)
The text in speech marks
3.
What will this code do?
a)
Miss a line space between two sentences
b)
Miss two lines spaces between a sentence
c)
Miss two lines spaces between two sentences
d)
It will print ""
4.
What does the \n mean?
a)
New line
b)
New word
c)
New file
d)
Nothing - it's a mistake
5.
What's the name of the variable in this code?
a)
School
b)
if
c)
input
d)
print
6.
How many in built Python commands are used in this code?
a)
1
b)
2
c)
3
d)
4
7.
How many strings are there in this code?
a)
4
b)
3
c)
2
d)
1
8.
What question should appear if the code is executed?
a)
You may not get good qualifications
b)
Do you attend school?
c)
Are you paying attention?
d)
Do you understand Python?
9.
If the user answers "No" to the question, "Do you attend school?", what should Python print?
a)
Do you attend school?
b)
print
c)
You may get good qualifications
d)
You may not get good qualifications
10.
How many variables in this code?
a)
0
b)
1
c)
2
d)
3
11.
If someone answered "No" to the question "Do you like school?", what should happen?
a)
print "I'm really pleased!"
b)
print "O, I'm sorry about that"
c)
print "school"
d)
print "no"
12.
If someone answered "Yes" to the question "Do you like school?", what should it print?
a)
print "Something"
b)
Nothing
c)
"I am really pleased"
d)
"I'm really pleased"
13.
What does the colon symbol in Python mean?
a)
if
b)
then
c)
there
d)
their
14.
What is the double equal sign?
a)
A concatenating operator
b)
A conclusive operating
c)
A comparative operator
d)
A smooth operator
15.
What does the double equal sign me?
a)
is equal to
b)
is not equal to
c)
is not equal to or less than
d)
is not less than or equal to
16.
What would happen if the user typed 4 into Python?
a)
print 4
b)
print "You are one short"
c)
print "You have the right amount of fingers"
d)
print "You have too many"
17.
What would happen if the user typed 5 into Python?
a)
print 4
b)
print "You are one short"
c)
print "You have the right amount of fingers"
d)
print "You have too many"
18.
What would happen if the user typed 6 into Python?
a)
print 4
b)
print "You are one short"
c)
print "You have the right amount of fingers"
d)
print "You have too many"
19.
What will the following lines of code print?
a)
A
b)
B
C
c)
A
C
d)
Nothing, it will return an error.
20.
How do you correctly call this function
a)
def(1)
b)
x=square( )
c)
defSquare(4)
d)
x=square(5)
21.
What will print?
a)
nothing
b)
sayHi()
c)
an error message
d)
hi there
22.
What will print?
a)
nothing
b)
5
c)
6
d)
an error message
23.
What will print?
a)
nothing
b)
5
c)
6
d)
an error message
24.
Which of the following best describes the order in which these lines are processed in Python?
a)
4, 1, 2
b)
4, 2, 1
c)
1, 2, 3, 4
d)
3, 1, 2
25.
What will print ?
a)
cats eat mice
b)
mice get away
c)
unknown
d)
error message
26.
Which of the following best describes the order in which these lines are processed in Python?
a)
1,2,3,4
b)
1,2,1,2,1,4
c)
1,2,1,2,1,2,4
d)
1,2,1,2,1,2,1,2,4
27.
What will print?
a)
1
2
11
b)
1
2
21
c)
1
2
3
11
d)
1
2
3
21
28.
What will print?
a)
5
b)
6
c)
3 2
d)
an error message
29.
What will print?
a)
nothing
b)
5
c)
6
d)
an error message
30.
What will print?
a)
nothing
b)
7
c)
z
d)
12
31.
How many times will Boo print?
a)
none
b)
4
c)
5
d)
1
32.
How many times will Boo print?
a)
5
b)
4
c)
none
d)
infinite
33.
What will print?
a)
1 2
b)
1
c)
3
d)
5
34.
What will print?
a)
4
b)
5
c)
nothing
d)
an error message
35.
What will print?
a)
4
b)
5
c)
7
d)
an error message