NEW
Font size
WorksheetsDSA-Quiz1
Total questions: 12
Worksheet time: 6mins
In which of the following lists, the first node contains a pointer to the last node?
Singly linked lists
Circular linked lists
Doubly linked lists
Doubly circular linked lists
If the sequence of operations performed on a stack is:
push(5), push (10), pop, push (5), pop, pop, push (10), pop,
then what would be the sequence of popped values?
10, 5, 5, 5
10, 5, 5, 10
5, 10, 10, 5
5, 10, 5, 10
Which of the following is the equivalent postfix expression for *+ p q – r s?
pq + rs– *
pq rs + – *
pq + rs* –
pq + – rs*
On which principle does a stack work?
LIFO
FIFO
FCFS
None of the above
Which of the following statements about queues is incorrect?
Queues are first‐in, first‐out (FIFO) data structures
Queues can be implemented using arrays
Queues can be implemented using linked lists
New nodes can only be added at the front of the queue
If you have an empty queue and you insert characters ‘r’, ‘a’, ‘t’ (in this order only), what is the order of the characters when you dequeue all the elements?
‘r’, ‘a’, ‘t’
‘t’, ‘a’, ‘r’
‘r’, ‘t’, ‘a
‘t’, ‘r’, ‘a’
Which of the following is most suitable data structure to implement trees?
Arrays
Linked lists
Stacks
Queues
Which of the following statements is true for binary search trees?
a) The left subtree of a node contains only nodes with keys less than the node's key
b) The right subtree of a node contains only nodes with keys greater than the node's key
c) Both left and right subtree nodes contains only nodes with keys less than the node's key
Both a) and b) are correct
Which of the following traversals is used in in‐order traversal?
root ‐> left subtree ‐> right subtree
root ‐> right subtree ‐> left subtree
left subtree ‐> root ‐> right subtree
right subtree ‐> left subtree ‐> root
The height of a binary tree is the total number of nodes on the path from the root node to the deepest node in the tree.
The maximum number of nodes in a binary tree of height h is
2h−1
2h−1 − 1
2h−1
2*(h+1)
O-notation provides an asymptotic
Lower bound
Upper bound
Tight bound
None of the above
Compute the time complexity of the following function written in C.
void function(int n) {
int i, count = 0;
for (i=1; i*i<=n ; i++)
count++;
}
O(n)
O( n2 )
O( n )
O(log n)
