wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Year 9 Term 2 Revision 1

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.

Python is an example of a:

a)

Text-based programming language

b)

Visual-based programming language

c)

Block-based programming language

d)

Language written in JavaScript

2.

What will the output be from the following code? Print (“Hello world!”)

a)

SyntaxError

b)

“Hello world!”

c)

Hello world!

d)

Print (Hello world!)

3.

The correct way to write a variable in python?

a)

my_variables=10

b)

my_variable:10

c)

my variable=10

d)

my_variable is 10

4.

Which of the following is a correctly-formatted comment?

a)

&comment

b)

“”Comment””

c)

!comment

d)

#comment

5.

A data type consisting of numbers letters and symbols:

a)

String

b)

Integer

c)

Float

d)

Boolean

6.

What does term ‘debug’ mean:

a)

looking at the code

b)

a set of instructions

c)

Identify errors and fix them

d)

Making a calculation

7.

To repeat until a particular condition is true use:

a)

While loop

b)

For loop

c)

If loop

d)

Indentation

8.

What does Python turtle allow you to do?

a)

Draw using Java

b)

Draw using python

c)

Insert Audio

d)

Edit photo

9.

If you want more than one option for your code, what do you use (after if)?

a)

If if

b)

Else

c)

And

d)

Elif

10.

What does an if statement do?

a)

Close the program

b)

Ask a question

c)

Make a decision

d)

Write a comment

11.
What kind of programming language is Python?
a)
High Level  & Object Orientated
b)
Low Level & Object Orientated
c)
High Level & Procedural
d)
Low Level & Procedural
12.
How would would you print a text string?
a)
output "Hello!"
b)
print "Hello!"
c)
print (Hello!)
d)
output (Hello!)
13.
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"
14.
What are the 4 main datatypes used in python?
a)
Text, Image, Boolean & Number
b)
Number, String, Text & Boolean
c)
String, Integer, Float & Boolean
d)
Text, String, Integer & Float
15.
Changing the value of a variable e.g. from new_var = 5 to new_var = 10 is called?
a)
Reassignment
b)
Switching
c)
Initiating
d)
Re-initiating 
16.
The variable new_var = 7.  To print the value of new_var, which statement would you use?
a)
output "new_var"
b)
print new_var
c)
print "new_var"
d)
output "7"
17.
Your code will not work unless you indent and format code properly.  Another word used for indenting is..?
a)
whitespace
b)
alignment
c)
assignment
d)
initiation
18.
What do we call the window where you type your code?
a)
The Editor
b)
The Data Entry Screen 
c)
The Code Area
d)
The Statement Window
19.
The window where the output of our code appears is called either the console or the..?
a)
Interface
b)
Print Screen
c)
Compiler
d)
Interpreter
20.
Which symbol do we use if we want to add a comment to our code?
a)
@
b)
#
c)
*
d)
&
21.
Which of the following is a multi-line comment?
a)
"""Multi-line Comment Here"""
b)
""Multi-line Comment Here""
c)
"Multi-line Comment Here"
d)
'Multi-line Comment Here'
22.
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
23.
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
24.
Which of the following statements would return the value 2?
a)
new_var = 8 % 3
b)
new_var = 4 % 2
c)
new_var = 10 ** 2
d)
new_var = "4 % 2"
25.
Which of the following is a float?
a)
new_var = 1234
b)
new_var = True
c)
new_var = 1.234
d)
new_var = "True"
26.
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
27.
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
28.
How would we assign the first letter of a text string to a variable?
a)
new_var = "School"[0]
b)
new_var = "School"[1]
c)
new_var = "School"(0)
d)
new_var = "School"(1)
29.
How would you assign the value of "n" to new_var?
a)
new_var = "Python"[6]
b)
new_var = "Python"(5)
c)
new_var = "Python"(6)
d)
new_var = "Python"[5]
30.
How would you output the number of characters in the string "Python", where new_var = "Python"?
a)
print len(new_var)
b)
print len(Python)
c)
print len("new_var")
d)
print length(new_var)
31.
How would you convert "YES" to lower case?
a)
"YES".lower()
b)
lower"YES"
c)
lower.("YES")
d)
("YES").lower
32.
How would you output the variable new_var = "python" to uppercase?
a)
print new_var.upper()
b)
print (new_var).upper
c)
print new_var.upper[]
d)
print new_var(upper)
33.
How would you output new_var = 123 as a text string?
a)
print str(new_var)
b)
print new_var.str
c)
print str[new_var]
d)
print (new_var).str()
34.
What is the name for a variable that can hold more than one value?
a)
Array
b)
Condition
c)
Loop
d)
Object
35.
To use features built into the language such as datetime we need to import a..?
a)
Library
b)
Element
c)
Object
d)
Class
36.

Which of the following is a correct way to name a variable?

a)

1st_name = Steve

b)

first name = Steve

c)

first_Name = Steve

d)

1st name = Steve

37.

What will be the output of the following code?

x = 2

y = 3

print(x)

x = x + y

print(x)

a)

2

b)

5

c)

2

5

d)

2

3

e)

It will produce an error.

38.

What will be the output of the following code?

num1 = "30"

num2 = "80"

print(num1 + num2)

a)

30 + 80

b)

3080

c)

110

d)

It will produce an error.

39.

Which of the following is NOT a way to do math in Python?

a)

10 * 2

b)

10 / 2

c)

10 - 2

d)

10 X 2

e)

10 + 2

40.

What are floats in Python?

a)

An empty space in your code

b)

Numbers with decimal points (Ex: 3.2)

c)

Numbers greater than 100

d)

Variables in your code that change value

e)

Even numbers

41.

What is the output of the following code?
food = "burgers"
number = 6
print(number + food)

a)

6 burgers

b)

6 "burgers"

c)

6burgers

d)

It will produce an error.

42.

What is the output of the following code?

name = Steve

print(len(Steve))

a)

5

b)

len(Steve)

c)

7

d)

(Steve)

43.

Which of the following is the correct method to print "Hello world!"? Check all that apply.

a)

print("Hello world!")

b)

print('Hello world!')

c)

print(Hello world!)

d)

print('Hello world!")

44.

What does an if statement do?

a)

Close the program

b)

Ask a question

c)

Make a decision

d)

Write a comment

45.

What is a variable?

a)

A storage location of memory which can change

b)

A random area to store things in.

c)

Something that changes

d)

Something that can only store numbers

46.

Which of the following is a correctly-formatted comment?

a)

&comment

b)

“”Comment””

c)

!comment

d)

#comment

47.

A data type consisting of numbers letters and symbols:

a)

String

b)

Integer

c)

Float

d)

Boolean

48.

What does term ‘debug’ mean:

a)

looking at the code

b)

a set of instructions

c)

Identify errors and fix them

d)

Making a calculation

49.

How do you correctly name the rules of a programming language?

a)

Syntax

b)

Grammar

c)

Code

d)

None of these are true

50.

What kind of program does Python need?

a)

Interpreter

b)

Compiler

c)

Assembler

d)

Machine code