Font size
WorksheetsData structure A2 mmd
Total questions: 111
Worksheet time: 1hrs 10mins
Which of these is not a data structure?
Stack
Array
Integer
List
Which of these are operations of a stack?
Push
Add
Remove
Pop
A stack is last in, "what" out?
(a)
A queue is what?
Last in, first out
First in, first out
First in, last out
Last in, last out
What is the value of the ROOT node in this Tree?
35
24
42
20
In this tree, where would the new value "7" be placed?
On the left branch of "4"
On the right branch of "6"
On the left branch of "15"
Over the top of the current number "5"
What is returned by values[5]?
9
12
6
8
{2, 3, 5, 8, 9, 11};
How would you access the fourth element in nums
If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed?
ABCD
DCBA
DCAB
ABDC
Consider the following operation performed on a stack of size 5.
Push(1);
Pop();
Push(2);
Push(3);
Pop();
Push(4);
Pop();
Pop();
Push(5);
After the completion of all operation, the no of element present on stack are
1
3
2
4
Records allow you to store more than one data type
True
False
What advantage does a linked list have over an array?
Size of the list doesn't need to be mentioned at the beginning of the program
You can add or remove elements from the middle of the list.
The linked list doesn't have a size limit
All of these are true.
A hash table is
an abstract data structure
an array
an integer
made of pine
when an algorithm generates the same address for different primary keys it is known as
Knock
Bang
Collisions
DoubleHash
Hashing gives each item
A sequential address
A logarithmic address
No address
A unique address
When a collision occurs with a hashing function, what is one method for dealing with the collisions?
creating a new linked list at that index
creating a new array
creating a new hash table
creating a new binary tree
If the insertion and deletion happens from both the ends then the queue is called a______Queue
a) Deque
b) Header
c) Queue
d) Circular Queue
Process of inserting an element in stack is called ____________
Create
Push
Evaluation
Pop
Entries in a stack are “ordered”. What is the meaning of this statement?
A collection of stacks is sortable
Stack entries may be compared with the ‘<‘ operation
The entries are stored in a linked list
There is a Sequential entry that is one by one
Which of the following applications may use a stack?
a) A parentheses balancing program
b) Tracking of local variables at run time
c) Compiler Syntax Analyzer
d) Data Transfer between two asynchronous process
The data structure required to check whether an expression contains balanced parenthesis is?
a) Stack
b) Queue
c) Array
d) Tree
What does the following function do for a given Linked List with first node as head?
void fun1(struct node* head)
{
if(head == NULL)
return;
fun1(head->next);
printf("%d ", head->data);
}
a) Prints all nodes of linked lists
b) Prints all nodes of linked list in reverse order
c) Prints alternate nodes of Linked List
d) Prints alternate nodes in reverse order
Linked list data structure offers considerable saving in _____________
a) Computational Time
b) Space Utilization
c) Space Utilization and Computational Time
d) Speed Utilization
To represent hierarchical relationship between elements, Which data structure is suitable?
Dequeue
Priority
Tree
Graph
Match the following.
a) Completeness i) How long does it take to find a solution
b) Time Complexity ii) How much memory need to perform the search.
c) Space Complexity iii) Is the strategy guaranteed to find the solution when there in one.
a-iii, b-ii, c-i
a-i, b-ii, c-iii
a-iii, b-i, c-ii
a-i, b-iii, c-ii
Efficiency of an algorithm is measured by
Time and Capacity complexity
Time and Space complexity
Speed and Space complexity
Speed and Capacity complexity
Almost all programming languages start arrays at ___
index 0
index 1
index 2
the null character
In a tree data structure, the top most node is called ___
the peak
the apex
the crown
the root
In a tree data structure, any nodes that hang from other nodes are called ___
branched nodes
leaf nodes
children nodes
daughter nodes
Which of the following options is not true about the Binary Search tree?
The value of the left child should be less than the root node
The value of the right child should be greater than the root node
The left and right sub trees should also be a binary search tree
None of the above
What is the maximum number of children that a node can have in a binary tree?
3
1
4
2
The maximum number of nodes in a binary tree of depth 5 is
31
16
32
15
To perform level-order traversal on a binary tree, which of the
following data structure will be required?
Hash table
Queue
Binary search tree
Stack
Which of the following is non-liner data structure?
Stacks
List
Strings
Trees
The no of external nodes in a full binary tree with n internal nodes is?
n
n+1
2n
2n+1
A Binary Tree can have
Can have 2 children
Can have 1 children
Can have 0 children
All of the above
Which of these tree traversal methods is used to output the contents of a binary tree in ascending order?
Pre-Order
In-Order
Post-Order
Monastic Orders
In preorder traversal of a binary tree the second step is ____________
traverse the right subtree
traverse the left subtree
traverse right subtree and visit the root
visit the root
What does the term immutable mean?
unable to be changed
unable to speak
can be modified
can be increased in size
What is a tuple?
A data value which can be modified.
A data value which cannot be modified.
An immutable data structure that contains related elements.
A data structure that can only hold 3 elements.
Which data structure cannot have elements of different data types?
Array
Tuple
Record
Stack
Queue
What are the 3 depth traversals for a tree data structure?
Pre-, In- and Post-order
Pro-, In- and Past-order
Pre-, Out- and Post-order
Pre-, In- and New-order
There are two types of data structures, they are
Static and dynamic
Fast and slow
Large and small
Ascending and descending
When traversing a binary tree, which diagram is post-order?
When traversing a binary tree, which diagram is pre-order?
What is caused by attempting to push another item onto the top of a full stack?
Underflow error
Overload error
Overflow error
Catastrophic error
Look at the diagram of the stack. What would the stack look like after the following operations were called:
peek()
pop()
push("yellow")
If you have a stack containing 'A' 'D' 'G' . What will happen if you push 'C' into the stack?
'C' Will be added on top of the stack
'C' Will be added from the bottom of the stack
'C' Will be removed from the stack
'C' Will not be added to the stack
A stack containing 'Dog' 'Cat' & 'Rat' . What will happen if you carry out a pop operation on the stack ?
Noting
Cat will be removed
Dog will be removed
Rat will be removed
If you carry out a pop operation on this stack what will you be left with?
What will happen if you carry out a push operation with the word 'Bill'?
When an interrupt is dealt with, what operation takes place to the last added instruction.
Pop
Pull
Multiplied
Added
What two operations do Queues require?
Add
Push
Remove
Pop
Given a binary search tree, insert 27, 15, 63, 99, 70 and 85 (in this order) into the binary search tree. What is the post-order traversal?
5,15,27,34,47,54,63,70,72,75,83,85,88,94,99,101
72,54,34,5,27,15,47,63,70,83,75,88,85,101,94,99
15,27,5,47,34,70,63,54,75,85,99,94,101,88,83,72
15,27,5,47,34,63,54,70,75,85,99,94,101,88,83,72
none of the above
Consider two Deques with the same element type, A and B, and let B be empty.
To move everything from A to B and reverse order, which of these can be used in a loop? Select all that apply.
B.offerFirst(A.pollFirst());
B.offerFirst(A.pollLast());
B.offerLast(A.pollFirst());
B.offerLast(A.pollLast());
Consider two Deques with the same element type, A and B, and let B be empty.
To move everything from A to B and preserve order, which of these can be used in a loop? Select all that apply.
B.offerFirst(A.pollFirst());
B.offerFirst(A.pollLast());
B.offerLast(A.pollFirst());
B.offerLast(A.pollLast());
Deque<Integer> d = [1,2,3].
d.offerFirst(d.pollLast());
What is the value of d?
[1,2,3]
[2,3,1]
[3,1,2]
[3,2,1]
What is the time complexity of this algorithm?
O(n)
O(2n)
O(log n)
O(n2)
O(1)
What is the time complexity of this algorithm?
O(n)
O(2n)
O(log n)
O(n2)
O(1)
What is the time complexity of this algorithm?
O(n)
O(2n)
O(log n)
O(n2)
O(1)
What is the time complexity of this algorithm?
O(n)
O(2n)
O(log n)
O(n2)
O(1)
What is the time complexity of this algorithm?
O(n)
O(2n)
O(log n)
O(n2)
O(1)
What is the Big-O Notation of "Divide & Conquer" Algorithms?
O(n)
O(2n)
O(log n)
O(n2)
O(1)
What is the Big-O Notation of a combination lock with 4 digits, each digit having 1 of 10 possible values?
O(n)
O(10n)
O(log n)
O(n2)
O(1)
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)?
O(n)
O(n!)
O(log n)
O(n2)
O(1)
What order of complexity does this graph represent?
Exponential
Polynomial
Linear
Logarithmic
What order of complexity does this graph represent?
Exponential
Polynomial
Linear
Logarithmic
What order of complexity does this graph represent?
Exponential
Polynomial
Linear
Logarithmic
What order of complexity does this graph represent?
Exponential
Polynomial
Linear
Logarithmic
Which of these problems are solved by algorithms?
Routing
Encryption
Sorting
Searching
All of the other four.
What order of complexity does this graph represent?
Exponential
Polynomial
Linear
Constant
Which of these is an example of decomposition?
Break a program into procedures and functions
Break a complex problem into modules using top down design
Use a pre-written library of procedures and functions to perform operations such as sorting and searching.
Subdividing a problem into smaller tasks that different teams can work on independently.
Ignore the colour of a player token in a snakes ladder game model.
Which of these is an example of abstraction?
The layers in a network protocol stack
Break a complex problem into modules using top down design
Use a pre-written library of procedures and functions to perform operations such as sorting and searching.
Subdividing a problem into smaller tasks that different teams can work on independently.
Ignore the colour of a player token in a snakes ladder game model.
Which of these is true about abstraction?
The relevant details depend on what is being modeled.
The unimportant details are ignored
The relevant details depend on your opinion.
An 8 bit integer is an abstraction of a whole number.
Logic gates are an abstraction of transistor logic circuits.
Which of these are true about algorithms?
The steps/instructions can be ambiguous
The lowest level of the algorithm can be expressed any way as long as the instruction/step is clear and can be treated as a simple computational process.
Algorithms rely heavily on syntax
Algorithms are about expressing thinking steps not syntax
Python like code cannot be used to write an algorithm
Define the term computational thinking
Using a computer
Developing an algorithm to solve a problem
Making a computer use artificial intelligence
Google is computational thinking
Solving a problem using a computer
Define the term abstraction within computational thinking
Adding numbers together
Taking a real world problem and designing a computer program that exactly replicates every part of that problem in the computer
Representing real world problems in a computer program, using symbols and removing unnecessary element
Performing multiple calculations on a list of variables
What is the correct Big O notation for an algorithm where the number of operations (steps) can be expressed as:
4, n, cubed, plus, 3, n, log, base, 2, n, plus, 273,
n is the size of the input.
O(n2)
O(3n)
O(log2n)
O(273)
O(n3)
What is the goal of a hash table?
To compare items in a data set
To store all the data items
To immediately find an item without comparing other items
To implement a dictionary data structure
What is a hashing function used for?
To calculate the position of an item in a hash table
To determine the size of a hash table
To compare items in a data set
To implement a dictionary data structure
What is chaining in a hash table?
Storing items in a linked list
Using a two-dimensional hash table
Searching sequentially in an overflow table
Finding an alternative position for items in the hash table
What is the typical use of a hash table?
Linking a file name to the file path
Sorting a large dataset
Performing calculations on a data set
Creating a dictionary data structure
What are the three basic operations that can be performed on a hash table?
Adding a value, deleting a value, retrieving a value
Sorting a value, searching a value, updating a value
Copying a value, moving a value, renaming a value
Creating a value, reading a value, updating a value
What is the advantage of using a larger hash table?
It reduces the chance of collisions
It speeds up the hashing function
It allows for more efficient linear probing
It minimizes the memory footprint
What is the purpose of a two-dimensional hash table?
To store multiple items at the same position
To prevent collisions in a hash table
To speed up the hashing function
To reduce the memory footprint
What is the purpose of a linked list in a hash table?
To store items that cannot be placed in the hash table
To prevent collisions in a hash table
To speed up the hashing function
To reduce the memory footprint
What is the purpose of an overflow table in a hash table?
To store items that cannot be placed in the hash table
To prevent collisions in a hash table
To speed up the hashing function
To reduce the memory footprint
address = key MOD(numberOfSlots)
If key = 5432 and numberOfSlots = 1000
address = ?
5
432
543
5432
What is the status after adding 10
Which mathematical function do all hashing algorithms use?
MOD
DIV
EXP
COS
RAND
The goal of hashing is to produce a search that takes
O(1) time
O(n2 )time
O(log n ) time
O(n log n ) time
Divide the item into equal-size pieces
Add the pieces together
Perform the mod step to get an address
Which hashing method does this describe
folding method
alphanumeric
mid-square
mod
What is the worst-case runtime of lookUp/get in a binary search tree?
O(n)
O(logn)
O(1)
O(n2)
An array with 16 elements is input to a binary search algorithm. How many maximum number of comparisons are performed?
1
2
3
4
5
If I deleted the root from the Binary Search Tree what could I replace it with?
7
14
3
1
