WorksheetsJ277 GCSE Computer Science 2.1 Algorithms
Total questions: 46
Worksheet time: 1hrs 4mins
What is the first step of the linear search algorithm?
Identify the middle item in the list
Identify the first item in the list
Identify a random item in the list
Identify the last item in the list
Ignoring any information about a problem that isn't important is called...
decomposition
abstraction
algorithmic thinking
pattern matching
Which of the following search algorithms can only be carried out on an ordered list?
Linear search
Binary Search
Computational thinking is used to...
improve the efficiency of an existing program or piece of code
turn a problem into something that can be solved by the computer
help you think like a computer
tell the programmer the rules of a programming language
A programmer solves a complex task by writing many small sub programs. This is an example of...
decomposition
abstraction
authentication
pipelining
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?
Bubble sort
Insertion sort
Merge Sort
Binary Search
A benefit of using Algorithmn 1 over Algorithm 2 is that...
it can be more easily converted into a programming language.
it can be interpreted by all programming languages
it uses the proper syntax of all programming languages
it is vague and unstructured
A issue with Algorithmn 2 is that...
it can be easily converted into a programming language.
it can be interpreted by all programming languages
it does not use the proper syntax of a programming language
it is vague and unstructured
Which of the following data types could store the value 45.31?
Integer
Real/Float
Boolean
String
Which expression evaluates to TRUE?
3 < 5 AND 1 > 2
1 != 1 or 4 < 5
NOT ( 7 > 3 )
5 <= 3 OR 8 >= 9
What will 23 DIV 4 return?
6
3
5
4
True or False? "The value of a constant can't be mondifed while a program is running? "
True
False
Which arithmetic operator is used to find the remainder from a division?
DIV
^
MOD
+
Given that x = "CompSci" and test = x[1:4] what is the output of print(test)?
omp
p
Comp
pSci
Which of the following is a count-controlled loop?
FOR
WHILE
DO WHILE
IF
Developing a logical set of instructions to solve a particular problem is known as...
abstraction
decomposition
algorithmic thinking
pattern matching
Combining two string variables using a + is called...
concentration
coordination
concatenation
cognition
Which of the following statements evaluates to 2?
11 MOD 3
10 / 3
3 DIV 2
What would the logic statement 33 > 10 OR 5 < 3 evaluate to?
TRUE
FALSE
An algorithm written in pseudocode...
should always use the proper syntax of a programming language
can show the same solution that a flow diagram can
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)
Write the missing arithmetic operator for the algorithm.
Outputting 12 to the power of 2.
print(12 _ 2)
(a)
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)
Write the missing arithmetic operator for the algorithm.
Finding the difference between two measurements.
measurement1 = 300
measurement2 = 100
difference = measurement1 _ measurement2
(a)
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)
Match the following computational thinking techniques
Abstraction
Hiding or removing irrelevant details
Decomposition
breaking a problem down into smaller
Algorithmic thinking
set out the steps needed to solve tasks
Casting
Converting one data type to another
Input sanitisation
Cleaning up data entered
Describe the steps a binary search will follow to look for a number in a sorted list.
pick middle number in list
if searched number is larger, discard left half, smaller, discard right half
pick middle number in new list
Repeat until number found
or remaining list is of size 1 / 0 (number not found)
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)
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)
Please type in the words that would be checked in a binary search looking for word "house". i.e. "Bob","Cheese" NO SPACES!
(a)
Identify whether each statement about the insertion sort is true or false.
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.
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)
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)
What will be printed at the end of the algorithm?
(a)
Please put in order the steps of a linear search
Starts with first value in list
Compares value with search term
If match returns found and position
If not match goes to next value in order in list
Repeats until either match found or item not in list
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)
Identify where each statement about the insertion sort is true or false
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
Reorder the following steps for a Bubble sort algorithm
Start at the beginning of the list
Compare each pair of adjacent elements
If the elements are out of order, swap them
Move to the next pair and repeat comparison until the end of the list (Pass completed)
Repeat the process until no swaps are needed
Reorder the following steps for a Insertion sort algorithm
Start with an unsorted list
Compare the current element to the elements to its left
If the current element is smaller than the element to its left, move it to the left
Repeat until the current element is in the correct position
Repeat for each element in the list
Reorder the following steps for a Merge sort algorithm
Split list into two halves
Keep splitting sublists into two until each sublist contains a single item
Sublists are then merge in pairs
Repeat until all elements are merged
Identify similarities and differences of an insertion sort and a bubble sort
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
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.
