DS Bits
DS Bits
S.No Choose the correct alternative answer for the following question
1. Which of the following points is/are true about Linked List data structure when [ D ]
it is compared with 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) All of the above
2. In the worst case, the number of comparisons needed to search a singly linked [ D ]
list of length n for a given element is
(a) log 2 n (b) n/2
(c) log 2 n – 1 (d) n
3. The following postfix expression with single digit operands is evaluated using a [ A ]
stack:
823^/23*+51*-
Note that ^ is the exponentiation operator. The top two elements of the stack after
the first * is evaluated are:
(a) 6,1 (b) 5,7
(c) 3,2 (d) 1,5
4. Minimum number of fields in each node of a doubly linked list is ________. [ B ]
(a) 2 (b) 3
(c) 4 (d) None
5. What is a hash table? [ B ]
(a)A structure that maps values to keys
(b) A structure that maps keys to values
(c) A structure used for storage
(d) A structure used to implement stack and queue
6. If several elements are competing for the same bucket in the hash table, what is [ C ]
it called?
(a) Diffusion (b) Replication
(c) Collision (d) None
7. The nodes in a skip list may have many forward references. their number is [ A ]
determined
(a)probabilistically (b) randomly
(c)orthogonally (d) sequentially
8. What is the hash function used in Double Hashing? [ C ]
(a)(h1(k) – i*h2(k))mod m (b) h1(k) + h2(k)
(c) (h1(k) + i*h2(k))mod m (d) (h1(k) + h2(k))mod m
9. How many children does a binary tree have? [ C ]
(a) 2 (b) any number
(c) 0 or 1 or 2 (d) 0 or 1
10. The number of edges from the root to the node is called __________ of the tree. [ C ]
(a) Height (b) Depth
(c) Length (d) Width
11 Which of the following data structure can’t store the non-homogeneous data [ A ]
elements?
(a) Arrays (b) Records
(c) Pointers (d) Stacks
12. What is the output of following function for start pointing to first node of [ D ]
following linked list?
1->2->3->4->5->6
void fun(struct node* start)
{
if(start == NULL)
return;
printf("%d ", start->data);
if(start->next != NULL )
fun(start->next->next);
printf("%d ", start->data);
}
(a) 1 4 6 6 4 1 (b) 1 3 5 1 3 5
(c) 1 2 3 5 (d) 1 3 5 5 3 1
13. Which one of the following is an application of Stack Data Structure? [ D ]
(a)Managing function calls (b) The expression conversion
(c) Arithmetic expression evaluation (d) All of the above
14. . ……… form of access is used to add and remove nodes from a queue. [ B ]
(a) LIFO, Last In First Out (b) FIFO, First In First Out
(c) Both a and b (d) None of the above
15. Which of the following is the efficient data structure for searching words in [ D ]
dictionaries?
(a) BST (b) Linked List
(c) Balanced BST (d) Trie
16. What is a hash function? [ B ]
(a)A function has allocated memory to keys
(b)A function that computes the location of the key in the array
(c) A function that creates an array
(d) None of the mentioned
17. What is the hash function used in the division method? [ B ]
(a) h(k) = k/m (b) h(k) = k mod m
(c) h(k) = m/k (d) h(k) = m mod k