wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Structure and Programming Techniques A level

Total questions: 107

Worksheet time: 3600secs

Name
Class
Date
1.

Define abstract data type (ADT)

a)

A data type that keeps no detailed information

b)

A mathematical model for data types

c)

A collection of data under one identifier and with its own methods to work on the data

d)

A collection of data of the same type.

2.

The hashing function converts an input parameter into a hash, an integer.

This integer can then be used to work out the value of the input parameter.

a)

True

b)

False

3.

Which variables can be used to manage a queue? (multiple)

a)

maxSize for the capacity of the queue

b)

size representing the number of items in the queue

c)

Rear pointer for the last item in the queue

d)

Front pointer for the first item in the queue

4.

Define abstract data type (ADT) 

a)

A mathematical mode for data types

b)

A queue

c)

A stack

d)

A linked list

5.

Name examples of abstract data type (ADT) 

a)

A mathematical mode for data types

b)

A queue

c)

A stack

d)

A linked list

6.

Name examples of abstract data type (ADT) 

a)

String

b)

A list

c)

A graph

d)

A binary tree

7.

An abstract data type (ADT)

a)

Is a collection of data items under one identifier

b)

Has methods (functions & procedures) to handle the data items

c)

is static and immutable

d)

is mostly dynamic and mutable

8.

What is this data structure?

data = [[1, 2, 3, 4, 5, 6], [2, 4, 6, 8, 10, 12], [3,6,9,12,15,18]]

a)

1D array

b)

2D array

c)

3D array

d)

Tuple

e)

Record

9.

What is this data structure?

data = [(1, 2, 3, 4, 5, 6), (2, 4, 6, 8, 10, 12), (3,6,9,12,15,18)]

a)

1D array

b)

2D array

c)

3D array

d)

Tuple

e)

Record

10.

What is this data structure?

data = [[[1, 2, 3], [4, 5, 6]], [[2, 4, 6], [8, 10, 12]], [[3,6,9], [12,15,18]]]

a)

1D array

b)

2D array

c)

3D array

d)

Tuple

e)

Record

11.

What is this data structure?

data = (1, 2, 3, 4, 5, 6, 2, 4, 6, 8, 10, 12, 3, 6, 9, 12, 15, 18)

a)

1D array

b)

2D array

c)

3D array

d)

Tuple

e)

Record

12.

What is this data structure?

TYPE Student

DECLARE name : String

DECLARE age : Integer

DECLARE gender : Char

ENDTYPE

a)

1D array

b)

2D array

c)

3D array

d)

Tuple

e)

Record

13.

What is the meaning of Front Pointer in a queue when implemented in ARRAY?

a)

The index for the first item in the queue.

b)

The last item's index in the queue

c)

The next free slot in the queue

14.

What is the meaning of Rear Pointer in a queue when implemented in ARRAY?

a)

The index for the first item in the queue.

b)

The last item's index in the queue

c)

The next free slot in the queue

15.

What is the meaning of Top Pointer in a Stack when implemented in ARRAY?

a)

The index for the top item in the stack.

b)

The bottom item's index in the stack

c)

The next free slot in the stack

16.

What is the meaning of Front Pointer in a queue when implemented in ARRAY? (2)

a)

The index for the first item in the queue.

b)

The last item's index in the queue

c)

The next free slot in the queue

d)

The item to be removed next time

17.

What is the meaning of Top Pointer in a Stack when implemented in ARRAY?

a)

The index for the top item in the stack.

b)

The bottom item's index in the stack

c)

The next free slot in the stack

d)

The item to be removed next time

18.

Describe how to add C to the linked list myData which holds sorted letters.

a)

1. temp = startPoint

2. startPointer= 78

3. startPointer->next = temp

b)

startPointer->next->next->next = 78

c)

startPointer->next = 78

19.

Which node is visited before K and which node is visited after K?

a)

before: G node

after: M node

b)

before: M node

after: G node

c)

before: M node

after: C node

20.

Which node is the starting node in this current linked list, myData?

a)

G node

b)

K node

c)

M node

d)

C node

21.

Which node is the last node in this current linked list, myData?

a)

G node

b)

K node

c)

M node

d)

C node

22.

Which node is the last node in this current linked list, myData, after adding C node?

a)

G node

b)

K node

c)

M node

d)

C node

23.

Which node is the first node in this current linked list, myData, after adding C node?

a)

G node

b)

K node

c)

M node

d)

C node

24.

Which value of startPointer in this linked list, myData, after adding C node?

a)

1986

b)

null

c)

111

d)

78

e)

1001

25.

Which value of startPointer in this linked list, myData, BEFORE adding C node?

a)

1986

b)

null

c)

111

d)

78

e)

1001

26.

startPointer->next-> next

is a way to "seek" the node after next.

What would be the value for temp

temp = startPointer->next

a)

1986

b)

1001

c)

111

d)

78

27.

startPointer->next-> next

is a way to "seek" the node after next.

What would be the value for temp

temp = startPointer->next->next

a)

1986

b)

1001

c)

111

d)

78

28.

Which node is the root node?

a)

M node

b)

A node

c)

L node

d)

S node

29.

Which node is a leave node? (multiple)

a)

M node

b)

A node

c)

L node

d)

S node

e)

T node

30.

How many child nodes does G node have?

a)

none

b)

1

c)

2

d)

3

31.

How many child nodes does M node have?

a)

none

b)

1

c)

2

d)

3

32.

To visit S node, what is the path of visit?

a)

Go to S directly

b)

Start from A, then G, M, P, T, then S

c)

Start from RootPointer which is M node, then P, T, then S,

33.

The "If" Statement is an example of a _________________

a)

Correctional Statement

b)

Competitive Statement

c)

Conditional Statement

d)

Inquisitive Statement

34.

Which of these is the correct format of an "if" statement?

a)
b)
c)
d)
35.

True/False: The body of an "if" statement will only be executed if the condition is true.

a)

True

b)

False

36.

How many "if" statements can a single program have?

a)

<10

b)

<20

c)

<30

d)

As many as is needed

37.

What happens to the code in the body of an "if" statement if the condition is false?

a)

The computer determines if it is essential to the program and if it is, then the code is executed anyway.

b)

The code moves to a coastal city, attempting to find love and start a family. However, low waged and crushing mortgage rates lead to it moving back home where it sits, hoping that one day it will be executed.

c)

The code is skipped.

d)

The code stages a revolution and attempts to take over the program, ultimately unsuccessfully, which leads to it not being executed.

38.

Which of these can be paired with an "if" statement to represent other outcomes of a scenario?

a)

or

b)

else

c)

but

d)

sheboygan

39.

Which of these is the correct format for an "if/else" statement?

a)
b)
c)
d)
40.

How many "else" statements can you pair with a single "if" statement

a)

1

b)

<10

c)

<20

d)

As many as is needed.

41.

Which of these is used to add a third, fourth, etc outcome to a scenario?

a)

otherwise

b)

else if

c)

iff

d)

elsa

42.

How many "else if" links can you have in an "if/else" chain?

a)

<10

b)

<20

c)

<30

d)

As many as is needed to represent the situation

43.

What will be the output of the code?

a)

Even

b)

EvenDivisible by 3

c)

Even

Divisible by 3

d)

Not Divisible by 6

44.

What is the output of the code?

a)

Even

b)

Odd

45.

Which truth table is this?

a)

AND

b)

OR

c)

XOR

46.

Select all the statements that describe how an if/else chain works.

a)

Each condition is tested, executing the code for each condition that is true.

b)

Each condition is tested, until a true condition is found, then the code for that condition is executed and the remainder of the chain is skipped.

c)

If none of the conditions are true, then the computer looks for an "else" statement to execute.

d)

If the last condition in the chain is false, then the computer looks for an "else" to execute.

e)

If any condition is false, then the computer looks for an "else" to execute.

47.

It is possible to execute both the (block of) statements under if and the else clauses at the same time.

a)

Yes

b)

No

48.

What is the output?

a)

True

b)

False

c)

condition1

d)

condition2

49.

This operator checks to see if one value is the same as the other value

a)

==

b)

!=

c)

>

d)

<

50.

Given the nested if-else below, what will be the value x when the code is executed successfully.

a)

0

b)

4

c)

2

d)

3

51.

What would be outputted here?

a)

Bigger than 2!

b)

Number is 5

c)

Bigger than 2!

Number is 5

d)

Nothing

52.

Look at the following code, what will it generate

a)

1,2,3,4,5,6,7,8,9,10,11,12

b)

0,1,2,3,4,5,6,7,8,9,10,11,12

c)

1,2,3,4,5,6,7,8,9,10,11,12,13

d)

0,1,2,3,4,5,6,7,8,9,10,11,12,13

53.

What does the following program display?

a)

1,2,3,4

b)

1,2,3,4,5

c)

counter,counter,counter,counter,counter

d)

0,1,2,3,4,5

54.
a)
b)
c)
d)

1,2,3,4

55.

what is the name of the variable used in the following code?

a)

counter

b)

print

c)

for

d)

#

56.

Which of the following is an acceptable variable name?

a)

no-text

b)

8text

c)

no_text

d)

no_text$

57.
What type of loop is used when you know how many times you want to repeat something?
a)
A WHILE Loop
b)
An IF function
c)
A FOR Loop
d)
A Variable
58.
Which of the following symbols is used in Python to mean "Not equal to"?
a)
==
b)
!=
c)
<>
d)
><
59.
a)
Hello world!
b)
Error
c)
Hello world!
False
d)
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
(repeated continuously)
60.
a)
Welcome
b)
Try again!
c)
Error
d)
Enter your password
61.

What will be the output for the following code?

i = 0

while i < 5:

print(i)

i = i + 1

a)

1 2 3 4 5

b)

0 1 2 3 4 5

c)

1 2 3 4

d)

0 1 2 3 4

62.

What is the output for the following code?

i = 9

while i > 0:

print("Hello")

a)

9

b)

0

c)

Infinite

d)

8

63.

What would the output be for the following program if the user enters 4 and 6?

a)

10

b)

14

c)

16

d)

error

64.

If the user inputs "Connolly"into surname and "Luke" into first what would be output?

a)

Error

b)

Connolly Luke

c)

Luke Connolly

d)

Connolly Luke Connolly Luke

65.

John wants to create a subroutine in python that will roll a dice. Which is the correct method below?

a)

DEFINE diceroll:INTEGER

b)

def diceroll[]:

c)

def diceroll():

d)

def diceroll:

66.

What would the output be for the following program if the user enters 4 and 6?

a)

10

b)

14

c)

16

d)

error

67.

If the user inputs "Connolly"into surname and "Luke" into first what would be output?

a)

Error

b)

Connolly Luke

c)

Luke Connolly

d)

Connolly Luke Connolly Luke

68.

John wants to create a subroutine in python that will roll a dice. Which is the correct method below?

a)

DEFINE diceroll:INTEGER

b)

def diceroll[]:

c)

def diceroll():

d)

def diceroll:

69.

Norah wants to print her multiplication equation of 12 x 12. What code should she add below?

a)

print (multiply)

b)

a = 12

b = 12

answer = a * b

c)

print(multiply(12, 12))

d)

print(multiply(12 * 12))

70.

"Declaration" refers to...

a)

Storing data in variables

b)

Creating variables

c)

Repeating sections of code

d)

Checking a condition to see which piece of code to run next

71.

"Iteration" refers to...

a)

Storing data in variables

b)

Creating variables

c)

Repeating sections of code

d)

Checking a condition to see which piece of code to run next

72.

A loop within a loop is...

a)

Definite iteration

b)

Indefinite iteration

c)

Nested iteration

d)

Reverse Polish iteration

73.

Using "meaningful identifiers" means...

a)

Giving variables and subroutines sensible names

b)

Giving variables the correct data type

c)

Correct use of conditions in loops

74.

What is the term for a named block of code that can be executed by writing its name.

a)

Subroutine

b)

Condition

c)

Selection

75.

Some subroutines produce a result that is sent back to where they were called from. What is this value called?

a)

Return value

b)

Final value

c)

Parameter

d)

Variable

76.

Local variables...

a)

...only exist while their subroutine is executing

b)

...are only accessible in the subroutine in which they are declared

c)

...can only be of the 'integer' data type

d)

...can be used from anywhere in a program

77.

Which of the following is not an example of a subroutine?

a)

Procedure

b)

Function

c)

List

78.

Subroutines are designed to save the programmer time

a)

True

b)

False

79.

Which subroutine will return a value back to the program?

a)

Procedure

b)

Function

80.

Which subroutine will not return a value back to the program?

a)

Procedure

b)

Function

81.

What are the parameters with in this procedure?

a)

first name and second name

b)

first and surname

c)

first and second name

d)

myname, first and surname

82.

"Iteration" refers to...

a)

Storing data in variables

b)

Creating variables

c)

Repeating sections of code

d)

Checking a condition to see which piece of code to run next

83.

What is the term for a named block of code that can be executed by writing its name.

a)

Subroutine

b)

Condition

c)

Selection

84.

Some subroutines produce a result that is sent back to where they were called from. What is this value called?

a)

Return value

b)

Final value

c)

Parameter

d)

Variable

85.

Local variables...

a)

...only exist while their subroutine is executing

b)

...are only accessible in the subroutine in which they are declared

c)

...can only be of the 'integer' data type

d)

...can be used from anywhere in a program

86.

Which of the following is not an example of a subroutine?

a)

Procedure

b)

Function

c)

List

87.

What are the parameters with in this procedure?

a)

first name and second name

b)

first and surname

c)

first and second name

d)

myname, first and surname

88.

What would the output be from the program shown here? (assuming that the user enters "John" and "Smith"

a)

John

b)

Smith

c)

John Smith

d)

Error

89.

Which of the following statements is not true?

a)

Functions/subroutines are examples of reusable code

b)

Functions and subroutines are always appropriate in programs

c)

Using functions/subroutines make it easier to "deconstruct" a problem into smaller pieces

d)

They can make programs easier to read and understand

90.
Which of the following best describes the order in which these lines are processed in Python?
a)
4, 1, 2
b)
4, 2, 1
c)
1, 2, 3, 4
d)
3, 1, 2
91.
How do you correctly call this function
a)
def(1)
b)
x=square( )
c)
defSquare(4)
d)
x=square(5)
92.
What will print ?
a)
cats eat mice
b)
mice get away
c)
unknown
d)
error message
93.
How many times will Boo print?
a)
none
b)
4
c)
5
d)
1
94.

What will be the output of code above?

(a)  

95.

What will be the output of code above?

(a)  

96.

What will be the output of code above?

(a)  

97.

Selection uses which command?

a)

While

b)

Repeat Until

c)

IF

d)

x=x+1

98.

what is the formal name in computing for looping?

a)

Iteration

b)

Selection

c)

Repetition

d)

For While Do

99.

X = 20;

Y = 5;

Y = X+Y

X++;

a)

X = 20, Y = 25

b)

X = 20, Y = 5

c)

X = 21, Y = 25

d)

X = 20, Y = 26

100.

What algorithm is this the code for?

a)

Merge Sort

b)

Bubble Sort

c)

Insert sort

d)

Quick sort

101.

A hashing function is one way function which converts input parameters into integers which can be used as the storage address. This is used for:

a)

creating a hash table for indexing records

b)

creating a linked list for storing records

c)

creating a queue to store records

d)

creating a binary tree to store records

102.

Recursion is a special way of solving problems that can be reduced to similar but smaller problems. Which line is the base case?

a)

54.

in base case, no further recursive call, just return a value to caller

b)

56.

in base case, call the function again

c)

53.

It is the name of the function

103.

What could be the name for section A?

a)

variables

For monitoring values of variables

b)

Call stack

For recording the function calls.

c)

Return address

When the called operations completed and return, this is where it resumes

104.

What could be the name for section B?

a)

variables

For monitoring values of variables

b)

Call stack

For recording the function calls.

c)

Return address

When the called operations completed and return, this is where it resumes

105.

What could be the name for section C?

a)

variables

For monitoring values of variables

b)

Call stack

For recording the function calls.

c)

Return address

When the called operations completed and return, this is where it resumes

106.

For the IDE to show the information like A, B, and C, it needs to be running (multiple)

a)

in Debugging mode

b)

after the program is installed on the computer

c)

in Running with debugging mode

d)

With Breakpoint(s) set up

107.

An IDE is an integrated development environment. The coloured display is known as "prettyprinting" to help programmers raise productivity. Other features an IDE could offer: (multiple)

a)

Running in Debugging mode to identify bugs

b)

context sensitive prompt - to give hints on possible options

c)

Auto-Formatting and auto-indentation to make code organised

d)

Collapse and Expand code sections / blocks to enable different views