wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

OCR A Level Computer Science - 2.x.x

Total questions: 138

Worksheet time: 1hrs 14mins

Name
Class
Date
1.

A programming mechanism that binds together code and the data it manipulates, and that keeps both safe from outside interference and misuse.

a)

Polymorphism

b)

Inheritance

c)

Encapsulation

d)

Object-Oriented Programming

2.

Is the process by which one object can acquire the properties of another object.

a)

Polymorphism

b)

Inheritance

c)

Encapsulation

d)

Object-Oriented Programming

3.
What is the difference between a class and an object?
a)
A class is a blueprint to make an object
b)
An object is a blueprint to make a class
c)
A blueprint is an object to make a class
d)
Blueprint class is an object make a
4.

A single object can also be referred to as an...

a)

Object

b)

Singular Object

c)

Instance

d)

Singular

5.

A dog might be an instance of the Pet class?

a)

True

b)

False

6.

Characteristics of OOP.. (Tick all)

a)

Data types

b)

Encapsulation

c)

Inheritance

d)

Polymorphism

e)

algorithm

7.

Which paradigm makes use of methods and attributes to encapsulate data in classes.

a)

Declarative

b)

Imperative

c)

Object oriented

d)

Low level

8.
Which of the following is a mechanism by which object acquires the properties of another object?
a)
Encapsulation
b)
 Abstraction
c)
Inheritance
d)
 Polymorphism
9.
Constructors are called just once when ______.
a)
an object is being created
b)
a class is being terminated
c)
class is being closed
d)
an object is being destroyed
10.
___________ are special methods that can be used to create and initialize an object
a)
 Constructors
b)
classes
c)
Interfaces
d)
Objects
11.
The acronym OOP stands for ____________________?
a)
Object ordering programming
b)
Other object Programming
c)
Orientated object programming
d)
Object orientated programming.
12.

Refer to the shark class. Which of the following is an instance variable?

a)

age

b)

region

c)

sharkAge

d)

Shark

13.

Why is OOP a powerful programming technique?

a)

Because it's fun

b)

Because it's easy to learn

c)

Because it allows for reusability

d)

It isn't

14.

How many classes can be defined in a single program?

a)

As many as you want

b)

Only 1

c)

Only 100

d)

Only 999

15.

Which is not feature of OOP in general definitions?

a)

Modularity

b)

Code reusability

c)

Duplicate/Redundant data

d)

Efficient Code

16.

A computer routine or snippet of code that can be reused in a computer program.

a)

Container

b)

Function

c)

Computer Programming

d)

Pseudocode

17.

A user-defined name of a program element, such as a variable or constant.

a)

Pseudocode

b)

Data Type

c)

Identifier

d)

Container

18.

A way to represent code in a manner that is easier for a wide range of people to understand.

a)

Computer Programming

b)

Pseudocode

c)

Data Type

d)

Identifier

19.

An attribute attached to a value that tells the compiler or interpreter how the data should be used.

a)

Data Type

b)

Pseudocode

c)

Container

d)

Compiled Language

20.
Code that will repeat itself for each item in a defined list.
a)
Mutator
b)
Global Variable
c)
Iteration
d)
Component
21.

A variable is...

a)

A memory location used to store a value that can change.

b)

A memory location used to store a value that cannot change

22.

A constant is...

a)

A memory location used to store a value that can change.

b)

A memory location used to store a value that cannot change

23.

'Sequence' means...

a)

When lines of code only run if a condition is met. e.g. IF, ELIF, ELSE

b)

When lines of code loop e.g. WHILE, FOR

c)

When lines of code runs one line after the other

24.

'Selection' means...

a)

When lines of code only run if a condition is met. e.g. IF, ELIF, ELSE

b)

When lines of code loop e.g. WHILE, FOR

c)

When lines of code runs one line after the other

25.

'Iteration' means...

a)

When lines of code only run if a condition is met. e.g. IF, ELIF, ELSE

b)

When lines of code loop e.g. WHILE, FOR

c)

When lines of code runs one line after the other

26.

A STRING is...

a)

A TRUE/FALSE or YES/NO value

b)

A word, or number not used in Maths.

c)

A whole number

d)

A number with a decimal point

27.

An INTERGER is...

a)

A TRUE/FALSE or YES/NO value

b)

A word, or number not used in Maths.

c)

A whole number

d)

A number with a decimal point

28.

A FLOAT is...

a)

A TRUE/FALSE or YES/NO value

b)

A word, or number not used in Maths.

c)

A whole number

d)

A number with a decimal point

29.

A BOOLEAN value is...

a)

A TRUE/FALSE or YES/NO value

b)

A word, or number not used in Maths.

c)

A whole number

d)

A number with a decimal point

30.

The data value '4.5' would be a...

a)

STRING

b)

INTERGER

c)

FLOAT

d)

BOOLEAN

31.

The data value 'Steve' would be a...

a)

STRING

b)

INTERGER

c)

FLOAT

d)

BOOLEAN

32.

The data value '250' would be a...

a)

STRING

b)

INTERGER

c)

FLOAT

d)

BOOLEAN

33.

The data value 'TRUE' would be a...

a)

STRING

b)

INTERGER

c)

FLOAT

d)

BOOLEAN

34.

The data value 'Phone Number: 07284 281837' would be a...

a)

STRING

b)

INTERGER

c)

FLOAT

d)

BOOLEAN

35.

'Casting' means...

a)

Converting data types e.g. int(), str()

b)

Removing unwanted data

c)

Creating a new variable

d)

Creating a new constant

36.

file = open("textfile.txt", "r") means...

a)

Open a file called 'textfile' and add to it.

b)

Open a file called 'textfile', empty it and then write to it

c)

Open a file called 'textfile' and read it.

37.

file = open("textfile.txt", "a") means...

a)

Open a file called 'textfile' and add to it.

b)

Open a file called 'textfile', empty it and then write to it

c)

Open a file called 'textfile' and read it.

38.

file = open("textfile.txt", "w") means...

a)

Open a file called 'textfile' and add to it.

b)

Open a file called 'textfile', empty it and then write to it

c)

Open a file called 'textfile' and read it.

39.

SQL statements always use...

a)

WHERE

FROM

SELECT

b)

SELECT

FROM

WHERE

c)

FROM

SELECT

WHERE

d)

SELECT

WHERE

FROM

40.

To create a sub program, we use:

a)

while function == 1:

b)

def function():

c)

function = input()

41.

We create a random number (between 1-6) with...

a)

random = [1,2,3,4,5,6]

b)

random1-6:

c)

random.num(6)

d)

random.randint(1,6)

42.

The examples of maintainability below are... (select 3):

a)

Comments in code

b)

Indentation

c)

Appropriate variable names

d)

Abstraction

43.

Changing an input so it works in a program (e.g. turning lowercase into uppercase)

a)

Input Sanitation

b)

Input Validation

c)

Input Creation

d)

Input Testing

44.

Testing an input and ensuring it is in the correct format or range

a)

Input Sanitation

b)

Input Validation

c)

Input Creation

d)

Input Testing

45.

Authentication means...

a)

Checking a user is who they say they are (e.g. username/password)

b)

Helping a piece of code become more readable

c)

Testing a program while it is being created,

46.

A syntax error means...

a)

An error that still allows the code to run, however not as expected.

b)

An error that prevents the code from running as it does not follow the code language rules.

47.

A logic error means...

a)

An error that still allows the code to run, however not as expected.

b)

An error that prevents the code from running as it does not follow the code language rules.

48.

prnit("Welcome to the Game")

is an example of a...

a)

Logic Error

b)

Syntax Error

49.

score = 1

print("score")

is an example of a...

a)

Logic Error

b)

Syntax Error

50.

The purpose of testing in programming is... (select 2):

a)

To check that the program hits the user requirements

b)

To save variables in the correct places in RAM

c)

To add comments into the code

d)

To check the code runs as expected.

51.

Final/terminal testing takes place...

a)

Many times throughout a programming project

b)

At the end of a programming project

52.

Iterative testing takes place...

a)

Many times throughout a programming project

b)

At the end of a programming project

53.

Normal test data is used to...

a)

Test a value that is just inside/outside of what should/shouldn't be accepted.

b)

Test a value that is expected in a program and should work.

c)

Test a value that should be rejected by the program.

54.

Boundary test data is used to...

a)

Test a value that is just inside/outside of what should/shouldn't be accepted.

b)

Test a value that is expected in a program and should work.

c)

Test a value that should be rejected by the program.

55.

Erroneous test data is used to...

a)

Test a value that is just inside/outside of what should/shouldn't be accepted.

b)

Test a value that is expected in a program and should work.

c)

Test a value that should be rejected by the program.

56.

What logic gate is this?

a)

AND

b)

NOT

c)

OR

57.

What logic gate is this?

a)

AND

b)

NOT

c)

OR

58.

What logic gate is this?

a)

AND

b)

NOT

c)

OR

59.

If 1 is the input, the output will be...

a)

0

b)

1

60.

If input A is 1, and input B is 1, the output will be...

a)

0

b)

1

61.

If input A is 1 and input B is 0, the output will be...

a)

0

b)

1

62.

DIV means...

a)

Dividing without including the remainder

b)

Dividing, but only writing the remainder

c)

Multiplying the number by itself

63.

MOD means...

a)

Dividing without including the remainder

b)

Dividing, but only writing the remainder

c)

Multiplying the number by itself

64.

^ means...

a)

Dividing without including the remainder

b)

Dividing, but only writing the remainder

c)

Multiplying the number by itself

65.

13 DIV 4 =

(a)  

66.

29 DIV 5 =

(a)  

67.

63 DIV 10 =

(a)  

68.

34 MOD 5 =

(a)  

69.

12 MOD 6 =

(a)  

70.

100 MOD 9 =

(a)  

71.

4^2 =

(a)  

72.

2^3 =

(a)  

73.

3^3 =

(a)  

74.

High-level language means...

a)

A programming language that uses short and basic single words

b)

A programming language that uses English-like words

c)

1s and 0s - used by the CPU

75.

Low-level language means...

a)

A programming language that uses short and basic single words

b)

A programming language that uses English-like words

c)

1s and 0s - used by the CPU

76.

Machine code means...

a)

A programming language that uses short and basic single words

b)

A programming language that uses English-like words

c)

1s and 0s - used by the CPU

77.

" score = input("Enter a number") "

is an example of...

a)

High-level language

b)

Low-level language

c)

Machine code

78.

INP 10

STA 12

OUT 28

is an example of...

a)

High-level language

b)

Low-level language

c)

Machine code

79.

1001 0101

0011 1111

0101 1110

is an example of...

a)

High-level language

b)

Low-level language

c)

Machine code

80.

A translator...

a)

Tests an input and changes it to fit with the program (e.g. lowercase to uppercase)

b)

Tests the code and checks for errors

c)

Tells the program where the variables are stored in RAM

d)

Converts high-level language into machine code so the CPU can run the program.

81.

A complier translator... (select 2):

a)

... is used during development of code

b)

...is used at the end when the code is finished

c)

...is quick and reports errors as is translates

d)

...takes some time and produces a list of errors at the end

82.

An interpreter translator... (select 2):

a)

... is used during development of code

b)

...is used at the end when the code is finished

c)

...is quick and reports errors as is translates

d)

...takes some time and produces a list of errors at the end

83.

2 examples of IDE tools are...

a)

Editor tools (e.g. line numbering, colour coding)

b)

Selection (when lines of code run one after another)

c)

Iteration (when lines of code loop)

d)

Translators

84.

2 examples of IDE tools are...

a)

Variable names must be suitable and appropriately named.

b)

Run-time environment (You can run the code before its finished)

c)

Debugging tools (errors are reported and advice is given to the user)

d)

Selection (lines of code only runs if a condition is met)

85.

The user can input something using the code...

a)

input("Enter a value")

b)

print("Enter a value")

c)

variable("Enter a value")

d)

while("Enter a value")

86.

We can output something using the code...

a)

input("Hello")

b)

print("Hello")

c)

variable("Hello")

d)

while("Hello")

87.

What is an Algorithm?

a)

A set of instructions that, when executed, completes a defined task that solves a problem.

b)

The process of breaking apart a problem.

c)

The process of removing unnecessary detail.

d)

A sequence of instructions.

88.

How do we represent the complexity of an algorithm?

a)

Big-R

b)

Big-O

c)

Big-N

d)

Big-A

89.

What order of complexity does this graph represent?

a)

Exponential

b)

Polynomial

c)

Linear

d)

Logarithmic

90.

What order of complexity does this graph represent?

a)

Exponential

b)

Polynomial

c)

Linear

d)

Logarithmic

91.

What order of complexity does this graph represent?

a)

Exponential

b)

Polynomial

c)

Linear

d)

Logarithmic

92.

What order of complexity does this graph represent?

a)

Exponential

b)

Polynomial

c)

Linear

d)

Logarithmic

93.

What order of complexity does this graph represent?

a)

Exponential

b)

Polynomial

c)

Linear

d)

Constant

94.

Which of these problems are solved by algorithms?

a)

Routing

b)

Encryption

c)

Sorting

d)

Searching

e)

All of the other four.

95.

What is the time complexity of this algorithm?

a)

O(n)

b)

O(2n)

c)

O(log n)

d)

O(n2)

e)

O(1)

96.

What is the time complexity of this algorithm?

a)

O(n)

b)

O(2n)

c)

O(log n)

d)

O(n2)

e)

O(1)

97.

What is the time complexity of this algorithm?

a)

O(n)

b)

O(2n)

c)

O(log n)

d)

O(n2)

e)

O(1)

98.

What is the time complexity of this algorithm?

a)

O(n)

b)

O(2n)

c)

O(log n)

d)

O(n2)

e)

O(1)

99.

What is the time complexity of this algorithm?

a)

O(n)

b)

O(2n)

c)

O(log n)

d)

O(n2)

e)

O(1)

100.

What is the Big-O Notation of "Divide & Conquer" Algorithms?

a)

O(n)

b)

O(2n)

c)

O(log n)

d)

O(n2)

e)

O(1)

101.

What is the Big-O Notation of a combination lock with 4 digits, each digit having 1 of 10 possible values?

a)

O(n)

b)

O(10n)

c)

O(log n)

d)

O(n2)

e)

O(1)

102.

What is the Big-O Notation of picking a sequence of 10 balls from a bag of 10 different coloured balls (the ball is not put back into the bag after being picked)?

a)

O(n)

b)

O(n!)

c)

O(log n)

d)

O(n2)

e)

O(1)

103.

Which of the following is not done by abstraction?

a)

Identifies essential details

b)

Disregards non-essential information

c)

Breaks the problem down into smaller tasks

104.

Which of the following is not done by decomposition?

a)

Allows multiple people to work on the problem together

b)

Disregards non-essential information

c)

Breaks the problem down into smaller tasks

105.

When drawing a dog, which of the following characteristics is non-essential?

a)

Dogs have 4 paws

b)

Dogs have fur

c)

Dogs have brown fur

106.

When designing a building that must be accessible for wheelchairs, which of the following characteristics is non-essential?

a)

Number of doors

b)

Number of walls

c)

Number of wall paintings

107.

One advantage of abstraction is that it means no mistakes can be made

a)

True

b)

False

108.

You could use abstraction to replace specific objects with simple shapes

a)

True

b)

False

109.

This is a good example of decomposition

Sit down

Do homework

a)

True

b)

False

110.

Decomposition allows each task to become _______

a)

More manageable

b)

Easier

c)

Quicker

111.

Decomposition allows the entire task to be completed as _____

a)

A Team

b)

A Whole

c)

Quickly as possible

112.

Abstraction and Decomposition are separate concepts, you would usually choose to do either one or the other

a)

True

b)

False

113.

It is always necessary to decompose a task

a)

True

b)

False

114.

Abstraction and Decomposition are examples of...

a)

Computational Thinking

b)

Algorithmic Thinking

c)

Computer Science

d)

Logical Reasoning

115.

What is pattern recognition?

a)

Breaking down a complex problem into smaller problems

b)

Looking for similarities among and within problems

c)

Building models from patterns

116.

Why do we need to look for patterns in problems?

a)

Patterns make it easier for us to solve complex problems

b)

We don't need to look for patterns

c)

Patterns make it more difficult complex problems

117.

If you don't look for patterns in a problem, your solution might be _____

a)

Wrong

b)

Inefficient

c)

Too slow

118.

Identifying the steps involved in solving a problem

a)

Abstraction

b)

Decomposition

c)

Pattern Recognition

d)

Algorithmic Thinking

119.
Which of the following is an example of thinking computationally?
a)
Planning out your route when going to meet a friend
b)
When going to meet a friend, wandering around until you find them
c)
When going to meet a friend, asking a parent to plan your route for you
120.

Looking for similarities and trends within a problem

a)

Abstraction

b)

Decomposition

c)

Pattern recognition

d)

Algorithmic Thinking

121.

What is a flowchart?

a)

A visual representation of an algorithm.

b)

A diagram that shows abstraction.

c)

A series of shapes.

122.

A school database has lots of information on students, the data manager needs to use abstraction. What data should she leave out?

a)

Age

b)

Guardian's phone numbers

c)

Classes

d)

Eye colour

123.

Which of the following is not done by abstraction?

a)

Identifies essential details

b)

Disregards non-essential information

c)

Breaks the problem down into smaller tasks

124.

Which of the following is not done by decomposition?

a)

Allows multiple people to work on the problem together

b)

Disregards non-essential information

c)

Breaks the problem down into smaller tasks

125.

When drawing a dog, which of the following characteristics is non-essential?

a)

Dogs have 4 paws

b)

Dogs have fur

c)

Dogs can have brown fur

126.

You could use abstraction to replace specific objects with simple shapes

a)

True

b)

False

127.

Why do we need to look for patterns in problems?

a)

Patterns make it easier for us to solve complex problems

b)

We don't need to look for patterns

c)

Patterns make it more difficult complex problems

128.

What does the circle symbol mean in a state transition diagram?

a)

start state

b)

state

c)

transition

d)

end state

129.

What are the three types of errors in programming?

a)

runtime, syntax, logic

b)

logic, spelling, operator

c)

spelling, logic, runtime

d)

syntax, operator, logic

130.

What does erroneous data mean?

a)

Data that is right on the edge of being right and wrong

b)

Data that you expect the user to enter

c)

Data that you do not expect the user to enter

131.

What is a finite state machine?

a)

A machine that can do one thing

b)

Pseudo code that represents an algorithm

c)

A machine that has a finite amount of things to do

d)

A representation of how something changes from one state to another

132.

What is functional abstraction?

a)

Taking out bits of irrelevant detail out of a function

b)

Using a function, but how it works is on no interest to the user

c)

Using a function within your program

133.

What type of diagram is this?

a)

Entity relationship diagram

b)

Flow chart

c)

State transition diagram

d)

Class diagram

134.

Which string would be accepted?

a)

abba

b)

bbac

c)

abac

d)

caaba

135.

Which is an example of iteration?

a)

print("Hello")

b)

if a == b:

c)

for I in range (1,10):

136.

This piece of code uses ...

a)

Sequence

b)

Selection

c)

Iteration

137.

What type of diagram is the image of?

a)

State diagram

b)

Entity relationship diagram

c)

Hierarchy chart

d)

Flow chart

138.

What sorting algorithm is shown here?

a)

Bubble sort

b)

Merge sort

c)

Quick sort

d)

Insertion sort