NEW
Font size
WorksheetsData Structures
Total questions: 20
Worksheet time: 6mins
What is the postfix expression for the following expression tree?
a)abcde++**
b)ab+cde+**
c)abc+de+**
d)abcd+*e+*
Which of the following application makes use of a circular linked list?
a) Recursive function calls
b) Undo operation in a text editor
c) Implement Hash Tables
d) Allocating CPU to resources
The leaves of an expression tree always contain?
a) operators
b) operands
c) null
d) expression
Figure below is a balanced binary tree. If a node S inserted as child of the node R, how many nodes will become unbalanced?
a)2
b)1
c)0
d)3
Which of the following properties are obeyed by all three tree – traversals?
a) Left subtrees are visited before right subtrees
b) Right subtrees are visited before left subtrees
c) Root node is visited before left subtree
d) Root node is visited before right subtree
What operation does the following diagram depict?
a) inserting a leaf node
b) inserting an internal node
c) deleting a node with 0 or 1 child
d) deleting a node with 2 children
Construct a binary tree using the following data.
The preorder traversal of a binary tree is 1, 2, 5, 3, 4. The inorder traversal of the same binary tree is 2, 5, 1, 4, 3.
a
b
c
d
Which of the following points is/are not true about Linked List data structure when it is compared with an array?
a) Arrays have better cache locality that can make them better in terms of performance
b) It is easy to insert and delete elements in Linked List
c) Random access is not allowed in a typical implementation of Linked Lists
d) Access of elements in linked list takes less time than compared to arrays
What is the number of moves required to solve Tower of Hanoi problem for k disks?
a) 2k – 1
b) 2k + 1
c) 2k + 1
d) 2k – 1
Given an empty AVL tree, how would you construct AVL tree when a set of numbers are given without performing any rotations?
a) just build the tree with the given input
b) find the median of the set of elements given, make it as root and construct the tree
c) use trial and error
d) use dynamic programming to build the tree
A normal queue, if implemented using an array of size MAX_SIZE, gets full when?
a) Rear = MAX_SIZE – 1
b) Front = (rear + 1)mod MAX_SIZE
c) Front = rear + 1
d) Rear = front
Which of the following data structures is best suited for implementing a stack?
a) Array
b) Linked List
c) Queue
d) Tree
Which of the following rotations is called double rotation?
a)RR and LR
b)LL and RL
c)LL and RR
d)LR and RL
What does the following piece of code do?
public void func(Tree root) {
func(root.left());
func(root.right());
System.out.println(root.data()); }
a) Preorder traversal
b) Inorder traversal
c) Postorder traversal
d) Level order traversal
Evaluate postfix expression
2 3 1 * + 9 -
a)-4
b)8
c)4
d)6
How many null pointers exists in a circular linked list?
a)0
b)1
c)2
d)3
How will you find the minimum element in a binary search tree?
a)public void min(Tree root) {
while(root.left() != null) { root = root.left(); } System.out.println(root.data()); }
b)public void min(Tree root) { while(root != null) { root = root.left(); } System.out.println(root.data()); }
c)public void min(Tree root) { while(root.right() != null) { root = root.right(); } System.out.println(root.data()); }
d)public void min(Tree root) { while(root != null) { root = root.right(); } System.out.println(root.data()); }
Evaluate and write the result for the following postfix expression
abc*+de*f+g*+ where a=1, b=2, c=3, d=4, e=5, f=6, g=2.
a)61
b)59
c)60
d)55
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?
a) ABCD
b) DCBA
c) DCAB
d) ABCD
In linked list implementation of a queue, where does a new element be inserted?
a) At the head of link list
b) At the tail of the link list
c) At the centre position in the link list
d) None
