wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Y9 Programming Test

Total questions: 40

Worksheet time: 1hrs 20mins

Name
Class
Date
1.

The process of finding errors in your code and removing or solving them is called?

a)

Filtering

b)

Probing

c)

Debugging

d)

Refining

2.

Manisha had written the following code and when she runs it, she receives an error.

What does she need to do for the code to run as expected

a)

Include commas in the print statement

b)

The user input needs to be cast to the correct datatype

c)

Remove the brackets in the print statement

d)

Replace the speech marks with single quote marks

3.

What term do we give to code that contain actions that must be execute one after the other without skipping any?

a)

Iteration

b)

Sequence

c)

Selection

d)

Decomposition

4.

This code is an example of which programming construct?

a)

Sequence

b)

Iteration

c)

Decomposition

d)

Selection

5.

This code is an example of which programming construct?

a)

Iteration

b)

Sequence

c)

Decomposition

d)

Selection

6.

Which of the following makes use of a function?

a)

total = price * quanitity

b)

name = "Minahil"

c)

while grade != 5:

d)

name = input("Enter your name")

7.

What arithmetic operator should replace the + to give the correct total of ticket sales?

a)

//

b)

/

c)

%

d)

*

8.

A program has been written to validate the height of a child wishing to ride a roller coaster. The program is run and 1.5 is entered as the height.

What does the program output?

a)

You are too tall to ride the roller coaster

b)

Nothing

c)

You are not tall enough to ride the roller coaster

d)

You can ride the roller coaster

9.

Which of these relational operators would be needed to check if a variable holds a value greater or equal to 100?

a)

<

b)

>

c)

<=

d)

>=

10.

A program has been written to validate user input in response to a question. The Boolean operator AND has been used, this is incorrect. What Boolean operator should be used instead?

a)

EQUALTO

b)

XOR

c)

NOT

d)

OR

11.

The following code stores items that have been added to a bag in a video game. Which piece of code will replace "Jet boots" with "Super Hammer" in the list?

a)

bag[3] = Super Hammer

b)

bag[4] = "Super Hammer"

c)

bag[2] = "Super Hammer"

d)

bag[1] = Super Hammer

12.

Which of the following is NOT true about lists?

a)

A list can store a collection of data items

b)

A list has an index

c)

list.length() is used to find the length of a list

d)

A list can only store store data of a single type

13.

What would this code output?

a)

True

b)

False

c)

NOT C

d)

C

14.

What is colour an example of?

a)

Relational operator

b)

Boolean operator

c)

Variable

d)

Constant

15.

Which of these code snippets could be used as a selection statement?

a)

while x < y:

b)

if x == y:

c)

print("Hello")

d)

for i in range(0,3):

16.

What would this program output when run?

a)

tick, tock, tick, tock

b)

tick, tick, tick

c)

tick, tick, tick, tock

d)

tick, tick, tock

17.

What would this program output?

a)

86

b)

14

c)

48

d)

totalPoints

18.

This code is an example of which programming construct?

a)

Iteration

b)

Sequence

c)

Selection

d)

Decomposition

19.

What will this program output when run?

a)

5,6,7,8,9,10

b)

11,12,13,14,15

c)

10,20,30,40,50

d)

10,10,10,10,10

20.

What will be output as a result of the program?

a)

18

b)

10

c)

14

d)

12

21.
When would I use '=='?
a)
Checking if two values are equal
b)
Making a value equal to another
c)
Checking if a value is not equal to another value
d)
Check if a value exists or not
22.
Which is the most appropriate data type for: 34.9
a)
Float
b)
Boolean
c)
Integer
d)
String
23.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
24.

In programming terms what is a sequence?

a)

A piece of code that is not used

b)

A special programming language

c)

A series of instructions carried out one after another in order

d)

A piece of hardware that the program is stored on

25.

Which of the following means not equal to?

a)

==

b)

=

c)

!=

d)

<

26.

if you entered 7%2 what result would you get in python?

a)

3

b)

1

c)

2

d)

0

27.

Which of the following is NOT a suitable variable name?

a)

num1

b)

Num1

c)

MyName

d)

My name

28.

If you type 10/5 what result would you get in python?

a)

2

b)

2.0

c)

0

d)

15

29.

What is the syntax error in this code?

a)

Incorrect use of variable

b)

The code is not indented correctly

c)

Missing : character at the end of the else statement

d)

Missing brackets

30.

What is the syntax error in this code?

a)

Incorrect use of variable

b)

Missing : characters at the end of the if and else statements

c)

The code is not indented correctly

d)

Missing brackets

31.

What is the coder's word for converting one data type into another?

a)

casting

b)

throwing

c)

catching

32.

What would be the answer here?

x = "hello"

print(len(x))

a)

2

b)

3

c)

4

d)

5

33.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
34.
Data type for a whole number
a)
String
b)
Integer
c)
Boolean
d)
Float
35.

Which of the following input statements are correct?

a)

input="Enter your name")

b)

name =input enter your name

c)

name=input("Enter your name")

d)

name=input["Enter your name"]

36.

Which statement prints 7 (Select 2 answers)

a)

print 7

b)

print("7"

c)

print("7")

d)

print(3 + 4)

37.

Why do we test our programming code

a)

To show how good it is

b)

To find and remove any errors

c)

Because if we make a mistake our program will delete itself

d)

To add extra functions to our program

38.
What will the following lines of code print?
a)
A
b)
B C
c)
A B C
d)
Nothing, it will return an error.
39.
Which of the following would lead to "A few more months" being printed?
a)
age is 27 and birth_month is 4
b)
age is 16 and birth_month is 7
c)
age is 17 and birth_month is 10
d)
age is 12 and birth_month is 12
40.
a)
Hello world!
b)
Error
c)
Hello world!
False
d)
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
(repeated continuously)