wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Gr 2 Assessment -Python Recap ModuleYear 9 (RM)

Total questions: 100

Worksheet time: 1hrs 9mins

Name
Class
Date
1.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
2.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

3.

Which statement correctly assigns the string "Peter" to the variable name?

a)

name  = print( "Peter")

b)

input("Peter")

c)

name = "Peter"

d)

name = input("Peter")

4.

What is an example of a boolean?

a)

"Hello!"

b)

56

c)

True/False

d)

46.7

5.

What is the output of the following code?

x = 5
y = 3
print(x + y)

a)

8

b)

2

c)

15

d)

7

6.

Which function is used to get input from the user in Python?

a)

input()

b)

get_input()

c)

read()

d)

scan()

7.

Which is the most appropriate data type for: "13th December"

a)

String

b)

Boolean

c)

Float

d)

Integer

8.

print("12"*3)

What would this print?

a)

121212

b)

36

c)

24

d)

12*3

9.

age = '5'


In the code above, age is a

a)

string

b)

integer

c)

floating point

10.
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
11.

A variable that only contains whole numbers would be

a)

A float

b)

A string

c)

An integer

d)

A char

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 is the answer to print (12/6)?
a)
1
b)
2
c)
6
d)
10
14.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
15.

Which statement prints I am 10 years old?

a)

pint("I am 10 years old.")

b)

print('I am 10 years old.)

c)

print('')I am 10 years old.

d)

print("I am 10 years old.")

16.

What is the Python built-in function used to display numbers and text on the screen?

a)

print

b)

input

c)

output

d)

command

17.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
18.

The output of the program

x = 4

x = "Sally"

print(x)

a)

four

b)

Saly

c)

Sally

19.

Python language use

a)

upper case letters

b)

lower case letters

c)

upper and lower case letters

20.
what are the advantages of python?
a)
free and open source 
b)
can do the work for you 
c)
easy 
21.

What will code output?

a)

Adult

b)

Child

c)

Teenager

d)

Error

22.

Which operator checks for equality in Python?

a)

=

b)

==

c)

===

d)

!=

23.

In Python, 'elif' is short for:

a)

else if

b)

else information

c)

either if

d)

else in function

24.

What will the code print?

a)

Smaller

b)

Greater

c)

Error

d)

Nothing

25.

How do you read a user's input and store it in a variable named 'name'?

a)

name = input("Enter your name: ")

b)

input("Enter your name: ") -> name

c)

name <- input("Enter your name: ")

d)

get("Enter your name: ") as name

26.
 A ________ is a sequence of characters.
a)
boolean
b)
floating point number
c)
word
d)
string
27.
 What is the proper way to compute 7 to the power of 2 (or 7 squared)?
a)
7^2
b)
7**2
c)
7*2
d)
7pwr2
28.
What term defines a named memory location used to store data in a program?
a)
Variable
b)
Expression
c)
Operand
d)
function
29.
returns the remainder from division
a)
modulo
b)
exponent
c)
boolean
d)
variable
30.
symbol used for modulo
a)
**
b)
&
c)
%
d)
^
31.
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
32.
What will the output be from the following code?
print("Hello" + "world" + "today")
a)
Helloworldtoday
b)
Hello world today
c)
"Hello" "world" "today"
d)
SyntaxError
33.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
34.
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
35.
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")
36.
I am 71 years old! What will the output be?: IF you are 70 or older, say “You are aged to perfection!” ELIF you are exactly 50, say “Wow, you are half a century old!” ELSE say “You are a spring chicken!”
a)
“You are aged to perfection!”
b)
"Wow, you are half a century old!"
c)
"You are a spring chicken!"
37.
I am 18 years old! What will the output be?: IF you are 70 or older, say “You are aged to perfection!” ELIF you are exactly 50, say “Wow, you are half a century old!” ELSE say “You are a spring chicken!”
a)
"You are aged to perfection"
b)
"Wow, you are half a century old!"
c)
"You are spring chicken!"
38.
what is correct code for INTEGER in python?
a)
in
b)
ing
c)
int
39.
What best defines an IF statement in python?
a)
Is an embedded string with a variable
b)
An IF statement checks to see if a statement is true or false and then does one of two things depending on the result.
40.

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

a)

>=

b)

>

c)

<

d)

<=

41.

What will this code do?

a)

Print Numbers 1-11

b)

Print Numbers 1-10

c)

Print Numbers 2-10

d)

Print Error

42.

Which of these operators means EQUAL TO?

a)

'='

b)

'=>'

c)

'<='

d)

'=='

43.
x = int(input("Enter a Number"))
print(X)
Why won't this work?
a)
Brackets are in the wrong place
b)
Print should have a capital letter
c)
It should have two equals
d)
both x variables should be lower case
44.
What is the meaning of the following comparison operator?
a > b
a)
Greater than
b)
Less than
c)
Not equal to
d)
Greater than or equal to
45.
What is the meaning of the following comparison operator?
a >= b
a)
Equal to
b)
Not equal to
c)
Greater than or equal to
d)
Less than or equal to
46.
What is the meaning of the following comparison operator?
a <= b
a)
Greater than
b)
Less than or equal to
c)
No equal to
d)
Equal to
47.
What is the meaning of the following comparison operator?
a < b
a)
Greater than
b)
Less than
c)
No equal to
d)
Equal to
48.

Which is the python logo?

a)

Top left

b)

Bottom left

c)

Top right

d)

Bottom right

49.

Arithmetic Operator
What is + ?

a)
Addition
b)
Subtraction
c)
Multiplication
d)
Division
50.
Arithmetic Operator
What is a * ?
a)
Addition
b)
Subtraction
c)
Multiplication
d)
Modulo
51.
Arithmetic Operators
What is a / ? 
a)
Addition
b)
Subtraction
c)
Division
d)
Modulo
52.

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

53.

What in the name of the variable in this Python code?

a)

name

b)

input

c)

print

d)

("What is your name")

54.

Which of these is not an arithmetic operator?

a)

+

b)

-

c)

*

d)

=

55.

When coding in Python what two instructions would I use if I want the program to select a choice?

a)

IF

PRINT

b)

IF

COUNT

c)

IF

ELSE

d)

IF

INPUT

56.

Which command will correctly ask the user for their age?

a)

age = input("How old are you?")

b)

age = input(How old are you?)

c)

input("How old are you?") = age

d)

How old are you = input()

57.

Which decision statement will be triggered if the variable x is less than 20?

a)

if x > 20:

b)

if x <> 20:

c)

if x == 20:

d)

if x < 20:

58.

What would the output of this code be if the user entered the value 70?

a)

Pass

b)

Fail

c)

Merit

d)

Distinction

59.

What is the output of this code?

a)

5

b)

10

c)

15

d)

Error

60.

a = 10

b=5

b=a+5

print(b)

What would be printed to the screen in this example?

a)

5

b)

10

c)

105

d)

15

61.

a = 10

b=5

b=a+5

print(a)

What would be printed to the screen in this example?

a)

5

b)

10

c)

105

d)

15

62.

Code for

Five is greater than two!

a)

if 5 > 2:

print("Five is greater than two!")

b)

if 5 = 2:

print("Five is greater than two!")

c)

if 5 > 2: Print("Five is greater than two!")

63.

What data value would store the value: -9?

a)

Float

b)

Integer

c)

String

d)

Boolean

64.

What data type would store the value: Oranges

a)

String

b)

Float

c)

Boolean

d)

Integer

65.

What is the correct code to ask the user their favorite color?

a)

input("What is your favorite color?")

b)

question("What is your favorite color?")

c)

print("What is your favorite color?")

d)

ask("What is your favorite color?")

66.

What is the difference between an input statement & a print statement?

a)

They are the same code.

b)

input displays answers.

print displays questions.

c)

input displays an output on the console.

print accepts input from a user.

d)

input accepts input from a user.

print displays an output on the console.

67.

What is the output?

a)

more than 7

b)

more than 23

c)

spam

d)

7

68.

What would be outputted here?

a)

it divides by 7!

b)

it divides by 3.

c)

It divides by 7!

d)

It divides by 3.

69.

What is the correct term for this symbol?


" "

a)

Quotation marks

b)

Bunny fingers

c)

Parenthesis

d)

Exclamation mark

70.

What is the output?

a)

level 3

b)

level 3

level 1

c)

level 3

level 1

NIL

d)

level 3

level 2

level 1

NIL

71.

What statement will go into the label?

a)

John is getting ice cream

b)

John is getting apple juice

c)

John is getting baby formula

d)

John is getting nothing

72.

The ‘else’ statement is optional in Python

a)

TRUE

b)

FALSE

73.

There can be an else statement without an if statement

a)

TRUE

b)

FALSE

74.

Which of these is used in Python to add a third, fourth, etc outcome to a scenario?

a)

elif

b)

else if

c)

iff

d)

elsa

75.
What is my result?
john = 5                                                                        .
if john > 6:                                                                  .
.            print("John is getting ice cream")
else:                                                                               .
.               print("John is getting apple juice")
print("John is getting grapes")                    .
a)
John is getting ice cream
John is getting grapes
b)
John is getting apple juice
John is getting grapes
c)
John is getting apple juice
d)
John is getting ice cream
76.
What is my result?
john = 10                                                                     .
if john > 6:                                                                  .
.            print("John is getting ice cream")
else:                                                                               .
.               print("John is getting apple juice")
print("John is getting grapes")                    .
a)
John is getting ice cream
John is getting grapes
b)
John is getting apple juice
John is getting grapes
c)
John is getting apple juice
d)
John is getting ice cream
77.

What is the output?

a)

more than 7

b)

more than 23

c)

spam

d)

7

78.
Evaluate the following expression:
2 + 2 == 4
a)
true
b)
false
c)
sometimes true
d)
only true on sundays
79.
Arithmetic Operators
What is a % ?
a)
Multiplication
b)
Division
c)
Modulo
d)
Increment
80.
Stores decimal numbers
a)
INTEGER
b)
REAL (Float)
c)
STRING
d)
CHARACTER
81.
Stores single characters
a)
INTEGER
b)
REAL (Float)
c)
STRING
d)
CHARACTER
82.
Stores more than one character
a)
INTEGER
b)
REAL (Float)
c)
STRING
d)
CHARACTER
83.
Stores True or False
a)
INTEGER
b)
REAL (Float)
c)
STRING
d)
BOOLEAN
84.

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

a)

x^y

b)

x**y

c)

x^^y

d)

None of the mentioned

85.

name = "bungmanoon"

print(name)

price = 100

print(price)

a)

"bungmanoon"

100

b)

bungmanoon

100

c)

bungmanoon

d)

100

86.

Select the correct answer:


x = 15

y = 4


print( 'x * y')

a)

59

b)

60

c)

54

d)

22

87.

Select the correct answer:


x = 15

y = 4


print(x // y)

a)

3

b)

3.75

c)

4

d)

5

88.

Logical operators:


True if both operands are true

a)

x and y

b)

x or y

c)

not x

89.

Logical Operators:


True if either of the operands is true

a)

x and y

b)

x or y

c)

not x

90.

What will be outputted?

a)

number is bigger than 10

b)

nothing

c)

an error

d)

NUMBER IS BIGGER THAN 10

91.

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

92.

Choose the correct data type:

-900

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

93.

Choose the correct data type:

10500

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

94.

Choose the correct data type:

0.25

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

95.

Choose the correct data type:

240.00

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

96.

Choose the correct data type:

The surname of a user

Example: Chapman

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

97.

Choose the correct data type:

Height (in metres)

Example: 1.64

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

98.

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!

99.
What is Python?
a)
text based programming language
b)
word processor 
c)
spreadsheet
d)
block based programming language
100.

Which of the following would be an example of a string variable:

a)

ValidInput = False

b)

GuessCount = 100

c)

Name = "Bilbo"

d)

Pi = 3.14159265359