Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Year 9 revision quiz

Total questions: 149

Worksheet time: 4hrs 50mins

Name
Class
Date
1.
Which python operator means 'less than or equal to'?
a)
>
b)
<
c)
>=
d)
<=
2.
What is another word for 'iteration'?
a)
Selection
b)
Variable Assignment
c)
Repetition
d)
Sequencing
3.
How many times will this loop run?
a)
10
b)
9
c)
4
d)
5
4.
I want to allow the program to repeatedly ask the user to enter their guess if it does not equal the answer...Which option do I use?
a)
while guess == answer:
    guess=input()
b)
while answer != guess:
guess=input()
c)
while answer =! guess:
guess=input()
d)
while guess != answer:
guess=input()
5.

Which word completes this sentence: "Iteration makes code more ___________"

a)

Complex

b)

Efficient

c)

Simple

d)

Straightforward

6.

A FOR loop is....

a)

A COUNT controlled loop

b)

A CONDITION controlled loop

7.

A WHILE loop is....

a)

A COUNT controlled loop

b)

A CONDITION controlled loop

8.

What will the output be for the code shown here?

a)

3,2,1,0

b)

0,1,2,3

c)

3,2,1

d)

1,2,3

9.

What would the output be for the code shown here?

a)

0,1,2,3,4,5,6,7,8,9

b)

1,2,3,4,5,6,7,8,9,10

c)

0,2,4,6,8,10

d)

0,2,4,6,8

10.

Anil is writing a "rock, scissors, paper" program. He wants the game to repeat until the user doesn't want to play anymore. What loop should he use?

a)

a FOR loop

b)

a WHILE loop

11.

Clara is writing a program that will print out the first ten numbers of a times table (chosen by the user). Should she use....

a)

a FOR loop

b)

a WHILE loop

12.

Tara has written a "Hide and Seek Simulator" - what will happen when she runs it?

a)

It will print "1,2,3,4,5,6,7,8,9,10 Coming ready or not!"

b)

The program will not run

c)

It will print "1,2,3,4,5,6,7,8,9,11 Coming ready or not!"

d)

It will print ("10 Coming ready or not!")

13.

What shape is used in a flowchart for a decision?

a)

Diamond

b)

Oval

c)

Rectangle

d)

Parallelogram

14.

What shape is used in a flowchart for an input?

a)

Diamond

b)

Oval

c)

Rectangle

d)

Parallelogram

15.

What shape is used in a flowchart for an output (e.g. print)?

a)

Diamond

b)

Oval

c)

Rectangle

d)

Parallelogram

16.

What shape is used in a flowchart for a process (e.g. addition or assignment)?

a)

Diamond

b)

Oval

c)

Rectangle

d)

Parallelogram

17.

How many exit arrows do you have on a decision shape in a flowchart?

a)

1

b)

2

c)

it depends

d)

0

18.

What word beginning with 'v' is used in programming to store a number or a word (string), and can change when the program runs? (type one word)

(a)  

19.

What word beginning with 'a' means to give a variable a new value, and uses a single = sign in Python? (type one word)

(a)  

20.

What word beginning with 'c' means to check if two things are the same as each other and uses the == sign in Python? (type one word)

(a)  

21.

What word beginning with 's' is used to describe an algorithm that can do different things depending on the circumstances (e.g. an input or a variable)? (type one word)

(a)  

22.

What word beginning with 's' is used to mean that instructions have to be completed in the right order for an algorithm to do what you expect? (type one word)

(a)  

23.

What word beginning with 'q' is what you have to put inside a decision shape in a flowchart? (type one word)

(a)  

24.

What is the Python keyword that is used for selection?

a)

if

b)

input

c)

print

d)

int

25.
What is the primary purpose of the input function in a Python program?
a)
To ignore comments in the code
b)
To display data to the user
c)
To store data in a variable
d)
To ask the user for information
26.
Which command is used to output messages in Python?
a)
input()
b)
echo()
c)
output()
d)
print()
27.
What role do variables play in a Python program?
a)
They ignore comments in the code
b)
They display output to the user
c)
They store data for later use
d)
They execute commands
28.
What does a comment in Python code signify?
a)
It is executed as part of the program
b)
It outputs data to the user
c)
It is ignored by the computer
d)
It defines a variable
29.
Which of the following best describes a string in programming?
a)
A type of mathematical operator
b)
A sequence of characters
c)
A numerical value
d)
A command to output data
30.
What can happen if you use the wrong data type in a calculation?
a)
The program will run faster
b)
The calculation will be correct
c)
The program will ignore the error
d)
The result may be incorrect
31.
What is the function of mathematical operators in Python?
a)
To create comments in code
b)
To define variables
c)
To store user input
d)
To perform calculations on data
32.
Which of the following describes the three basic types of programming constructs?
a)
Input, output, and processing
b)
Data types, operators, and comments
c)
Sequencing, selection, and iteration
d)
Variables, functions, and loops
33.
What is an if statement used for in programming?
a)
To execute code based on a condition
b)
To create loops
c)
To output data to the user
d)
To define variables
34.
Why is relevant variable naming important in programming?
a)
It prevents the use of comments
b)
It allows for more data types
c)
It helps others understand the code
d)
It makes the code run faster
35.

An  algorithm  is a set of precise instructions designed to solve a problem.

a)

True

b)

False

36.

A store your program must use as an identifier to keep track of a value is called a

a)

Algorithm

b)

Variable

c)

Program

d)

Assignment

37.

Which symbol assigns a value to a variable?

(a)  

38.

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

39.

To execute a Python program, you need a Python interpreter.

a)

True

b)

False

40.

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

a)

ValidInput = False

b)

GuessCount = 100

c)

Name = "Bilbo"

d)

Pi = 3.14159265359

41.

The rules for how programming languages statements can be assembled is known as

a)

Variable

b)

Algorithm

c)

Syntax

d)

Debugging

42.

Which of the following would be an example of an integer variable:

a)

ValidInput = False

b)

GuessCount = 100

c)

Name = "Bilbo"

d)

Pi = 3.14159265359

43.

What is the greater than symbol:

(a)  

44.

Python is the fastest growing programming language:

a)

True

b)

False

45.

What would be the result of 3 ** 3

(a)  

46.

What would be the result of 9 // 7

(a)  

47.

What would be the reult of 9 % 7

(a)  

48.

Text to be output to the screen should be enclosed by " "

a)

True

b)

False

49.

The Python IDE colour codes sections of your code to make it easier to debug

a)

True

b)

False

50.

What is a command?

a)

"An instruction put in between quote marks"

b)

An instruction that tells the computer to perform a certain action.

c)

An instruction put in CAPITAL LETTERS

d)

An instruction that is repeated at least once

51.

What is a computer program?

a)

A computer that has learned to program

b)

A text document written by a computer

c)

A television program on a computer

d)

A set of instructions that tell the computer what to do

52.

What is the name of the programming language we are learning?

a)

Scratch

b)

Python

c)

Turinglab

d)

C#

53.

Which two of these are function calls?

a)

prepare_soil

b)

move_forward()

c)

"tomato"

d)

prepare_soil()

54.

What is a function?

a)

A function is a command that performs a specific action when called

b)

Functions are words that always have brackets after them

c)

Functions are commands that have quotes around them and can be put between brackets

d)

Functions are commands that allow you to convert your code from one language to another

55.

Which function call moves the Farmbot forward?

a)

move_forward()

b)

move_forward

c)

Move_Forward()

d)

moveForward()

56.

Which two of the following are strings?

a)

tomato

b)

'A very large pumpkin'

c)

pumpkins and aubergines

d)

"tomato"

57.

What is an algorithm?

a)

A set of instructions that are to be repeated more than once

b)

A set of commands used to perform a particular task

c)

Any computer program

d)

A command created by Mr. Algo Rhythm

58.

Which of these is a function call?

a)

plant

b)

plant("tomato")

c)

move_forward()

d)

"tomato"

59.

Select the two function calls

a)

move_forward

b)

move_forward()

c)

turn("left")

d)

"left"

60.

Identify which lines of code the strings appear on

a)

2, 3

b)

1, 2

c)

2, 4

d)

1, 3

61.

Select the code that will prepare soil and then plant a tomato

a)
b)
c)
d)
62.

Which of these is an argument in the code shown?

a)

plant()

b)

move_forward()

c)

"tomato"

d)

plant("tomato")

63.

Where is Farmbot going to be after running the code?

a)
b)
c)
d)
64.

Identify the two functions written in snake case

a)

returnHome()

b)

prepare_soil()

c)

turn("right")

d)

move_forward()

65.

Identify the bug in the code shown

a)

Indentation error - caused by incorrect spelling

b)

Name Error - caused by incorrect spelling

c)

Syntax Error - caused by incorrect brackets

d)

Symtax Error - caused by incorrect quote marks

66.

Identify the bug in the code shown

a)

Indentation error - caused by incorrect spelling

b)

Name Error - caused by incorrect spelling

c)

Syntax Error - caused by incorrect brackets

d)

Symtax Error - caused by incorrect quote marks

67.

Identify the bug in the code shown

a)

Indentation error - caused by incorrect spelling

b)

Name Error - caused by incorrect spelling

c)

Syntax Error - caused by incorrect brackets

d)

Symtax Error - caused by incorrect quote marks

68.

Select the two ways of adding a comments in Python

a)

// Move into position

b)

## Harvest a row

c)

/* Plant a row */

d)

# Move into position

69.

Which two students have commented their code effectively?

a)
b)
c)
d)
70.

Which two of these functions have been written using snake case?

a)

plant()

b)

turn()

c)

prepare_soil()

d)

move_forward()

71.

Which of the following is NOT a common error message when writing Python code?

a)

Name Error

b)

Syntax Error

c)

Indentation Error

d)

Spelling Error

72.

What is debugging?

a)

The process of finding bugs in your code

b)

The process of writing bugs into your code

c)

A mistake in your code

d)

The process of finding and removing bugs from your code

73.

Which of the following is the correct way of writing a FOR loop?

a)
b)
c)
d)
74.

Which three of the following describe the benefits of using a FOR loop in your code?

a)

It helps create more readable and maintainable code

b)

It stores useful information for later retrieval

c)

It helps select which path to take in the code

d)

It helps by reducing repetition in a programmers code

e)

It helps create clear and concise code

75.

What kind of programming language is Python?

a)

Block

b)

Text

c)

Picture

d)

Function

76.

Which command is correct?

a)

move_forward()

b)

Move_Forward()

c)

move_forward

d)

move_forward("")

77.

Which command is correct?

a)

returnHome()

b)

return_Home()

c)

return_home()

d)

RETURN_HOME()

78.

Which line of code is the error on?

a)

1

b)

2

c)

3

d)

4

79.

What line of code is missing from here to make farmbot plant two potatoes?

(a)  

80.

Every game & app has been created using a programming language:

a)

True

b)

False

81.

Is the following code snake case or camel case?


returnHome()

a)

Snake case.

b)

Camel case.

c)

Neither.

82.

Is the following code snake case or camel case?


return_home()

a)

Snake case.

b)

Camel case.

c)

Neither.

83.
When you have an error in your code what is the term to summarise finding and fixing that error?
a)
Error checking
b)
Debugging
c)
Syntax finder
d)
Error finder
84.

A syntax error means your code has a 'grammar' mistake or you used symbols incorrectly.

a)

True

b)

False

85.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
86.

What symbol is used in Python to assign values to a variable?

a)

equals =

b)

plus +

c)

forward slash /

d)

asterisk *

87.
Comments help the programmer make ________ within the program without affecting the code.
a)
notes
b)
changes
c)
revisions
d)
a mess
88.
Code executed based on a condition being true
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
89.
Code repeated / looped until a condition has been met or a set number of times.
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
90.

The statement using the and operator results true if _______

a)

both operands are true

b)

both operands are false

c)

either of the operands is true

d)

first operand is true

91.

Which of these is correct Python conditional statement?

a)

IF answer == "Yes":

b)

if answer == "Yes"

c)

if answer == "Yes":

d)

if answer = "yes":

92.

What is a String?

a)

A data type that contains whole numbers. eg: 3, 45, 124

b)

Numbers with decimal point. eg: 0.5, 2.45, 56.04

c)

Group of characters between quotation marks. eg: "dog"

d)

Data type that can only be True or False.

93.

Which of these operators means EQUAL TO?

a)

'='

b)

'=>'

c)

'<='

d)

'=='

94.

Will the lights be on or off at 10 o’clock?

Select one of the following

a)

Off

b)

On

95.

In the code below, which of the values are variables?

Select one or more of the following

a)

time

b)

print()

c)

get_time()

d)

is_dark

96.

Select a logical operator

a)

if

b)

and

c)

else

d)

>=

97.

What does the colon : symbol tell the computer?

a)

codes that come after it are part of it

b)

codes that are indented under it are part of it

c)

codes that have arguments will be played

d)

codes that are variables will be ignored

98.

What will this code do?

a)

Print Numbers 1-11

b)

Print Numbers 1-10

c)

Print Numbers 2-10

d)

Print Error

99.

When writing an if/else statement, you

a)

always indent the line after the condition

b)

never indent the line after the condition

c)

capitalize every word

d)

put a colon at the beginning and the end

100.

Which of the following is not done by abstraction?

a)

Identifies essential details

b)

Disregards non-essential information

c)

Breaks the problem down into smaller tasks

101.

Which of the following is not done by decomposition?

a)

Allows multiple people to work on the problem together

b)

Disregards non-essential information

c)

Breaks the problem down into smaller tasks

102.

When drawing a dog, which of the following characteristics is non-essential?

a)

Dogs have 4 paws

b)

Dogs have fur

c)

Dogs have brown fur

103.

When designing a building that must be accessible for wheelchairs, which of the following characteristics is non-essential?

a)

Number of doors

b)

Number of walls

c)

Number of wall paintings

104.

One advantage of abstraction is that it means no mistakes can be made

a)

True

b)

False

105.

You could use abstraction to replace specific objects with simple shapes

a)

True

b)

False

106.

This is a good example of decomposition

Sit down

Do homework

a)

True

b)

False

107.

Decomposition allows each task to become _______

a)

More manageable

b)

Easier

c)

Quicker

108.

Decomposition allows the entire task to be completed as _____

a)

A Team

b)

A Whole

c)

Quickly as possible

109.

Abstraction and Decomposition are separate concepts, you would usually choose to do either one or the other

a)

True

b)

False

110.

It is always necessary to decompose a task

a)

True

b)

False

111.

Abstraction and Decomposition are examples of...

a)

Computational Thinking

b)

Algorithmic Thinking

c)

Computer Science

d)

Logical Reasoning

112.

What is pattern recognition?

a)

Breaking down a complex problem into smaller problems

b)

Looking for similarities among and within problems

c)

Building models from patterns

113.

Why do we need to look for patterns in problems?

a)

Patterns make it easier for us to solve complex problems

b)

We don't need to look for patterns

c)

Patterns make it more difficult complex problems

114.

If you don't look for patterns in a problem, your solution might be _____

a)

Wrong

b)

Inefficient

c)

Too slow

115.

Identifying the steps involved in solving a problem

a)

Abstraction

b)

Decomposition

c)

Pattern Recognition

d)

Algorithmic Thinking

116.
Which of the following is an example of thinking computationally?
a)
Planning out your route when going to meet a friend
b)
When going to meet a friend, wandering around until you find them
c)
When going to meet a friend, asking a parent to plan your route for you
117.

Looking for similarities and trends within a problem

a)

Abstraction

b)

Decomposition

c)

Pattern recognition

d)

Algorithmic Thinking

118.

What is a flowchart?

a)

A visual representation of an algorithm.

b)

A diagram that shows abstraction.

c)

A series of shapes.

119.

A school database has lots of information on students, the data manager needs to use abstraction. What data should she leave out?

a)

Age

b)

Guardian's phone numbers

c)

Classes

d)

Eye colour

120.

Which line of code is correct?

a)

hero.MoveLeft()

b)

heroMoveLeft();

c)

hero.moveleft(:

d)

hero.moveLeft()

121.

Which line of code will make the hero move up 4 times?

a)

4.hero.Move.Up();

b)

hero.MoveUp(4);

c)

hero.4MoveUp();

d)

hero.Move4Up();

122.

What must every line of code end with?

a)

comma ,

b)

semi-colon ;

c)

parantheses ()

d)

period .

123.

Which line of code will attack Kratt?

a)

hero.attack("Kratt")

b)

hero.attack("kratt");

c)

hero.attack(Kratt);

d)

Hero.Attack.Kratt;

124.

What is the correct way to write a while loop?

a)

while {

b)

while.true {

c)

while (loop)

d)

while True:

125.

How do you create a variable for enemy1 Gert?

a)

enemy1 = "Gert"

b)

enemy1 = Gert

c)

var.enemy1 = Gert;

d)

var.Enemy.1 = "Gert";

126.

You can enter a number as an argument to instruct your object to move more than one space at a time.

a)

True

b)

False

127.

It is not important to capitalize the name of the variables.

a)

True

b)

False

128.

A string will always have quotation marks.

a)

True

b)

False

129.

What is the main reason we use loops?

a)

It saves time

b)

It is faster to create

c)

It is easier to type

d)

To repeat a block of code without having to retype

130.

Which of the following is a comment? PICK ALL ANSWERS THAT ARE CORRECT!

a)

#Move towards the gem

b)

#Don't touch the spikes!

c)

#Type your code below and click Run when you're done

d)

hero.moveRight()

131.

What is the sprite in this program?

a)

Gem

b)

Spikes

c)

Run

d)

Hero

132.

Which line includes the command?

a)

1

b)

2

c)

3

d)

5

133.

What term describes the rules we use for a language? For example, Python uses dot-notation.

a)

Commands

b)

Functions

c)

Syntax

d)

Variables

134.

What is the argument in this code?

a)

hero

b)

move

c)

Right

d)

3

135.

How many times will this hero move?

a)

5

b)

6

c)

10

d)

Unknown

136.

What is the text string in this program?

a)

hero

b)

moveRight

c)

attack

d)

"Brak"

137.

In the syntax for Python, a text string is anything with...

a)

#

b)

" "

c)

( )

d)

capital letters

138.

Which line starts the loop?

a)

1

b)

5

c)

6

d)

8

139.

How many times will this hero move?

a)

2

b)

4

c)

forever

d)

unknown

140.

What do the values "36,34" mean in line 4?

a)

X = 36, Y = 34

b)

Y = 36, X = 34

c)

Build 36 fences 34 times

d)

Unknown

141.

How many enemies will this hero fight?

a)

0- because enemy should be a text string with " "

b)

1- the one named "enemy"

c)

2- because it says "hero.attack(enemy)" twice

d)

unknown- it will keep attacking enemies until none are left

142.
What is the position of the name 'Paula' in the following list:
names = ["Paul","Phillip","Paula","Phillipa"]
a)
0
b)
1
c)
2
d)
3
143.
Look at the code below and identify which of the statements below are true:

for loopCounter in range(10,101,10):
               
     print(loopCounter)
a)
Starts at 10, goes up to 100, increases by 10
b)
Starts at 10, goes upto 101, increases by 10
c)
Starts at 1, goes upto 100, increases by 1
d)
Starts at 10, goes upto 10, increases by 10
144.
How many times does the following program print the word ‘computer’:

word= "computer"  
for num in range(1,6):
 
    print(word)
a)
5
b)
6
c)
1
d)
0
145.
What will be printed after running this FOR loop:

for number in range(6):
 
    print(number)
a)
The number 6 
b)
The numbers 0 - 5
c)
The number 5
d)
The numbers 1 - 6
146.
What letter will be printed on the screen after running this code:

team = “Manchester United”
letter = name[5]
print(letter)
a)
M
b)
d
c)
e
d)
Nothing prints
147.
What is printed when this program is run:
days = 5 
if days > 6:  
   print(“Month”)

else:  
   print(“Week”)
a)
Month
b)
Week
c)
Day
d)
4
148.

What does the code print?

a)

10

7

4

1

Done

b)

10

9

8

7

6

5

4

3

2

1

Done

c)

Done

d)

10

7

4

1

-2

-5

... and more, running infinitely.

149.

Which line of code would correctly call the function?

a)

power(base, exp)

b)

power(x, y)

c)

ans = power(base, exp)

d)

ans = power(x, y)