wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Algorithms - python (GCSE)

Total questions: 25

Worksheet time: 15mins

Name
Class
Date
1.

What is an algorithm?

a)

A set of rules

b)

Step by step instructions to solve a problem

c)

Instructions that are executed one after another

d)

Instructions that are completed in a random order

2.
Code repeated / looped until a condition has been met or a set number of times.
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
3.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
4.

people = ["John", "Rob", "Bob"]

print (people[1])

what would this result be?

a)
John
b)
Rob
c)
Bob
5.

people = ["John", "Rob", "Bob"]

print (people[4])

what would this result be?

a)
John
b)
Rob
c)
Bob
d)
Error
6.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
7.
To repeat until a particular condition is true use
a)
while loop
b)
for loop
c)
if loop
d)
indentation
8.

A data type than can have one of two values: True or False

a)

boolean

b)

variable

c)

modulo

d)

interpreter

9.
To solve a problem that requires the user to enter 10 numbers would use what type of iteration?
a)
While loop
b)
For loop
c)
Variable
d)
Selection
10.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
11.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
12.
What output will this code produce?
a)
Exeter
b)
4
c)
6
d)
city
13.

What is the % used for in Python?

a)

To give the remainder

b)

To divide and return an integer

c)

To divide and return a float

d)

To give the percentage

14.

What is a variable?

a)

Step by step instructions to solve a problem

b)

A location in memory that stores a value, and that value can change

c)

A set of rules

d)

A location in memory that stores a value, and that value cannot change

15.

How many parameters doe the code have?

a)

1

b)

0

c)

3

d)

2

16.

Is this a function or a procedure?

a)

Function

b)

Procedure

17.
Using a binary search why will the number 9 never be found in the following list:
11, 8, 13, 9, 7, 3
a)
It does not work on numbers
b)
It only works on letters
c)
The list is not in order
18.
Which of the following descriptions best describes a linear search:
a)
Put the elements in order, check each item in turn
b)
Put the elements in order, compare with the middle value, split the list in order and repeat
c)
Elements do not need to be in order, check each item in turn.
d)
Elements do not need to be in order, compare to the middle value, split the list in order and repeat.
19.
Which of the following is NOT a sort algorithm?
a)
Bubble
b)
Merge
c)
Insertion
d)
Linear
20.
Which of the following describes a merge sort?
a)
Compares each pair and swaps
b)
List is split in two and merged together in order
c)
List is split into 2 and kept seperate
d)
None of the above
21.
Bubble sort takes the first two values of a list, and swaps them if wrong?
a)
True
b)
False
22.

What is this code an example of:


IF length of password <= 6 THEN

print(“Password is too short.”)

ELSE

print(“password is valid.”)

ENDIF

a)

Selection

b)

Iteration

c)

Print

d)

Sequence

23.

This code uses which construct?

x = 0

WHILE x < 5

print(x)

x = x + 1

END WHILE

a)

Sequence

b)

Selection

c)

Iteration

24.

What is the difference between a subroutine and a function?

a)

They are the same thing

b)

A function can run without being called

c)

A function returns a value to the main program

25.

What keyword indicates that it is a function and not a procedure?

a)

RETURN

b)

PRINT

c)

INT

d)

DEF