Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

J277 GCSE Computer Science 2.1 Algorithms

Total questions: 46

Worksheet time: 1hrs 4mins

Name
Class
Date
1.

What is the first step of the linear search algorithm?

a)

Identify the middle item in the list

b)

Identify the first item in the list

c)

Identify a random item in the list

d)

Identify the last item in the list

2.

Ignoring any information about a problem that isn't important is called...

a)

decomposition

b)

abstraction

c)

algorithmic thinking

d)

pattern matching

3.

Which of the following search algorithms can only be carried out on an ordered list?

a)

Linear search

b)

Binary Search

4.

Computational thinking is used to...

a)

improve the efficiency of an existing program or piece of code

b)

turn a problem into something that can be solved by the computer

c)

help you think like a computer

d)

tell the programmer the rules of a programming language

5.

A programmer solves a complex task by writing many small sub programs. This is an example of...

a)

decomposition

b)

abstraction

c)

authentication

d)

pipelining

6.

A program is used to sort a very large list of unordered words into alphabetical order. Which sorting algorithm would sort the list most efficiently?

a)

Bubble sort

b)

Insertion sort

c)

Merge Sort

d)

Binary Search

7.

A benefit of using Algorithmn 1 over Algorithm 2 is that...

a)

it can be more easily converted into a programming language.

b)

it can be interpreted by all programming languages

c)

it uses the proper syntax of all programming languages

d)

it is vague and unstructured

8.

A issue with Algorithmn 2 is that...

a)

it can be easily converted into a programming language.

b)

it can be interpreted by all programming languages

c)

it does not use the proper syntax of a programming language

d)

it is vague and unstructured

9.

Which of the following data types could store the value 45.31?

a)

Integer

b)

Real/Float

c)

Boolean

d)

String

10.

Which expression evaluates to TRUE?

a)

3 < 5 AND 1 > 2

b)

1 != 1 or 4 < 5

c)

NOT ( 7 > 3 )

d)

5 <= 3 OR 8 >= 9

11.

What will 23 DIV 4 return?

a)

6

b)

3

c)

5

d)

4

12.

True or False? "The value of a constant can't be mondifed while a program is running? "

a)

True

b)

False

13.

Which arithmetic operator is used to find the remainder from a division?

a)

DIV

b)

^

c)

MOD

d)

+

14.

Given that x = "CompSci" and test = x[1:4] what is the output of print(test)?

a)

omp

b)

p

c)

Comp

d)

pSci

15.

Which of the following is a count-controlled loop?

a)

FOR

b)

WHILE

c)

DO WHILE

d)

IF

16.

Developing a logical set of instructions to solve a particular problem is known as...

a)

abstraction

b)

decomposition

c)

algorithmic thinking

d)

pattern matching

17.

Combining two string variables using a + is called...

a)

concentration

b)

coordination

c)

concatenation

d)

cognition

18.

Which of the following statements evaluates to 2?

a)

11 MOD 3

b)

10 / 3

c)

3 DIV 2

19.

What would the logic statement 33 > 10 OR 5 < 3 evaluate to?

a)

TRUE

b)

FALSE

20.

An algorithm written in pseudocode...

a)

should always use the proper syntax of a programming language

b)

can show the same solution that a flow diagram can

21.
What is decomposition
a)
Breaking down a problem into smaller problems
b)
Writing small code
c)
A type of program that can break a computer
d)
A hardware device used to break into a computer
22.
What is a linear search algorithm
a)
Going through a list one item at a time to find a value
b)
Searching on the internet
c)
A search engine
d)
A webpage
23.
What is a substring?
a)
A smaller string extracted from a main string
b)
A small string generated by a program
c)
A built-in function to extract a smaller string from a large string
24.
Which of the following is a benefit of using local variables?
a)
less demand on system resources
b)
easier to retrieve data
c)
stored in the cloud
25.

The variables num1 and num2 store integers.

Write python code to add the integers stored in num1 and num2. Store the result in a variable with the identifier total (do not use any space)

(a)  

26.

Write the missing arithmetic operator for the algorithm.

Outputting 12 to the power of 2.
print(12 _ 2)

(a)  

27.

Write the missing arithmetic operator for the algorithm.

Working out if a number is odd or even.

number = 53
if number _ 2 == 0 then
print("Even number")

(a)  

28.

Write the missing arithmetic operator for the algorithm.

Finding the difference between two measurements.

measurement1 = 300
measurement2 = 100
difference = measurement1 _ measurement2

(a)  

29.


Write pseudocode (python code) to increment a value held in a variable called score by one. Do not include any spaces in your code

(a)  

30.

Match the following computational thinking techniques

a)
  • Abstraction

1.

Hiding or removing irrelevant details

b)
  • Decomposition

2.

breaking a problem down into smaller

c)
  • Algorithmic thinking

3.

set out the steps needed to solve tasks

d)

Casting

4.

Converting one data type to another

e)

Input sanitisation

5.

Cleaning up data entered

31.

Describe the steps a binary search will follow to look for a number in a sorted list.

a)

pick middle number in list

b)

if searched number is larger, discard left half, smaller, discard right half

c)

pick middle number in new list

d)
  • Repeat until number found

e)

or remaining list is of size 1 / 0 (number not found)

1)
2)
3)
4)
5)
32.

Please type in the numbers that would be checked in a binary search looking for grade 7. i.e. 1,8,4 NO SPACES!

(a)  

33.

Please type in the numbers that would be checked in a binary search looking for number 10 . i.e. 1,8,4 NO SPACES!

(a)  

34.

Please type in the words that would be checked in a binary search looking for word "house". i.e. "Bob","Cheese" NO SPACES!

(a)  

35.

Identify whether each statement about the insertion sort is true or false.

Categorize the following

The list of words is initially split into a sorted set and an unsorted set

Each word is inserted into the correct place in the array, one by one

The insertion sort uses a divide stage and then a conquer stage.

The list of words must be in order before the insertion sort can start

The insertion sort will not work because the word “wall” appears twice.

True
False
36.

A program creates usernames for a school. The first design of the program is shown in the flowchart.
Tom Ward’s username would be TomWa
What would the username for Rebecca Ellis be?

(a)  

37.

The code shows an algorithm to count up how many empty slots remain in the array and output this value. Please identify the lines where you can see a logic error, please enter these numbers with a comma separating them and no space i.e. 1,2,3

(a)  

38.

What will be printed at the end of the algorithm?

(a)  

39.

Please put in order the steps of a linear search

a)

Starts with first value in list

b)

Compares value with search term

c)

If match returns found and position

d)

If not match goes to next value in order in list

e)

Repeats until either match found or item not in list

1)
2)
3)
4)
5)
40.

State the most appropriate data type for the following fields:

Nights ​ (a)  

Room ​ (b)  

surname ​ (c)  

stayComplete ​ (d)  

There is also a total price, a suitable data type for this would be ​ (e)   ​

Choose from the below words
integer
Premium
string
boolean
character
real
41.

Identify where each statement about the insertion sort is true or false

Categorize the following

The list of words is initially split into a sorted set and an unsorted list

The insertion sort uses a divided stage and then a conquer stage

The list of words must be in order before the insertion sort can start

Each word is inserted into the correct place in the array, one by one

An insertion sort will not work if a word appears more than once

True
False
42.

Reorder the following steps for a Bubble sort algorithm

a)
  1. Start at the beginning of the list

b)
  1. Compare each pair of adjacent elements

c)
  1. If the elements are out of order, swap them

d)
  1. Move to the next pair and repeat comparison until the end of the list (Pass completed)

e)
  1. Repeat the process until no swaps are needed

1)
2)
3)
4)
5)
43.

Reorder the following steps for a Insertion sort algorithm

a)
  1. Start with an unsorted list

b)
  1. Compare the current element to the elements to its left

c)
  1. If the current element is smaller than the element to its left, move it to the left

d)
  1. Repeat until the current element is in the correct position

e)
  1. Repeat for each element in the list

1)
2)
3)
4)
5)
44.

Reorder the following steps for a Merge sort algorithm

a)
  1. Split list into two halves

b)
  1. Keep splitting sublists into two until each sublist contains a single item

c)
  1. Sublists are then merge in pairs

d)
  1. Repeat until all elements are merged

1)
2)
3)
4)
45.

Identify similarities and differences of an insertion sort and a bubble sort

Categorize the following
  • inserts/moves values into correct position

  • inserts value once (then in correct position)

  • moves items down the array / left

  • compares/swaps pairs of values

  • value is repeatedly moved/swapped (until in correct position)

  • moves items up the array

  • end of array becomes sorted first

produce a sorted list / array

need a temporary variable

work in place / without duplicating data

work with an array / list data structure

inefficient / slow for larger lists

Insertion sort
Bubble sort
Both Insertion and Bubble
46.

The student names for a team are stored in an array with the identifier theTeam
A linear search function is used to find whether a student is in the team. The function:
•takes a student name as a parameter
•returns True if the student name is in the array
•returns False if the student name is not in the array.