wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Paper 2 J277 June 2022 Revision OCR

Total questions: 149

Worksheet time: 2hrs 32mins

Name
Class
Date
1.

What is the purpose of an if statement in programming?

a)

To repeat a block of code multiple times

b)

To make decisions based on conditions

c)

To define a function

d)

To declare a variable

2.

Which of the following is the correct syntax for an if statement in Python?

a)

`if x > 10 then:`

b)

`if (x > 10) {`

c)

`if x > 10:`

d)

`if x > 10`

3.

What will be the output of the following code? ```python x = 5 if x > 3: print("Hello") else: print("Goodbye") ```

a)

Goodbye

b)

Hello

c)

Error

d)

Nothing

4.

Which of the following loops is best suited for iterating over a list in Python?

a)

while loop

b)

for loop

c)

do-while loop

d)

foreach loop

5.

What is the output of the following code? ```python for i in range(3): print(i) ```

a)

1 2 3

b)

0 1 2 3

c)

0 1 2

d)

1 2

6.

Which of the following is true about while loops?

a)

They always execute at least once

b)

They execute as long as a condition is true

c)

They are used to iterate over a list

d)

They are the same as for loops

7.

What will be the output of the following code? ```python x = 0 while x < 3: print(x) x += 1 ```

a)

1 2 3

b)

0 1 2 3

c)

0 1 2

d)

1 2

8.

Which of the following is an example of a nested loop?

a)

A loop inside a function

b)

A loop that runs indefinitely

c)

A loop inside another loop

d)

A loop with an if statement

9.

Which of the following is the correct way to break out of a loop in Python?

a)

exit

b)

break

c)

continue

d)

stop

10.

What will be the output of the following code? ```python for i in range(3): if i == 1: break print(i) ```

a)

0 1 2

b)

0 1

c)

0

d)

1 2

11.

What is the purpose of the continue statement in a loop?

a)

To exit the loop

b)

To skip the current iteration and continue with the next

c)

To pause the loop

d)

To restart the loop

12.

What will be the output of the following code? ```python for i in range(3): if i == 1: continue print(i) ```

a)

0 1 2

b)

0 1

c)

0 2

d)

1 2

13.

Which of the following is true about nested loops?

a)

The inner loop runs once for each iteration of the outer loop

b)

The outer loop runs once for each iteration of the inner loop

c)

Both loops run independently

d)

Nested loops are not allowed in Python

14.

Choose the correct data type:

"initial of a first name"

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

15.

Choose the correct data type:

"Sarah"

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

16.

Choose the correct data type:

"Resolution"

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

17.

Choose the correct data type:

True

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

18.

Choose the correct data type:

yes / no

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

19.

Choose the correct data type:

6

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

20.

Choose the correct data type:

-900

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

21.

Choose the correct data type:

0.25

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

22.

Choose the correct data type:

240.00

a)

Character

b)

String

c)

Integer

d)

Real/Float

e)

Boolean

23.
What kind of gate is this?
a)
AND
b)
NOT
c)
OR
d)
XOR
24.
What kind of gate is this?
a)
AND
b)
NAND
c)
OR
d)
XAND
25.
What kind of gate is this?
a)
OR
b)
XOR
c)
NOR
d)
AND
26.

What is OUTPUT?

a)

1

b)

0

27.

What is OUTPUT?

a)

1

b)

0

28.

What is OUTPUT?

a)

1

b)

0

29.

What is OUTPUT?

a)

1

b)

0

30.

What is OUTPUT?

a)

1

b)

0

31.

What is OUTPUT?

a)

1

b)

0

32.

What is OUTPUT?

a)

1

b)

0

33.

What is OUTPUT?

a)

1

b)

0

34.

What type of logic is this table showing:

a)

AND

b)

OR

c)

NOT

d)

NOR

35.

What type of logic is this table showing:

a)

AND

b)

OR

c)

NOR

d)

XOR

36.

"I will take my umbrella only if it is both about to rain and I can find it"

This is an example of which type of logic?

a)

AND

b)

OR

c)

NOT

d)

NOR

37.

"The burglar alarm will go off if either the door or the window or both are opened". This is an example of which type of Logic?

a)

AND

b)

OR

c)

NOT

d)

NOR

38.

What type of gate is this?

a)

AND

b)

OR

c)

NOT

d)

NOR

39.

In this logic circuit, what is Q if the inputs are: A=0, B=1, C=0?

a)

0

b)

We can't say

c)

1

40.

What is the boolean expression for this logic circuit?

a)

A OR B AND C = Q

b)

Q = (A AND B) OR C

c)

Q = A OR (B AND C)

d)

Q = (A OR B) AND C

41.

Which is the truth table for the AND gate?

a)
b)
c)
42.

What is the boolean expression for this logic circuit?

a)

Q = NOT (A OR B)

b)

Q = NOT A AND B

c)

NOT A OR B = Q

d)

Q = (NOT A) OR B

43.

The trace table will contain two columns: (a)   and Output.

44.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'A' be?

a)

1

b)

3

c)

5

d)

7

45.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'B' be?

a)

1

b)

3

c)

5

d)

7

46.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'C' be?

a)

1

b)

3

c)

8

d)

13

47.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'D' be?

a)

11

b)

13

c)

8

d)

1

48.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'E' be?

a)

3

b)

5

c)

8

d)

13

49.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'F' be?

a)

5

b)

8

c)

13

d)

18

50.

What is the purpose of using a Trace table?

a)

Planning before writing a program

b)

To help debug a program

c)

Check for spelling mistakes

d)

Understand the program more

51.

The trace table will contain three columns: n, (a)   , and Output.

52.

This loop will repeat (a)   times

53.

What are logic errors?

a)

An error that does not stop the code from executing

b)

When the logic gates are incorrectly connected

c)

An error where the logic doesn't make sense

d)

Code that does not give the desired output

54.

Which loop loops a set number of times?

a)

for

b)

while

c)

infinite

d)

loopy

55.

Repeating a task multiple times in programming is known as ?

a)

Iterators

b)

Scope

c)

Looping

56.

In programming, what is iteration?

a)

The repetition of steps within a program

b)

The order in which instructions are carried out

c)

A decision point in a program

d)

Testing a program to make sure it works

57.

FOR loops are

a)

loops which run an unknown number of times

b)

loops which run for a specific number of times

c)

the same as if statements

d)

not part of programming

58.

Which type of loop iterates until instructed otherwise?

a)

FOR loop

b)

WHILE loop

59.

What is the purpose of comments in Python programming?

a)

Comments in Python programming are used to explain the code logic, make the code more readable, and provide additional information to other developers.

b)

Comments in Python programming are used to store data

c)

Comments in Python programming are used to create loops

d)

Comments in Python programming are used to execute code

60.

How do you denote a single-line comment in Python?

a)

// This is a single-line comment

b)

/* This is a single-line comment */

c)

# This is a single-line comment

d)

''' This is a single-line comment '''

61.

What is the symbol used to start a comment in Python?

a)

!

b)

//

c)

/*

d)

#

62.

Why are comments important in programming?

a)

Comments provide clarity and context to the code.

b)

Comments reveal sensitive information about the code.

c)

Comments are only for experienced programmers and not beginners.

d)

Comments are unnecessary and slow down the code execution.

63.

What are variables in Python?

a)

Variables in Python are identifiers that can hold different types of data such as numbers, strings, lists, etc.

b)

Variables in Python are reserved keywords that cannot be changed

c)

Variables in Python are used to perform mathematical operations only

d)

Variables in Python are not necessary for writing code

64.

How do you declare a variable in Python?

a)

value = variable_name

b)

variable_name : value

c)

variable_name = value =

d)

variable_name = value

65.

What are the rules for naming variables in Python?

a)

Variable names in Python can only contain letters, numbers, and underscores. They cannot start with a number and cannot be a reserved keyword. Variable names are case-sensitive.

b)

Variable names in Python can start with a number

c)

Variable names in Python must be at least 10 characters long

d)

Variable names in Python can contain special characters like @, $, and %

66.

Can variable names start with a number in Python?

a)

No

b)

Yes

c)

Sometimes

d)

Maybe

67.

What is the difference between declaring and initializing a variable?

a)

Declaring a variable is specifying its type and name, while initializing a variable is assigning a value to it.

b)

Declaring a variable is assigning a type to it, while initializing a variable is specifying its value.

c)

Declaring a variable is assigning a value to it, while initializing a variable is specifying its type and name.

d)

Declaring a variable is specifying its value, while initializing a variable is assigning a type to it.

68.

Why is it important to choose meaningful variable names?

a)

Meaningful variable names are only important for beginners

b)

Meaningful variable names increase the file size of the code

c)

Meaningful variable names make the code run faster

d)

Meaningful variable names improve code readability, understandability, and maintainability.

69.

If I want to store multiple names in variables, which of the following would be good variable names in best practice?

a)

a

b

c

b)

name1

name2

name3

c)

Audrey

Ben

John

d)

blah1

blah2

blah3

70.

If I want to store my name in a variable, which of the following would be a good variable name in best practice?

a)

name

b)

teacher

c)

mister

d)

abcdef

71.

If I want to store my height in a variable, which of the following would be a good variable name in best practice?

a)

abcdefg

b)

inches

c)

number

d)

height

72.

Look at the following code:

name = "John"

age = "23"

What type of data is stored in the variable age?

a)

str

b)

int

c)

float

d)

nothing

73.

Look at the following code:

name = "John"

age = 23

What type of data is stored in the variable age?

a)

str

b)

int

c)

float

d)

nothing

74.

Look at the following code:

name = "John"

age = 23

What type of data is stored in the variable name?

a)

str

b)

int

c)

float

d)

nothing

75.

What is abstraction?

a)

The process of filtering out unnecessary detail

b)

The process of filtering out irrelevant characteristics

c)

The process of filtering out irrelevant characteristics and unnecessary detail

76.

Which of the following is a general characteristic?

a)

Dogs run quickly

b)

This dog has a wet nose

c)

This dog has a brown coat

77.

Which of the following is a general characteristic?

a)

This boat has an engine

b)

Some boats have sails

c)

This boat is blue

78.

Which of the following is NOT a general characteristic?

a)

Dogs run quickly

b)

Dogs have a nose

c)

This dog has a brown coat

79.

When drawing a dog, which of the following characteristics could be ignored?

a)

Dogs run quickly

b)

Dogs have paws

c)

Dogs have a nose

80.

To be able to draw cars, which of the following characteristics is it necessary to know about?

a)

Who owns them

b)

Who sells them

c)

If they have wheels

81.

Houses have walls, doors and people live in them. How many of these characteristics do we need to know to draw a house?

a)

One

b)

Two

c)

Three

82.

What is decomposition?

a)

Breaking down a complex problem or system into smaller, more manageable parts

b)

Adding detail to make a problem more complex

c)

When you ignore the unnecessary detail in a problem

83.

Why do we decompose a complex problem?

a)

To make it more difficult to solve

b)

To change the problem we have

c)

To make it easier to solve

84.

Which of these is an example of decomposition?

a)

Watching a mechanic repair a bicycle

b)

Looking at different bicycles for similarities between them

c)

Finding out how a bicycle works by looking in detail at the different parts that make up the bicycle

85.

Which of these is an example of decomposition?

a)

Breaking the problem of organising a cake sale into smaller parts, such as who will bake the cakes and when to hold the cake sale

b)

Taking the problem of baking a cake and thinking about how we can make it the best cake possible

c)

Looking at what different kinds of cake can be made

86.

Which of these would NOT be involved in decomposing a problem?

a)

Thinking about how the problem could be divided into smaller parts

b)

Working out who could help you solve a part of the problem

c)

Adding more parts to the problem so it becomes more complex

87.

Which of these is an example of decomposition?

a)

Guessing who has solved a crime from looking at patterns that have happened before

b)

Solving the complex problem of a crime by breaking it down into when the crime was committed and were there any witnesses

c)

Looking at what different crimes could be committed

88.

What is the purpose of translators in computer programming?

a)

To convert high-level language into low-level language

b)

To increase the execution speed of the program

c)

To reduce the size of the program

d)

To enhance the security of the program

89.

Which of the following is NOT a type of translator?

a)

Assembler

b)

Compiler

c)

Interpreter

d)

Debugger

90.

Which of these is a advantage of using a compiler over an interpreter?

a)

It translates code line by line

b)

It produces executable files

c)

It requires less memory

d)

It optimizes code for readability

91.

Which of the following is a disadvantage of compilers?

a)

They cannot optimize code

b)

They translate source code into object code one instruction at a time

c)

They produce object code that is not executable

d)

They require the source code to be re-compiled for every change

92.

Which of these is an advantage of interpreting code?

a)

Errors can be quickly spotted and corrected

b)

It optimizes code for performance automatically

c)

It produces an executable file

d)

It does not require the source code to be present

93.

Why might interpreted programs run more slowly than compiled programs?

a)

Because they do not require memory for translation

b)

Because they are compiled into object code in one go

c)

Because each instruction is translated as it is executed

d)

Because they are optimized for memory usage

94.

What is source code?

a)

A type of low-level programming language

b)

The original code written by the programmer in a high-level language

c)

The code generated after compilation

d)

Code that is ready to be executed by the computer

95.

What is machine code?

a)

A type of high-level programming language

b)

Code that can be directly executed by the computer's processor

c)

A type of interpreter

d)

A code given to a type of processor

96.

Complete the sentence below:

​ (a)   translate all the ​ (b)   source code into ​ (c)   in one go to produce an ​ (d)   file.

Choose from the below words
executable
high-level
machine code
Compilers
Interpreters
assembly language
Translators
editable
97.

Which of these are NOT true about interpreting?

a)

Interpreting translates and executes each line in turn.

b)

Interpreting produces platform independent programs.

c)

Interpreting is faster than compiling.

d)

Interpreting converts machine code into high-level source code.

98.

Translates all of the source code into machine code in one go

a)

Assembler

b)

Compiler

c)

Interpreter

99.

Compilers... [2 answers]

a)

Create a single executable file

b)

Take a long time to translate

c)

Are useful for debugging

d)

Only translate assembly code

100.

High level languages require a (a)   to convert code created by programmers into binary.

101.

Machine code is written in English?

a)

True

b)

False

102.
Why do we use flowcharts?
a)
To represent algorithms in an easy way
b)
To use different maths shapes
103.
What does this symbol represent?
a)
Start
b)
Sub
c)
Decision
d)
Process
104.
What does this shape represent?
a)
Input/Output
b)
Decision
c)
Process
d)
Start/Stop
105.
What's missing from this part of a flowchart?
a)
An Arrow
b)
A Line
c)
A Square
d)
A Diamond
106.
Can this shape be used for both Start and Stop?
a)
Yes
b)
No
107.
What is the Output if the user enters:
Yes
a)
Leave umbrella at home
b)
Take an umbrella
108.
What is the Output if the temperature is:
19
a)
Below Freezing
b)
Above Freezing
109.

What will happen if the user's book return is late?

a)

Sends them an SMS (text)

b)

Does not send them an SMS (text)

110.
What is an algorithm?
a)
A problem
b)
A solution to a problem
c)
The steps that are taken to solve a problem
d)
The words to enter when typing
111.
What is this symbol used for in a flowchart?
a)
A decision/question
b)
A task to carry out
112.
Which symbol shoes input?
a)
oval
b)
parallelogram
c)
rectangle
d)
diamond
113.
Which symbol shoes output?
a)
oval
b)
parallelogram
c)
rectangle
d)
diamond
114.

This flowchart is made to...

a)

Calculate the area and perimeter of a square

b)

Output figures of different sizes

c)

Calculate the area and perimeter of a circle

d)

Find out how long it takes to get to the moon

115.

In this flowchart, r ...

a)

is the radius of a circle

b)

stands for random number

c)

represents a running total

d)

is a miscellaneous variable

116.

In this flowchart the diamond shape helps with...

a)

Deciding whether the student should pass or fail

b)

Adding up the student's marks

c)

Making sure the student gets good marks

d)

Checking the student's general behaviour

117.

This flowchart is made to ...

a)

Check whether a number is odd or even

b)

Decide if we like a number or not

c)

Calculate the remainder of a number + 2

d)

Help people with Maths

118.

What is the purpose of testing?

a)

To find errors in the program

b)

To ensure that a program meets the given requirements

c)

To find ways the program can be broken

119.

Final Testing is testing a program when all the development is complete, what is the other type of testing known as?

a)

Terminal

b)

Iterative

c)

Looping

d)

Continuous

120.

Test Plans and Tables are used to ensure the database is working as it should

a)

True

b)

False

121.

Select the correct types of tests

a)

Normal / Valid

b)

Erroneous / Invalid

c)

Boundary / Extreme

d)

Data Type

122.

A new user is asked to enter their postcode

ME14 5DT would be an example of a valid / normal test

a)

True

b)

False

123.

A student is asked to enter their school year group

9 would be an example of an erroneous test

a)

True

b)

False

124.

Testing sensible, possible data that the program should accept and be able to process

a)

Erroneous / Invalid

b)

Boundary / Extreme

c)

Normal / Valid

125.

Testing valid data that falls at the upper or lower ranges

a)

Erroneous / Invalid

b)

Boundary / Extreme

c)

Normal / Valid

126.

Testing data that the program cannot process and should not accept

a)

Erroneous / Invalid

b)

Boundary / Extreme

c)

Normal / Valid

127.

A user is considered a teenager on the system until their age is 13 or over

13 would be an example of a boundary / extreme test

a)

True

b)

False

128.

Testing data that the program cannot process and should not accept

(a)  

129.

Testing valid data that falls at the upper or lower ranges

(a)  

130.

Testing sensible, possible data that the program should accept and be able to process

(a)  

131.

Test plans and tables allow you to ensure that all information in the database is correct

a)

True

b)

False

132.

In the exam, you will be told which tests to perform and on which fields

a)

True

b)

False

133.

In the exam, you will be given a set of criteria for you to create your own tests for

a)

True

b)

False

134.

A series of detailed tests and their expected outcomes

a)

Test Plan

b)

Test Table

135.

A series of detailed tests, their expected outcomes, their actual outcomes and comments on their success

a)

Test Plan

b)

Test Table

136.

Select all elements of an effective test table

a)

Test Type

b)

Test Data Items

c)

Expected Result

d)

Actual Result

e)

Logo

137.

A test plan and table should be designed for anyone to complete, not necessarily just for you

a)

True

b)

False

138.

You should deliberately engineer tests that fail so that you have more to write about in the exam

a)

True

b)

False

139.

Ideally, how many different tests should you include for each criteria?

a)

1

b)

2

c)

3

140.

Match the following SQL term with a description - FROM

a)

The criteria which must be met

b)

The fields to display

c)

The field and order used to sort the results

d)

The table used in the query

141.

Match the following SQL term with a description - SELECT

a)

The fields to display

b)

The table used in the query

c)

The criteria which must be met

d)

The field and order used to sort the results

142.

Match the following SQL term with a description - WHERE

a)

The table used in the query

b)

The fields to display

c)

The field and order used to sort the results

d)

The criteria which must be set

143.

In what order does SQL process the instructions?

a)

FROM - SELECT - WHERE - ORDER BY

b)

WHERE - FROM - SELECT - ORDER BY

c)

SELECT - FROM - WHERE - ORDER BY

d)

SELECT - FROM - ORDER By - WHERE

144.

Which symbol would you use to represent more than 50

a)

= 50

b)

< 50

c)

> 50

d)

# 50

145.

Which word is missing from the following SQL statement?


Select * table_name

a)

With

b)

Where

c)

From

d)

And

146.

The SQL statement being run is:


SELECT player_name, score FROM leaderboard;


What is the name of the table in this query?

a)

SELECT

b)

player_name

c)

score

d)

leaderboard

147.

Which SQL statement will show the names and weights of all wrestlers lighter than 170?

a)

SELECT name, weight FROM Wrestler WHERE weight >170;

b)

SELECT name, weight FROM Wrestler WHERE weight <= 170;

c)

SELECT name, weight FROM Wrestler WHERE weight <170;

d)

SELECT name, weight FROM Wrestler WHERE weight >=170;

148.

How many records are in this table?

a)

7

b)

6

c)

5

d)

4

149.

How many fields are there in this table?

a)

6

b)

7

c)

9

d)

42