wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

10 min test 22

Total questions: 21

Worksheet time: 12mins

Name
Class
Date
1.

Which logic gate gives an output of 0 if both inputs are 0?

a)

AND gate

b)

OR gate

c)

Both AND and OR gates

2.

Given that x = "CompSci" and test = x.substring(4,1) what is the output of print(test)?

a)

S

b)

p

c)

Comp

3.

Given that x = "CompSci" and test = x.substring(4,1) What would

print (x + test) output?

a)

CompSciS

b)

CompScip

c)

CompScIComp

4.

The highScore variable has an integer data type. Using the correct data type makes code...

a)

more memory efficient

b)

less memory efficient

c)

more robust

d)

less robust

5.

The flow of this program is controlled by

a)

a selection statement

b)

an interation statement

c)

both selection and iteration statements

6.

Which of these inputs would have resulted in the output 'Invalid score entered'

a)

1

b)

1.1

c)

101

7.

What would the program output if the input was 90?

a)

You equalled the high score

b)

New high score, well done!

c)

You did not beat the high score

8.

What is the output of this logic circuit?

A = 1

B = 1

a)

0

b)

1

9.

The substring function is a string-manipulation technique.

What are the other string manipulation tools?

a)

casting

b)

.upper

c)

.lower

d)

concatenation

e)

.len

10.

Which of the below are data types?

a)

substring

b)

variable

c)

string

d)

float

e)

Boolean

11.

Define selection and state the code statements used to perform selection.

a)

the process of making a decision

b)

the process of looping back to a previous line of code and executing it again

c)

IF THEN ELSE

d)

FOR / WHILE / UNTIL

e)

SWITCH CASE

12.

Define iteration and state the code statements used to perform iteration.

a)

the process of making a decision

b)

the process of looping back to a previous line of code and executing it again

c)

IF THEN ELSE

d)

FOR / WHILE / UNTIL

e)

SWITCH CASE

13.

The program has a variable called highScore.

What is a variable?

a)

A named memory location which stores a value that can change whilst the program is running

b)

A named memory location which stores a value that can't change whilst the program is running

c)

A data structure which holds similar/related values

14.

Which is the assignment operator and what is it's function?

a)

checks to see if two values are the equavalent

b)

assigns a value to a variable

c)

=

d)

==

15.

Which is the 'equal to' operator and what is it's function?

a)

checks to see if two values are the equavalent

b)

assigns a value to a variable

c)

=

d)

==

16.

What would the code do if B was input?

a)

the listusers() procedure would be called

b)

the createuser() function would be called

c)

the createuser() procedure would be called

d)

"Not a valid choice" would be ouput

17.

A local variable

a)

is accessible throughout the entire program

b)

is confined to use within iteration or a subprogram

18.

A global variable

a)

is accessible throughout the entire program

b)

is confined to use within iteration or a subprogram

19.

What data type would be most suitable for storing the amount of people that attended a football match. This data will then be used to work out the attendance figures to matches.

a)

integer

b)

real/float

c)

string

d)

boolean

20.

What data type would be most suitable for storing the weight of babies when they are born?

a)

integer

b)

real/float

c)

string

d)

boolean

21.

What data type would be most suitable for storing the house number and road name of an address.

a)

integer

b)

real/float

c)

string

d)

boolean