wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Y8 EOY CS revision - python & algorithms

Total questions: 56

Worksheet time: 28mins

Name
Class
Date
1.

A set of precise instructions that is meant to solve a problem is .......................

a)

a computer

b)

an algorithm

c)

a program

d)

an interpreter

2.

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

a)

plus +

b)

forward slash /

c)

equals =

d)

asterisk *

3.

Read the Python program:


When this program is executed, what will be displayed on the screen?


Note: There may be errors in the program and/or it may not behave as expected.

a)

"I live in", location

b)

"I live in", "Leeds"

c)

I live in location

d)

I live in Leeds

4.

Read the Python program:


When this program is executed, what will be displayed on the screen, as a result of executing line 3?


Note: There may be errors in the program and/or it may not behave as expected.

a)

I’ve never been to and whatever the user has typed at the keyboard

b)

I’ve never been to location

c)

I’ve never been to input()

d)

It is not possible to know the output without executing the program.

5.

Which feature of programming involves a decision, but does not involve repeats?

a)

Sequence

b)

Selection

c)

Iteration

6.

Read the Python program below:


1. answer = 3 + 13 * 3

2. print("The Answer is", answer)


When this program is executed, what will be displayed on the screen?


Note: There may be errors in the program and/or it may not behave as expected.

a)

The Answer is 3 + 13 * 3

b)

The Answer is 42

c)

The Answer is 48

d)

The Answer is answer

7.

The code you use to receive an input from the keyboard

a)

enter()

b)

receive()

c)

add()

d)

input()

8.

Read the Python program:


When this program is executed, what will be displayed on the screen if the user enters 0 at the prompt?

a)

0 is positive 0 is negative

b)

0 is positive

c)

0 is negative

d)

The program will not display anything because 0 is neither positive nor negative.

9.

What is the word (command) used to display numbers and text on the screen?

a)

print

b)

output

c)

input

d)

command

10.

A WHILE loop is an example of which type of feature

a)

Sequence

b)

Selection

c)

Iteration

d)

Concatenation

11.

Read the Python program:


When this program is executed, what will be displayed on the screen?


Note: There may be errors in the program and/or it may not behave as expected.

a)

small

b)

medium

c)

medium large

d)

large

12.

To display the following on screen

Hello World!


the following command should be used:

a)

print(Hello World!)

b)

print("Hello World" + !)

c)

print("Hello World!")

d)

print"(Hello World!)"

13.

If you receive a NameError (name is not defined) when you run your program it means....

a)

A variable has been assigned before it has been referred to.

b)

An incorrect name has been chosen.

c)

A variable has been referred to before it has been assigned.

d)

A language key word has been used.

14.

What will be the output?

1. name = "Dave"

2. print (name)

a)

"Dave"

b)

name

c)

(name)

d)

Dave

15.

Read the Python program:


When this program is executed, how many times will line 4 be executed?


Note: There may be errors in the program and/or it may not behave as expected.

a)

Line 4 will be executed once.

b)

Line 4 will be executed at least once.

c)

Line 4 will be executed 1357 times.

d)

Line 4 will be executed an infinite number of times (the while loop will never terminate).

16.

Which line of code would create a variable called

my_message

and give it the value

"bye"?:

a)

my_message = “bye”

b)

“my_message” = bye

c)

variable my_message = “bye”

d)

my_message(“bye”)

17.

What will the output be from the following code?

Print("Hello world!")

a)

Hello world!

b)

"Hello world"

c)

NameError

d)

Print(Hello world!)

18.

Read the Python program:


How many times will line 3 be executed?


Note: There may be errors in the program and/or it may not behave as expected.

a)

None (the condition in line 2 will be False the first time it is checked)

b)

1

c)

3

d)

4

e)

Infinitely (the condition in line 2 will never become False)

19.

Read the Python code:


Which code is missing from line 11 to ''raise the Boolean flag' and end the game?

a)

guessed = True

b)

guessed = False

c)

guessed == True

d)

guessed = "False"

20.

What syntax would you use to create a name variable?

a)

name=input{}

b)

input=name

c)

name=input()

d)

name=INPUT

21.

What is decomposition?

a)

Adding detail to make a problem more complex

b)

When you ignore the unnecessary detail in a problem

c)

Breaking down a complex problem or system into smaller, more manageable parts

22.

Identify the correct definition of abstraction

a)

Creating a flowchart to outline how the system will work

b)

Identify the appropriate variable names to use in a program

c)

Hiding unnecessary data/detail and focusing on the key data/detail

d)

Breaking down a larger problem into smaller sub problems

23.

What is pattern recognition?

a)

Breaking down a complex problem into smaller problems

b)

Building models from patterns

c)

Looking for similarities among and within problems

24.

Identify the pseudocode algorithm that performs the same outputs as this flowchart.

a)

A

b)

B

c)

C

d)

D

25.

Identify which pseudocode algorithm performs the same function as the flowchart:

a)

A

b)

B

c)

C

d)

D

26.

Identify the output from the following algorithm:

a)

5

b)

10

c)

15

d)

20

27.

identify which algorithm will output the numbers 1 to 20

a)

A

b)

B

c)

C

d)

D

28.

When using iteration in an Algorithm what is a condition?

a)

a string

b)

a statement that is either True or False

c)

an integer

d)

a list

29.

What does this code do?


while answerIsWrong == TRUE

print("What is the answer?")

a)

Creates a loop

b)

Takes an input from the user

c)

creates a string

d)

calculates Pi

30.

What does the following code do?


if goodGrades == TRUE then

print("Congratulations!")

end if

a)

updates goodGrades variable

b)

if a condition is met, prints a message to the screen

c)

creates a loop

d)

take an input from the user

31.

Why do we decompose a complex problem?

a)

To make it more difficult to solve

b)

To make it easier to solve

c)

To change the problem we have

32.

Which of these is an example of decomposition?

a)

Watching a mechanic repair a car

b)

Looking at different car model for similarities between them

c)

Finding out how a car works by looking in detail at the different parts that make up the car

33.

Which of these is an example of decomposition?

a)

Breaking down the problem of organising a cake sale into smaller parts, such as who will bake the cakes and when to hold the cake sale

b)

Taking the problem of baking a cake and thinking about how we can make it the best cake possible

c)

Asking people what their favourite cake is

34.

How often do we decompose problems?

a)

We never decompose them, computers do this for us

b)

Every day, often without thinking about it

c)

Occasionally, but we don’t really need to

35.

Which of these is an example of decomposition?

a)

Guessing who has solved a crime from looking at patterns that have happened before

b)

Solving the complex problem of a crime by breaking it down into when the crime was committed and were there any witnesses

c)

Looking at what different crimes could be committed

36.

Why do we need to look for patterns in problems?

a)

We don't need to look for patterns

b)

Patterns make it easier for us to solve complex problems

c)

Patterns make it more difficult for us to solve complex problems

37.

What rule is being used in the pattern below?

2, 4, 6, 8, 10, 12

a)

multiply by 2

b)

add 2

c)

subtract 2

d)

divide by 2

38.

Which pattern comes next?

a)

A

b)

B

c)

C

d)

D

39.

What are the missing numbers in this pattern?

23, 33, ___, 53, ___, 73

a)

32, 62

b)

42, 63

c)

43, 63

d)

42, 62

40.

Which of the following pieces of information are specific detail when drawing a house rather than a general pattern (Select more than one answer)

a)

There are houses in London

b)

A house has windows

c)

A house has walls

d)

Some houses have a garage attached

e)

Some houses have a red front door

41.

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 wall paintings

c)

Number of walls

d)

Types of floor coverings

42.

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)

Classes

c)

Guardian's phone number

d)

Eye Colour

43.

Which of the following is NOT computational thinking?

a)

decomposition

b)

coding

c)

pattern recognition

d)

algorithms

44.

What does the oval/circle mean in a flowchart?

a)

Input/Output

b)

Decision

c)

Start/End

d)

For loop

45.

What shape is used for decision in flowcharts

a)

Square

b)

Rhombus

c)

Triangle

d)

Circle

46.

How many arrows should come out of a decision symbol in a flowchart?

a)

0

b)

1

c)

2

d)

3

47.

What would be the output of this flowchart if the student scored 59?

a)

A

b)

B

c)

C

d)

Fail

48.

Identify the output from this algorithm, when the number 5 is entered first and then the number 6.

a)

5

b)

6

c)

11

d)

35

49.

Identify the statement about algorithms that is true.

a)

An algorithm will only run when it has been written correctly.

b)

Only computer programmers write algorithms.

c)

They are a series of steps or instructions.

d)

They are always written on a computer using a programming language.

50.

Identify the correct definition of a flowchart

a)

A diagram that represents a set of instructions, using standard symbols

b)

Identify the appropriate variable names to use in a program

c)

Hiding unnecessary data/detail and focusing on the key data/detail

d)

Breaking down a larger problem into smaller sub problems

51.

Identify the correct definition of an algorithm

a)

Creating a flowchart to outline how the system will work

b)

Identify the appropriate variable names to use in a program

c)

A list of rules to follow in the right order to solve a problem.

d)

Hiding unnecessary data/detail and focusing on the key data/detail

52.

Identify the program that will output the number 10

a)

A

b)

B

c)

C

d)

D

53.

A satellite navigation system is being designed to help drivers find their way to their destination.

Identify which of the following are actions of abstraction to be undertaken?

a)

Identify the description of how decomposition is applied in this system.

b)

Identify the variables to store the current position e.g, longitude, latitude

c)

Ignoring elements such as scenery (e.g. fields, trees)

d)

Splitting the system into subprograms such as user entry, route generation and route display

54.

Which type of iteration should be used when you know how many times you want to loop?

a)

count controlled

b)

condition controlled

55.

The pseudocode INPUT SCORE describes that data inputted into the system should be stored in the variable SCORE.

a)

True

b)

False

56.

Pseudocode is used by the computer to know what an algorithm should do.

a)

True

b)

False