Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Model test

Total questions: 40

Worksheet time: 30mins

Name
Class
Date
1.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
2.
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
3.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
4.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

5.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
6.
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")
7.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
8.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
9.
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!
10.
What will the output be from the following code?
print("Hello" + str(2) + "world!")
a)
Hello world! Hello world!
b)
Hello2world!
c)
Hello Hello world! world!
d)
SyntaxError
11.

What does the following code do? myAge = int (myAge)

a)

Converts the var (variable) myAge to a string

b)

Converts the var (variable) myAge to a integer

c)

Converts the var (variable) myAge from a integer to a string

d)

Converts the var (variable) myAge to if statement

12.
What is python named after
a)
The snake
b)
Television show called Monty Python
13.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
14.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
15.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
16.

Which one will display when this code is run?

a)
b)
c)
d)
17.
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"
18.
Which symbol do we use if we want to add a comment to our code?
a)
@
b)
#
c)
*
d)
&
19.
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
20.
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
21.
Which of the following is a float?
a)
new_var = 1234
b)
new_var = True
c)
new_var = 1.234
d)
new_var = "True"
22.
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
23.
What does an IF statement do?
a)
Closes the program
b)
Makes a decision
c)
Asks a question
24.
Which of these would be used to loop through instructions a set number of times?
a)
IF statement
b)
WHILE loop
c)
FOR loop
25.

There are 40 students in a classroom. We would like to get all students whose name starts with "A". Which looping is suitable?

a)

For loop

b)

While loop

26.

You are in the car with traffic jammed at a junction. To cross that junction according to the traffic rules, which one is NOT applicable

a)

While loop

b)

Conditional Statement

c)

For loop

27.

You want to sampling 10 from 100 patients (One-by-One). Which one does NOT necessary in your code?

a)

For loop

b)

While loop

c)

Conditional Statement

d)

Set

28.

Given a statement "All swan are white". To falsify this statement, you need to travel around the world and find at least one non-white swan. Which one is a indispensable command in your coding?

a)

For loop

b)

While loop

c)

Conditional statement

29.

Patients visit hospital everyday. You want to count for the "new patients" for each day. Which one is not necessary?

a)

Set

b)

While loop

c)

For loop

d)

Set difference

30.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
31.
What output will this code produce?
a)
Exeter
b)
4
c)
6
d)
city
32.
What output will this code produce?
a)
4
b)
2
c)
3
d)
5
33.
What output will this code produce?
a)
1
b)
3
c)
i
d)
0
34.

What is the value of the expression 100 / 25?

a)

4

b)

4.0

c)

"4.0"

d)

'4.0'

35.

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

a)

>=

b)

>

c)

<

d)

<=

36.

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

a)

7

b)

1

c)

0

d)

5

37.

x = 5


print(x > 3 and x < 10)

a)

True

b)

False

38.

x = 8


print(x > 3 or x < 20)

a)

True

b)

False

39.

x = 10

y = 10


print(x != y)

a)

True

b)

False

40.

What is printed by the following statement?

print("P" not in "APCSP")

a)

True

b)

False

c)

Error