Font size
WorksheetsData Structure and Programming Techniques A level
Total questions: 107
Worksheet time: 3600secs
Define abstract data type (ADT)
A data type that keeps no detailed information
A mathematical model for data types
A collection of data under one identifier and with its own methods to work on the data
A collection of data of the same type.
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.
True
False
Which variables can be used to manage a queue? (multiple)
maxSize for the capacity of the queue
size representing the number of items in the queue
Rear pointer for the last item in the queue
Front pointer for the first item in the queue
Define abstract data type (ADT)
A mathematical mode for data types
A queue
A stack
A linked list
Name examples of abstract data type (ADT)
A mathematical mode for data types
A queue
A stack
A linked list
Name examples of abstract data type (ADT)
String
A list
A graph
A binary tree
An abstract data type (ADT)
Is a collection of data items under one identifier
Has methods (functions & procedures) to handle the data items
is static and immutable
is mostly dynamic and mutable
What is this data structure?
data = [[1, 2, 3, 4, 5, 6], [2, 4, 6, 8, 10, 12], [3,6,9,12,15,18]]
1D array
2D array
3D array
Tuple
Record
What is this data structure?
data = [(1, 2, 3, 4, 5, 6), (2, 4, 6, 8, 10, 12), (3,6,9,12,15,18)]
1D array
2D array
3D array
Tuple
Record
What is this data structure?
data = [[[1, 2, 3], [4, 5, 6]], [[2, 4, 6], [8, 10, 12]], [[3,6,9], [12,15,18]]]
1D array
2D array
3D array
Tuple
Record
What is this data structure?
data = (1, 2, 3, 4, 5, 6, 2, 4, 6, 8, 10, 12, 3, 6, 9, 12, 15, 18)
1D array
2D array
3D array
Tuple
Record
What is this data structure?
TYPE Student
DECLARE name : String
DECLARE age : Integer
DECLARE gender : Char
ENDTYPE
1D array
2D array
3D array
Tuple
Record
What is the meaning of Front Pointer in a queue when implemented in ARRAY?
The index for the first item in the queue.
The last item's index in the queue
The next free slot in the queue
What is the meaning of Rear Pointer in a queue when implemented in ARRAY?
The index for the first item in the queue.
The last item's index in the queue
The next free slot in the queue
What is the meaning of Top Pointer in a Stack when implemented in ARRAY?
The index for the top item in the stack.
The bottom item's index in the stack
The next free slot in the stack
What is the meaning of Front Pointer in a queue when implemented in ARRAY? (2)
The index for the first item in the queue.
The last item's index in the queue
The next free slot in the queue
The item to be removed next time
What is the meaning of Top Pointer in a Stack when implemented in ARRAY?
The index for the top item in the stack.
The bottom item's index in the stack
The next free slot in the stack
The item to be removed next time
Describe how to add C to the linked list myData which holds sorted letters.
1. temp = startPoint
2. startPointer= 78
3. startPointer->next = temp
startPointer->next->next->next = 78
startPointer->next = 78
Which node is visited before K and which node is visited after K?
before: G node
after: M node
before: M node
after: G node
before: M node
after: C node
Which node is the starting node in this current linked list, myData?
G node
K node
M node
C node
Which node is the last node in this current linked list, myData?
G node
K node
M node
C node
Which node is the last node in this current linked list, myData, after adding C node?
G node
K node
M node
C node
Which node is the first node in this current linked list, myData, after adding C node?
G node
K node
M node
C node
Which value of startPointer in this linked list, myData, after adding C node?
1986
null
111
78
1001
Which value of startPointer in this linked list, myData, BEFORE adding C node?
1986
null
111
78
1001
startPointer->next-> next
is a way to "seek" the node after next.
What would be the value for temp
temp = startPointer->next
1986
1001
111
78
startPointer->next-> next
is a way to "seek" the node after next.
What would be the value for temp
temp = startPointer->next->next
1986
1001
111
78
Which node is the root node?
M node
A node
L node
S node
Which node is a leave node? (multiple)
M node
A node
L node
S node
T node
How many child nodes does G node have?
none
1
2
3
How many child nodes does M node have?
none
1
2
3
To visit S node, what is the path of visit?
Go to S directly
Start from A, then G, M, P, T, then S
Start from RootPointer which is M node, then P, T, then S,
The "If" Statement is an example of a _________________
Correctional Statement
Competitive Statement
Conditional Statement
Inquisitive Statement
Which of these is the correct format of an "if" statement?
True/False: The body of an "if" statement will only be executed if the condition is true.
True
False
How many "if" statements can a single program have?
<10
<20
<30
As many as is needed
What happens to the code in the body of an "if" statement if the condition is false?
The computer determines if it is essential to the program and if it is, then the code is executed anyway.
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.
The code is skipped.
The code stages a revolution and attempts to take over the program, ultimately unsuccessfully, which leads to it not being executed.
Which of these can be paired with an "if" statement to represent other outcomes of a scenario?
or
else
but
sheboygan
Which of these is the correct format for an "if/else" statement?
How many "else" statements can you pair with a single "if" statement
1
<10
<20
As many as is needed.
Which of these is used to add a third, fourth, etc outcome to a scenario?
otherwise
else if
iff
elsa
How many "else if" links can you have in an "if/else" chain?
<10
<20
<30
As many as is needed to represent the situation
What will be the output of the code?
Even
EvenDivisible by 3
Even
Divisible by 3
Not Divisible by 6
What is the output of the code?
Even
Odd
Which truth table is this?
AND
OR
XOR
Select all the statements that describe how an if/else chain works.
Each condition is tested, executing the code for each condition that is true.
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.
If none of the conditions are true, then the computer looks for an "else" statement to execute.
If the last condition in the chain is false, then the computer looks for an "else" to execute.
If any condition is false, then the computer looks for an "else" to execute.
It is possible to execute both the (block of) statements under if and the else clauses at the same time.
Yes
No
What is the output?
True
False
condition1
condition2
This operator checks to see if one value is the same as the other value
==
!=
>
<
Given the nested if-else below, what will be the value x when the code is executed successfully.
0
4
2
3
What would be outputted here?
Bigger than 2!
Number is 5
Bigger than 2!
Number is 5
Nothing
Look at the following code, what will it generate
1,2,3,4,5,6,7,8,9,10,11,12
0,1,2,3,4,5,6,7,8,9,10,11,12
1,2,3,4,5,6,7,8,9,10,11,12,13
0,1,2,3,4,5,6,7,8,9,10,11,12,13
What does the following program display?
1,2,3,4
1,2,3,4,5
counter,counter,counter,counter,counter
0,1,2,3,4,5
1,2,3,4
what is the name of the variable used in the following code?
counter
for
#
Which of the following is an acceptable variable name?
no-text
8text
no_text
no_text$
False
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
(repeated continuously)
What will be the output for the following code?
i = 0
while i < 5:
print(i)
i = i + 1
1 2 3 4 5
0 1 2 3 4 5
1 2 3 4
0 1 2 3 4
What is the output for the following code?
i = 9
while i > 0:
print("Hello")
9
0
Infinite
8
What would the output be for the following program if the user enters 4 and 6?
10
14
16
error
If the user inputs "Connolly"into surname and "Luke" into first what would be output?
Error
Connolly Luke
Luke Connolly
Connolly Luke Connolly Luke
John wants to create a subroutine in python that will roll a dice. Which is the correct method below?
DEFINE diceroll:INTEGER
def diceroll[]:
def diceroll():
def diceroll:
What would the output be for the following program if the user enters 4 and 6?
10
14
16
error
If the user inputs "Connolly"into surname and "Luke" into first what would be output?
Error
Connolly Luke
Luke Connolly
Connolly Luke Connolly Luke
John wants to create a subroutine in python that will roll a dice. Which is the correct method below?
DEFINE diceroll:INTEGER
def diceroll[]:
def diceroll():
def diceroll:
Norah wants to print her multiplication equation of 12 x 12. What code should she add below?
print (multiply)
a = 12
b = 12
answer = a * b
print(multiply(12, 12))
print(multiply(12 * 12))
"Declaration" refers to...
Storing data in variables
Creating variables
Repeating sections of code
Checking a condition to see which piece of code to run next
"Iteration" refers to...
Storing data in variables
Creating variables
Repeating sections of code
Checking a condition to see which piece of code to run next
A loop within a loop is...
Definite iteration
Indefinite iteration
Nested iteration
Reverse Polish iteration
Using "meaningful identifiers" means...
Giving variables and subroutines sensible names
Giving variables the correct data type
Correct use of conditions in loops
What is the term for a named block of code that can be executed by writing its name.
Subroutine
Condition
Selection
Some subroutines produce a result that is sent back to where they were called from. What is this value called?
Return value
Final value
Parameter
Variable
Local variables...
...only exist while their subroutine is executing
...are only accessible in the subroutine in which they are declared
...can only be of the 'integer' data type
...can be used from anywhere in a program
Which of the following is not an example of a subroutine?
Procedure
Function
List
Subroutines are designed to save the programmer time
True
False
Which subroutine will return a value back to the program?
Procedure
Function
Which subroutine will not return a value back to the program?
Procedure
Function
What are the parameters with in this procedure?
first name and second name
first and surname
first and second name
myname, first and surname
"Iteration" refers to...
Storing data in variables
Creating variables
Repeating sections of code
Checking a condition to see which piece of code to run next
What is the term for a named block of code that can be executed by writing its name.
Subroutine
Condition
Selection
Some subroutines produce a result that is sent back to where they were called from. What is this value called?
Return value
Final value
Parameter
Variable
Local variables...
...only exist while their subroutine is executing
...are only accessible in the subroutine in which they are declared
...can only be of the 'integer' data type
...can be used from anywhere in a program
Which of the following is not an example of a subroutine?
Procedure
Function
List
What are the parameters with in this procedure?
first name and second name
first and surname
first and second name
myname, first and surname
What would the output be from the program shown here? (assuming that the user enters "John" and "Smith"
John
Smith
John Smith
Error
Which of the following statements is not true?
Functions/subroutines are examples of reusable code
Functions and subroutines are always appropriate in programs
Using functions/subroutines make it easier to "deconstruct" a problem into smaller pieces
They can make programs easier to read and understand
What will be the output of code above?
(a)
What will be the output of code above?
(a)
What will be the output of code above?
(a)
Selection uses which command?
While
Repeat Until
IF
x=x+1
what is the formal name in computing for looping?
Iteration
Selection
Repetition
For While Do
X = 20;
Y = 5;
Y = X+Y
X++;
X = 20, Y = 25
X = 20, Y = 5
X = 21, Y = 25
X = 20, Y = 26
What algorithm is this the code for?
Merge Sort
Bubble Sort
Insert sort
Quick sort
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:
creating a hash table for indexing records
creating a linked list for storing records
creating a queue to store records
creating a binary tree to store records
Recursion is a special way of solving problems that can be reduced to similar but smaller problems. Which line is the base case?
54.
in base case, no further recursive call, just return a value to caller
56.
in base case, call the function again
53.
It is the name of the function
What could be the name for section A?
variables
For monitoring values of variables
Call stack
For recording the function calls.
Return address
When the called operations completed and return, this is where it resumes
What could be the name for section B?
variables
For monitoring values of variables
Call stack
For recording the function calls.
Return address
When the called operations completed and return, this is where it resumes
What could be the name for section C?
variables
For monitoring values of variables
Call stack
For recording the function calls.
Return address
When the called operations completed and return, this is where it resumes
For the IDE to show the information like A, B, and C, it needs to be running (multiple)
in Debugging mode
after the program is installed on the computer
in Running with debugging mode
With Breakpoint(s) set up
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)
Running in Debugging mode to identify bugs
context sensitive prompt - to give hints on possible options
Auto-Formatting and auto-indentation to make code organised
Collapse and Expand code sections / blocks to enable different views
