wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

GCSE Computer Science - Paper 2 (Algorithms & Programming)

Total questions: 89

Worksheet time: 30mins

Name
Class
Date
1.

What is an algorithm?

a)

A sequence of logical instructions for carrying out a task.

b)

A method of writing up a set of instructions for a computer program.

c)

A problem-solving method using computer science techniques.

d)

The process of extracting or withdrawing something.

2.

What is computational thinking?

a)

A sequence of logical instructions for carrying out a task.

b)

A problem-solving method using computer science techniques.

c)

The process of extracting or withdrawing something.

d)

Breaking down a complex problem or system into smaller parts.

3.

What is abstraction?

a)

A sequence of logical instructions for carrying out a task.

b)

A method of writing up a set of instructions for a computer program.

c)

The process of extracting or withdrawing something.

d)

Breaking down a complex problem or system into smaller parts.

4.

What is decomposition?

a)

A sequence of logical instructions for carrying out a task.

b)

A method of writing up a set of instructions for a computer program.

c)

The process of extracting or withdrawing something.

d)

Breaking down a complex problem or system into smaller parts.

5.

What is pseudocode?

a)

A sequence of logical instructions for carrying out a task.

b)

A method of writing up a set of instructions for a computer program using plain English.

c)

The process of extracting or withdrawing something.

d)

Breaking down a complex problem or system into smaller parts.

6.

What is a trace table used for?

a)

To trace the value of variables as each line of code is executed.

b)

To write up a set of instructions for a computer program.

c)

To break down a complex problem into smaller parts.

d)

To extract or withdraw something.

7.

What is the first step in a linear search?

a)

Set counter to 0.

b)

Find out the length of the data set.

c)

Examine value held in the list at the counter position.

d)

Check to see if the value at that position matches the value searched for.

8.

What is a disadvantage of a linear search?

a)

It can be quite inefficient.

b)

It only works on ordered data sets.

c)

It requires complex algorithms.

d)

It cannot find the last item in the data set.

9.

What is the first step in a binary search?

a)

Set counter to 0.

b)

Find out the length of the data set.

c)

Start by setting the counter to the middle position in the list.

d)

Examine value held in the list at the counter position.

10.

What is a binary search used for?

a)

Searching an ordered list.

b)

Searching an unordered list.

c)

Writing up a set of instructions for a computer program.

d)

Breaking down a complex problem into smaller parts.

11.

What happens if the value at the midpoint in a binary search is less than the value to be found?

a)

The search ends.

b)

The list is divided in half, and the search keeps to the upper half of the list.

c)

The list is divided in half, and the search keeps to the lower half of the list.

d)

The counter is incremented by 1.

12.

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?

a)

Merge Sort

b)

Insertion Sort

c)

Bubble Sort

d)

Quick Sort

13.

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?

a)

Bubble Sort

b)

Merge Sort

c)

Insertion Sort

d)

Selection Sort

14.

Which sorting algorithm is described as less complex and efficient than a merge sort, but more efficient than a bubble sort?

a)

Bubble Sort

b)

Merge Sort

c)

Insertion Sort

d)

Quick Sort

15.

In the insertion sort algorithm, what happens if the value being compared is greater than the value to the left of it?

a)

The value is swapped with the value to the left.

b)

The value is moved to the end of the list.

c)

No changes are made.

d)

The value is removed from the list.

16.

What is the term used to describe each run through the list from start to finish in the bubble sort algorithm?

a)

Cycle

b)

Pass

c)

Iteration

d)

Loop

17.

In the merge sort algorithm, what is the process called when the list is repeatedly divided into two until all elements are separated individually?

a)

Partitioning

b)

Dividing

c)

Splitting

d)

Divide and conquer

18.

Which sorting algorithm involves comparing values in turn, starting with the second value in the list?

a)

Bubble Sort

b)

Merge Sort

c)

Insertion Sort

d)

Quick Sort

19.

In the bubble sort algorithm, what happens when no values have been swapped in a pass?

a)

The list is considered sorted.

b)

The algorithm starts over.

c)

The list is divided into two.

d)

The algorithm stops.

20.

What is the main advantage of the merge sort algorithm compared to bubble sort and insertion sort?

a)

It is simpler to implement.

b)

It is more efficient.

c)

It uses less memory.

d)

It requires fewer comparisons.

21.

What is a memory location within a computer program where values are stored called?

a)

Constant

b)

Assignment

c)

Variable

d)

Input

22.

Which of the following is a value that does not change when the program is running?

a)

Variable

b)

Constant

c)

Input

d)

Output

23.

What is the process of setting the value of a variable in a computer program called?

a)

Input

b)

Output

c)

Assignment

d)

Casting

24.

What is data received by a program referred to as?

a)

Output

b)

Input

c)

Variable

d)

Constant

25.

What is data sent out of a program referred to as?

a)

Output

b)

Input

c)

Variable

d)

Constant

26.

Which data type represents whole numbers in Python?

a)

Real

b)

Boolean

c)

Integer

d)

String

27.

What is the data type for decimal numbers in Python?

a)

Integer

b)

Real

c)

Boolean

d)

String

28.

Which data type can only have the values True or False?

a)

Integer

b)

Real

c)

Boolean

d)

String

29.

What is a sequence of characters which include letters, numbers, and symbols called in Python?

a)

Integer

b)

Real

c)

Boolean

d)

String

30.

What is the process of changing the data type of a variable called?

a)

Assignment

b)

Casting

c)

Input

d)

Output

31.

Which comparison operator is used to check if two values are equal?

a)

!=

b)

>

c)

==

d)

<

32.

Which comparison operator is used to check if two values are not equal?

a)

==

b)

!=

c)

>

d)

<

33.

Which arithmetic operator is used for addition?

a)

-

b)

*

c)

/

d)

+

34.

Which arithmetic operator is used for multiplication?

a)

+

b)

*

c)

/

d)

-

35.

Which module in Python allows you to pause your program?

a)

random

b)

time

c)

math

d)

sys

36.

Which module in Python gives the ability to generate a random integer?

a)

time

b)

random

c)

math

d)

sys

37.

How can the length of a string be determined in Python?

a)

Using the len() function

b)

Using the length() function

c)

Using the size() function

d)

Using the count() function

38.

What will the following Python code print: word = "Computer"; print(word[2])?

a)

C

b)

o

c)

m

d)

p

39.

What will the following Python code print: word = "Computer"; print(word[3:8])?

a)

puter

b)

Comp

c)

Compu

d)

put

40.

Which Python method converts all characters in a string to uppercase?

a)

upper()

b)

lower()

c)

capitalize()

d)

title()

41.

Which Python method converts all characters in a string to lowercase?

a)

upper()

b)

lower()

c)

capitalize()

d)

title()

42.

What does the following Python code do: word = "Computer"; sentence = word + " Science"?

a)

It prints "Computer Science"

b)

It adds "Computer" and "Science" to form "Computer Science"

c)

It prints "Computer" and "Science" separately

d)

It raises an error

43.

What is a sequence in programming?

a)

A set of instructions or lines of code that follow on one from another.

b)

A decision within a computer program.

c)

The repetition of a block of statements within a program when the number of repeats is known.

d)

The repetition of a block of statements within a program when the number of repeats is not known.

44.

Which Python syntax is used to take user input and print a greeting message?

a)

player_name = str(input("Enter your name")) print("Hello", player_name)

b)

True

c)

False

d)

True

45.

What is selection in programming?

a)

A decision within a computer program when the program decides to move on based on the results of an event.

b)

A set of instructions or lines of code that follow on one from another.

c)

The repetition of a block of statements within a program when the number of repeats is known.

d)

The repetition of a block of statements within a program when the number of repeats is not known.

46.

Which Python syntax is used to select a color based on user input?

a)

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")

b)

True

c)

False

d)

True

47.

What is iteration (while) in programming?

a)

The repetition of a block of statements within a program when the number of repeats is not known.

b)

A decision within a computer program when the program decides to move on based on the results of an event.

c)

A set of instructions or lines of code that follow on one from another.

d)

The repetition of a block of statements within a program when the number of repeats is known.

48.

Which Python syntax is used for a while loop that decrements player turns?

a)

player_turns = 5 while player_turns > 0: print("Player takes their turn") player_turns = player_turns - 1

b)

True

c)

False

d)

True

49.

What is iteration (for) in programming?

a)

The repetition of a block of statements within a program when the number of repeats is known.

b)

A decision within a computer program when the program decides to move on based on the results of an event.

c)

A set of instructions or lines of code that follow on one from another.

d)

The repetition of a block of statements within a program when the number of repeats is not known.

50.

Which Python syntax is used for a for loop that prints numbers from 0 to 9?

a)

for counter in range(0, 10, 1): print(counter)

b)

True

c)

False

d)

True

51.

What is a procedure in programming?

a)

A section of computer code that performs a specific task.

b)

A section of code that returns multiple values.

c)

A section of code that cannot be called by another part of the program.

d)

A section of code that is used for debugging.

52.

What is a function in programming?

a)

A section of code that performs a specific task.

b)

A section of code that, when programming, can be called by another part of the program with the purpose of returning one single value.

c)

A section of code that cannot be called by another part of the program.

d)

A section of code that is used for debugging.

53.

What will the following Python code output?

a)

Pen

b)

Pencil

c)

Ruler

d)

Eraser

54.

What will the following Python code output?

a)

Pen, Pencil

b)

Pen, Pencil, Ruler

c)

Pencil, Ruler

d)

Pen, Ruler

55.

What is an array in programming?

a)

A data structure that holds similar, related data.

b)

A data structure that holds different types of data.

c)

A data structure that holds only one type of data.

d)

A data structure that cannot hold any data.

56.

What is a 2D array?

a)

A data structure that holds similar, related data.

b)

A data structure that holds different types of data.

c)

A data structure that holds data in rows and columns.

d)

A data structure that cannot hold any data.

57.

What will the following Python code output?

a)

Pen, Pencil, Ruler, Eraser

b)

Red, Green, Blue, Yellow

c)

Pen, Pencil

d)

Green, Blue

58.

Which of the following modes is used to open a file for reading in Python?

a)

a) "w"

b)

b) "a"

c)

c) "r"

d)

d) "x"

59.

What must be done to a file before it can be read from or written to in a program?

a)

a) It must be closed

b)

b) It must be opened

c)

c) It must be deleted

d)

d) It must be renamed

60.

Which Python function is used to read the entire contents of a file?

a)

a) file.readline()

b)

b) file.read()

c)

c) file.write()

d)

d) file.close()

61.

In SQL, what does the asterisk (*) symbol represent?

a)

a) A specific record

b)

b) A wildcard for all records

c)

c) A wildcard for all columns

d)

d) A wildcard for all tables

62.

Which SQL command is used to retrieve data from a table?

a)

a) INSERT

b)

b) UPDATE

c)

c) SELECT

d)

d) DELETE

63.

What is the correct SQL query to retrieve records with the title "Mr" from the Computer_Scientists table?

a)

a) SELECT * FROM Computer_Scientists WHERE Title = "Mr"

b)

b) SELECT * FROM Computer_Scientists WHERE Nationality = "Mr"

c)

c) SELECT * FROM Computer_Scientists WHERE Surname = "Mr"

d)

d) SELECT * FROM Computer_Scientists WHERE Forename = "Mr"

64.

What must be done to a file for it to be saved in a program?

a)

a) It must be opened

b)

b) It must be read

c)

c) It must be closed

d)

d) It must be written

65.

Which SQL query would return records with a Nationality of "USA" from the Computer_Scientists table?

a)

a) SELECT * FROM Computer_Scientists WHERE Title = "USA"

b)

b) SELECT * FROM Computer_Scientists WHERE Nationality = "USA"

c)

c) SELECT * FROM Computer_Scientists WHERE Surname = "USA"

d)

d) SELECT * FROM Computer_Scientists WHERE Forename = "USA"

66.

What is the process of checking entered data and removing dangerous inputs which could otherwise be used to cause damage to a program?

a)

Authentication

b)

Validation

c)

Input Sanitation

d)

Maintainability

67.

What is the term for verifying the identity of a user?

a)

Validation

b)

Authentication

c)

Input Sanitation

d)

Maintainability

68.

What is the process of ensuring that a program is easy to understand, modify, and update?

a)

Validation

b)

Maintainability

c)

Input Sanitation

d)

Authentication

69.

What type of error occurs in a program resulting from code not following syntax rules governing how to write statements in a programming language?

a)

Logic Error

b)

Syntax Error

c)

Validation Error

d)

Input Sanitation Error

70.

What type of data is entered into a program to test if it is working?

a)

Normal data

b)

Boundary data

c)

Invalid data

d)

Test data

71.

What type of data is entered into a program that should produce a positive result?

a)

Normal data

b)

Boundary data

c)

Invalid data

d)

Erroneous data

72.

What type of data is entered into a program at the edge of its acceptable range?

a)

Normal data

b)

Boundary data

c)

Invalid data

d)

Erroneous data

73.

What type of data is entered into a program that should produce a negative result?

a)

Normal data

b)

Boundary data

c)

Invalid data

d)

Erroneous data

74.

What type of data is data that a program cannot process and should not accept?

a)

Normal data

b)

Boundary data

c)

Invalid data

d)

Erroneous data

75.

What is the purpose of a test table in programming?

4 lines
76.

Which Boolean operator is represented by the following logic gate symbol?

a)

OR (Disjunction)

b)

NOT (Negation)

c)

AND (Conjunction)

d)

XOR (Exclusive OR)

77.

What is the output of an OR gate when both inputs A and B are 0?

a)

0

b)

1

c)

2

d)

Undefined

78.

Which logic gate produces an output of 1 only when both inputs are 1?

a)

OR (Disjunction)

b)

NOT (Negation)

c)

AND (Conjunction)

d)

NAND (Not AND)

79.

What is the output of a NOT gate when the input is 1?

a)

0

b)

1

c)

Undefined

d)

2

80.

Which Boolean operator is used to represent the NOT gate?

a)

Conjunction

b)

Disjunction

c)

Negation

d)

Exclusive OR

81.

What is a high-level programming language?

a)

A language that closely represents machine language

b)

A language used to write programs that need to be translated into machine code

c)

A language that does not need translation into machine code

d)

A language used only for web development

82.

Which of the following is true about low-level programming languages?

a)

They are easier to understand than high-level languages

b)

They execute slower than high-level languages

c)

They closely represent machine language

d)

They do not need to be translated into machine code

83.

What is the role of a translator in programming?

a)

To write programs in high-level languages

b)

To translate high-level languages into machine code

c)

To execute programs directly

d)

To debug programs

84.

What does an assembler do?

a)

Translates high-level programming languages into machine code

b)

Translates assembly languages into machine code

c)

Translates machine code into high-level languages

d)

Translates high-level languages into assembly languages

85.

What is the function of a compiler?

a)

To write and amend code

b)

To translate high-level programming languages into machine code

c)

To find and correct programming errors

d)

To run programs

86.

What is an IDE?

a)

A suite of tools that helps a programmer to write error-free, maintainable code

b)

A suite of tools that helps a programmer to write error-free, maintainable code

c)

A part of the IDE where a program runs

d)

A process of finding and correcting programming errors

87.

What is the purpose of an editor in an IDE?

a)

To write and amend code

b)

To write and amend code

c)

To run programs

d)

To debug programs

88.

What is the process of finding and correcting programming errors called?

a)

Compilation

b)

Interpretation

c)

Debugging

d)

Assembling

89.

What is the run time environment in an IDE?

a)

The part of an IDE where a program runs

b)

The part of an IDE where code is written

c)

The part of an IDE that translates code

d)

The part of an IDE that debugs code