Font size
WorksheetsGCSE Computer Science - Paper 2 (Algorithms & Programming)
Total questions: 89
Worksheet time: 30mins
What is an algorithm?
A sequence of logical instructions for carrying out a task.
A method of writing up a set of instructions for a computer program.
A problem-solving method using computer science techniques.
The process of extracting or withdrawing something.
What is computational thinking?
A sequence of logical instructions for carrying out a task.
A problem-solving method using computer science techniques.
The process of extracting or withdrawing something.
Breaking down a complex problem or system into smaller parts.
What is abstraction?
A sequence of logical instructions for carrying out a task.
A method of writing up a set of instructions for a computer program.
The process of extracting or withdrawing something.
Breaking down a complex problem or system into smaller parts.
What is decomposition?
A sequence of logical instructions for carrying out a task.
A method of writing up a set of instructions for a computer program.
The process of extracting or withdrawing something.
Breaking down a complex problem or system into smaller parts.
What is pseudocode?
A sequence of logical instructions for carrying out a task.
A method of writing up a set of instructions for a computer program using plain English.
The process of extracting or withdrawing something.
Breaking down a complex problem or system into smaller parts.
What is a trace table used for?
To trace the value of variables as each line of code is executed.
To write up a set of instructions for a computer program.
To break down a complex problem into smaller parts.
To extract or withdraw something.
What is the first step in a linear search?
Set counter to 0.
Find out the length of the data set.
Examine value held in the list at the counter position.
Check to see if the value at that position matches the value searched for.
What is a disadvantage of a linear search?
It can be quite inefficient.
It only works on ordered data sets.
It requires complex algorithms.
It cannot find the last item in the data set.
What is the first step in a binary search?
Set counter to 0.
Find out the length of the data set.
Start by setting the counter to the middle position in the list.
Examine value held in the list at the counter position.
What is a binary search used for?
Searching an ordered list.
Searching an unordered list.
Writing up a set of instructions for a computer program.
Breaking down a complex problem into smaller parts.
What happens if the value at the midpoint in a binary search is less than the value to be found?
The search ends.
The list is divided in half, and the search keeps to the upper half of the list.
The list is divided in half, and the search keeps to the lower half of the list.
The counter is incremented by 1.
Which sorting algorithm is described as starting at the beginning of the list, comparing the first value with the next one up, and swapping positions if the first value is bigger?
Merge Sort
Insertion Sort
Bubble Sort
Quick Sort
In which sorting algorithm is the list repeatedly divided into two until all elements are separated individually, then pairs of elements are compared, placed into order, and combined?
Bubble Sort
Merge Sort
Insertion Sort
Selection Sort
Which sorting algorithm is described as less complex and efficient than a merge sort, but more efficient than a bubble sort?
Bubble Sort
Merge Sort
Insertion Sort
Quick Sort
In the insertion sort algorithm, what happens if the value being compared is greater than the value to the left of it?
The value is swapped with the value to the left.
The value is moved to the end of the list.
No changes are made.
The value is removed from the list.
What is the term used to describe each run through the list from start to finish in the bubble sort algorithm?
Cycle
Pass
Iteration
Loop
In the merge sort algorithm, what is the process called when the list is repeatedly divided into two until all elements are separated individually?
Partitioning
Dividing
Splitting
Divide and conquer
Which sorting algorithm involves comparing values in turn, starting with the second value in the list?
Bubble Sort
Merge Sort
Insertion Sort
Quick Sort
In the bubble sort algorithm, what happens when no values have been swapped in a pass?
The list is considered sorted.
The algorithm starts over.
The list is divided into two.
The algorithm stops.
What is the main advantage of the merge sort algorithm compared to bubble sort and insertion sort?
It is simpler to implement.
It is more efficient.
It uses less memory.
It requires fewer comparisons.
What is a memory location within a computer program where values are stored called?
Constant
Assignment
Variable
Input
Which of the following is a value that does not change when the program is running?
Variable
Constant
Input
Output
What is the process of setting the value of a variable in a computer program called?
Input
Output
Assignment
Casting
What is data received by a program referred to as?
Output
Input
Variable
Constant
What is data sent out of a program referred to as?
Output
Input
Variable
Constant
Which data type represents whole numbers in Python?
Real
Boolean
Integer
String
What is the data type for decimal numbers in Python?
Integer
Real
Boolean
String
Which data type can only have the values True or False?
Integer
Real
Boolean
String
What is a sequence of characters which include letters, numbers, and symbols called in Python?
Integer
Real
Boolean
String
What is the process of changing the data type of a variable called?
Assignment
Casting
Input
Output
Which comparison operator is used to check if two values are equal?
!=
>
==
<
Which comparison operator is used to check if two values are not equal?
==
!=
>
<
Which arithmetic operator is used for addition?
-
*
/
+
Which arithmetic operator is used for multiplication?
+
*
/
-
Which module in Python allows you to pause your program?
random
time
math
sys
Which module in Python gives the ability to generate a random integer?
time
random
math
sys
How can the length of a string be determined in Python?
Using the len() function
Using the length() function
Using the size() function
Using the count() function
What will the following Python code print: word = "Computer"; print(word[2])?
C
o
m
p
What will the following Python code print: word = "Computer"; print(word[3:8])?
puter
Comp
Compu
put
Which Python method converts all characters in a string to uppercase?
upper()
lower()
capitalize()
title()
Which Python method converts all characters in a string to lowercase?
upper()
lower()
capitalize()
title()
What does the following Python code do: word = "Computer"; sentence = word + " Science"?
It prints "Computer Science"
It adds "Computer" and "Science" to form "Computer Science"
It prints "Computer" and "Science" separately
It raises an error
What is a sequence in programming?
A set of instructions or lines of code that follow on one from another.
A decision within a computer program.
The repetition of a block of statements within a program when the number of repeats is known.
The repetition of a block of statements within a program when the number of repeats is not known.
Which Python syntax is used to take user input and print a greeting message?
player_name = str(input("Enter your name")) print("Hello", player_name)
True
False
True
What is selection in programming?
A decision within a computer program when the program decides to move on based on the results of an event.
A set of instructions or lines of code that follow on one from another.
The repetition of a block of statements within a program when the number of repeats is known.
The repetition of a block of statements within a program when the number of repeats is not known.
Which Python syntax is used to select a color based on user input?
player_colour = int(input("Press 1 for red, 2 for blue or 3 for green")) if player_colour == 1: print("You have selected red") elif player_colour == 2: print("You have selected blue") elif player_colour == 3: print("You have selected green") else: print("You did not press 1, 2 or 3")
True
False
True
What is iteration (while) in programming?
The repetition of a block of statements within a program when the number of repeats is not known.
A decision within a computer program when the program decides to move on based on the results of an event.
A set of instructions or lines of code that follow on one from another.
The repetition of a block of statements within a program when the number of repeats is known.
Which Python syntax is used for a while loop that decrements player turns?
player_turns = 5 while player_turns > 0: print("Player takes their turn") player_turns = player_turns - 1
True
False
True
What is iteration (for) in programming?
The repetition of a block of statements within a program when the number of repeats is known.
A decision within a computer program when the program decides to move on based on the results of an event.
A set of instructions or lines of code that follow on one from another.
The repetition of a block of statements within a program when the number of repeats is not known.
Which Python syntax is used for a for loop that prints numbers from 0 to 9?
for counter in range(0, 10, 1): print(counter)
True
False
True
What is a procedure in programming?
A section of computer code that performs a specific task.
A section of code that returns multiple values.
A section of code that cannot be called by another part of the program.
A section of code that is used for debugging.
What is a function in programming?
A section of code that performs a specific task.
A section of code that, when programming, can be called by another part of the program with the purpose of returning one single value.
A section of code that cannot be called by another part of the program.
A section of code that is used for debugging.
What will the following Python code output?
Pen
Pencil
Ruler
Eraser
What will the following Python code output?
Pen, Pencil
Pen, Pencil, Ruler
Pencil, Ruler
Pen, Ruler
What is an array in programming?
A data structure that holds similar, related data.
A data structure that holds different types of data.
A data structure that holds only one type of data.
A data structure that cannot hold any data.
What is a 2D array?
A data structure that holds similar, related data.
A data structure that holds different types of data.
A data structure that holds data in rows and columns.
A data structure that cannot hold any data.
What will the following Python code output?
Pen, Pencil, Ruler, Eraser
Red, Green, Blue, Yellow
Pen, Pencil
Green, Blue
Which of the following modes is used to open a file for reading in Python?
a) "w"
b) "a"
c) "r"
d) "x"
What must be done to a file before it can be read from or written to in a program?
a) It must be closed
b) It must be opened
c) It must be deleted
d) It must be renamed
Which Python function is used to read the entire contents of a file?
a) file.readline()
b) file.read()
c) file.write()
d) file.close()
In SQL, what does the asterisk (*) symbol represent?
a) A specific record
b) A wildcard for all records
c) A wildcard for all columns
d) A wildcard for all tables
Which SQL command is used to retrieve data from a table?
a) INSERT
b) UPDATE
c) SELECT
d) DELETE
What is the correct SQL query to retrieve records with the title "Mr" from the Computer_Scientists table?
a) SELECT * FROM Computer_Scientists WHERE Title = "Mr"
b) SELECT * FROM Computer_Scientists WHERE Nationality = "Mr"
c) SELECT * FROM Computer_Scientists WHERE Surname = "Mr"
d) SELECT * FROM Computer_Scientists WHERE Forename = "Mr"
What must be done to a file for it to be saved in a program?
a) It must be opened
b) It must be read
c) It must be closed
d) It must be written
Which SQL query would return records with a Nationality of "USA" from the Computer_Scientists table?
a) SELECT * FROM Computer_Scientists WHERE Title = "USA"
b) SELECT * FROM Computer_Scientists WHERE Nationality = "USA"
c) SELECT * FROM Computer_Scientists WHERE Surname = "USA"
d) SELECT * FROM Computer_Scientists WHERE Forename = "USA"
What is the process of checking entered data and removing dangerous inputs which could otherwise be used to cause damage to a program?
Authentication
Validation
Input Sanitation
Maintainability
What is the term for verifying the identity of a user?
Validation
Authentication
Input Sanitation
Maintainability
What is the process of ensuring that a program is easy to understand, modify, and update?
Validation
Maintainability
Input Sanitation
Authentication
What type of error occurs in a program resulting from code not following syntax rules governing how to write statements in a programming language?
Logic Error
Syntax Error
Validation Error
Input Sanitation Error
What type of data is entered into a program to test if it is working?
Normal data
Boundary data
Invalid data
Test data
What type of data is entered into a program that should produce a positive result?
Normal data
Boundary data
Invalid data
Erroneous data
What type of data is entered into a program at the edge of its acceptable range?
Normal data
Boundary data
Invalid data
Erroneous data
What type of data is entered into a program that should produce a negative result?
Normal data
Boundary data
Invalid data
Erroneous data
What type of data is data that a program cannot process and should not accept?
Normal data
Boundary data
Invalid data
Erroneous data
What is the purpose of a test table in programming?
Which Boolean operator is represented by the following logic gate symbol?
OR (Disjunction)
NOT (Negation)
AND (Conjunction)
XOR (Exclusive OR)
What is the output of an OR gate when both inputs A and B are 0?
0
1
2
Undefined
Which logic gate produces an output of 1 only when both inputs are 1?
OR (Disjunction)
NOT (Negation)
AND (Conjunction)
NAND (Not AND)
What is the output of a NOT gate when the input is 1?
0
1
Undefined
2
Which Boolean operator is used to represent the NOT gate?
Conjunction
Disjunction
Negation
Exclusive OR
What is a high-level programming language?
A language that closely represents machine language
A language used to write programs that need to be translated into machine code
A language that does not need translation into machine code
A language used only for web development
Which of the following is true about low-level programming languages?
They are easier to understand than high-level languages
They execute slower than high-level languages
They closely represent machine language
They do not need to be translated into machine code
What is the role of a translator in programming?
To write programs in high-level languages
To translate high-level languages into machine code
To execute programs directly
To debug programs
What does an assembler do?
Translates high-level programming languages into machine code
Translates assembly languages into machine code
Translates machine code into high-level languages
Translates high-level languages into assembly languages
What is the function of a compiler?
To write and amend code
To translate high-level programming languages into machine code
To find and correct programming errors
To run programs
What is an IDE?
A suite of tools that helps a programmer to write error-free, maintainable code
A suite of tools that helps a programmer to write error-free, maintainable code
A part of the IDE where a program runs
A process of finding and correcting programming errors
What is the purpose of an editor in an IDE?
To write and amend code
To write and amend code
To run programs
To debug programs
What is the process of finding and correcting programming errors called?
Compilation
Interpretation
Debugging
Assembling
What is the run time environment in an IDE?
The part of an IDE where a program runs
The part of an IDE where code is written
The part of an IDE that translates code
The part of an IDE that debugs code
