wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

OCR Computer Science Paper 2

Total questions: 66

Worksheet time: 35mins

Name
Class
Date
1.

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

2.

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

3.

'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

4.

'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

5.

'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

6.

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

7.

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

8.

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

9.

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

10.

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

a)

STRING

b)

INTERGER

c)

FLOAT

d)

BOOLEAN

11.

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

a)

STRING

b)

INTERGER

c)

FLOAT

d)

BOOLEAN

12.

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

a)

STRING

b)

INTERGER

c)

FLOAT

d)

BOOLEAN

13.

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

a)

STRING

b)

INTERGER

c)

FLOAT

d)

BOOLEAN

14.

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

a)

STRING

b)

INTERGER

c)

FLOAT

d)

BOOLEAN

15.

'Casting' means...

a)

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

b)

Removing unwanted data

c)

Creating a new variable

d)

Creating a new constant

16.

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.

17.

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.

18.

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.

19.

SQL statements always use...

a)

WHERE

FROM

SELECT

b)

SELECT

FROM

WHERE

c)

FROM

SELECT

WHERE

d)

SELECT

WHERE

FROM

20.

To create a sub program, we use:

a)

while function == 1:

b)

def function():

c)

function = input()

21.

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)

22.

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

a)

Comments in code

b)

Indentation

c)

Appropriate variable names

d)

Abstraction

23.

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

24.

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

25.

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,

26.

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.

27.

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.

28.

prnit("Welcome to the Game")

is an example of a...

a)

Logic Error

b)

Syntax Error

29.

score = 1

print("score")

is an example of a...

a)

Logic Error

b)

Syntax Error

30.

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.

31.

Final/terminal testing takes place...

a)

Many times throughout a programming project

b)

At the end of a programming project

32.

Iterative testing takes place...

a)

Many times throughout a programming project

b)

At the end of a programming project

33.

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.

34.

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.

35.

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.

36.

What logic gate is this?

a)

AND

b)

NOT

c)

OR

37.

What logic gate is this?

a)

AND

b)

NOT

c)

OR

38.

What logic gate is this?

a)

AND

b)

NOT

c)

OR

39.

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

a)

0

b)

1

40.

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

a)

0

b)

1

41.

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

a)

0

b)

1

42.

DIV means...

a)

Dividing without including the remainder

b)

Dividing, but only writing the remainder

c)

Multiplying the number by itself

43.

MOD means...

a)

Dividing without including the remainder

b)

Dividing, but only writing the remainder

c)

Multiplying the number by itself

44.

^ means...

a)

Dividing without including the remainder

b)

Dividing, but only writing the remainder

c)

Multiplying the number by itself

45.

13 DIV 4 =

(a)  

46.

29 DIV 5 =

(a)  

47.

63 DIV 10 =

(a)  

48.

34 MOD 5 =

(a)  

49.

12 MOD 6 =

(a)  

50.

100 MOD 9 =

(a)  

51.

4^2 =

(a)  

52.

2^3 =

(a)  

53.

3^3 =

(a)  

54.

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

55.

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

56.

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

57.

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

is an example of...

a)

High-level language

b)

Low-level language

c)

Machine code

58.

INP 10

STA 12

OUT 28

is an example of...

a)

High-level language

b)

Low-level language

c)

Machine code

59.

1001 0101

0011 1111

0101 1110

is an example of...

a)

High-level language

b)

Low-level language

c)

Machine code

60.

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.

61.

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

62.

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

63.

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

64.

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)

65.

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

66.

We can output something using the code...

a)

input("Hello")

b)

print("Hello")

c)

variable("Hello")

d)

while("Hello")