data structure63637
data structure63637
(A
+ B ⋀D)/(E – F)+G
a) (A B D ⋀ + E F – /G +) b) (A B D +⋀ E F – / G +) c) (A B D ⋀ + E F/- G +) d)
(A B D E F + ⋀ /G+)
4. In the worst case, the number of comparisons needed to search a singly linked
list of length n for a given element is?
a) log 2n b) n⁄2 c) log 2n – 1 d) n
5. If several elements are competing for the same bucket in the hash table, what is
it called?
a) Diffusion b) Replication c) Collision d) Duplication
9. Suppose we are sorting an array of eight integers using quicksort, and we have
just finished the first partitioning with the array looking like this:
2 5 1 7 9 12 11 10 Which statement is correct?
a) The pivot could be either the 7 or the 9. b) The pivot could be the 7, but it is not
the 9 c) The pivot is not the 7, but it could be the 9 d) Neither the 7 nor the 9 is the
pivot
10. Consider a situation where swap operation is very costly. Which of the
following sorting algorithms should be preferred so that the number of swap
operations are minimized in general?
a) Heap Sort b) Selection Sort c) Insertion Sort d) Merge Sort
13. In the worst case, the number of comparisons needed to search a singly linked
list of length n for a given element is?
a) log 2 n b) n⁄2 c) log 2 n – 1 d) n
14. To implement a stack using queue (with only enqueue and dequeue operations),
how many queues will you need?
a) 1 b) 2 c) 3 d) 4
15. The optimal data structure used to solve Tower of Hanoi is _________
a) Tree b) Heap c) Priority queue d) Stack
16. Assume that the operators +, -, X are left associative and ^ is right associative.
The order of precedence (from highest to lowest) is ^, X, +, -. The postfix
expression for the infix expression a + b X c – d ^ e ^ f is?
a) abc X+ def ^^ – b) abc X+ de^f^ – c) ab+c Xd – e ^f^ d) ) -+aXbc^ ^def
19. What is the number of edges present in a complete graph having n vertices?
a) (n*(n+1))/2 b) (n*(n-1))/2 c) n d) Information given is insufficient
20. If several elements are competing for the same bucket in the hash table, what is
it called?
a) Diffusion b) Replication c) Collision d) Duplication
22. What is the output of following function for start pointing to first node of
following linked
list? 1 -->2 -->3 -->4 -->5 -->6
void fun(struct node* start)
{
if(start == NULL)
return;
printf("%d ", start -->
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
25. In a complete k ary tree, every internal node has exactly k children or no child.
The number of leaves in such a tree with n internal nodes is:
a) nk b) (n -1) k+ 1 c) n( k- 1) + 1 d) n(k -1)
26. If a node in a Binary search tree has two children, then its inorder predecessor
has .........
a) No child b) No left child c) No right child d) Two children
27. Using Bubble sort, the number of interchanges required to sort 5, 1, 6, 2 and 4
in ascending order is...........
a) 7 b) 5 c) 8 d) 6
30. The data structure used in the breadth first search algorithm is ...........
a) queue b) stack c) heap d) hash table