Computer Science Study Materials for Competitive Exams

Sample Questions, Previous Year Solved Papers, Study Materials For Competitive Examinations Like UGC NET, SET And GATE Computer Science.

Thursday, 17 August 2017

Data Structures and Algorithms Multiple Choice Questions - Set 1

1.       In the deletion operation of max heap, the root is replaced by:
(A) next available value in the left sub-tree.
(B) next available value in the right sub-tree.
(C) first element of the last level
(D) last element of the last level
Answer: D
2.       Which of the following algorithm does not divide the list?
(A) merge sort
(B) binary search
(C) linear search
(D) quick sort
Answer: C
3.       At most, how many comparisons are required to search a sorted vector of 1023 elements using the binary search algorithm?
(A) 10
(B) 15
(C) 20
(D) 30
Answer: A
4.       For implementing recursive function the data structure used is:
(A) Stack
(B) Queue
(C) Linked List
(D) Tree
Answer: A
For implementing recursive function, stack is used as a data structure.
5.       Which of the following is an example of in-place algorithm?
(A) Bubble Sort
(B) Merge Sort
(C) Insertion Sort
(D) None of the above
Answer: B

6.       The postfix form of the following infix notation is : (A + B)* (C*D − E)* F
(A) AB + CD*E − *F*
(B) AB+ CDE + − * F*
(C) AB+ CD − EF + − **
(D) ABCDEF* − + * +
Answer: A
7.       The number of nodes in a complete binary tree of depth d (with root at depth 0) is
(A) 2d−1 +1
(B) 2d+1 -1
(C) 2d−1 -1
(D) 2d+1 +1
Answer: B
8.       What are the sequence of popped out values if the sequence of operations - push(1), push(2), pop, push(1), push(2), pop, pop, pop, push(2), pop are performed on a stack.
(A) 2, 2, 1, 1, 2
(B) 2, 2, 1, 2, 2
(C) 2, 1, 2, 2, 1
(D) 2, 1, 2, 2, 2
Answer: A
9.       In conversion from prefix to postfix using stack data-structure, if operators and operands are pushed and popped exactly once, then the run-time complexity is ............
(A) Ο(1)
(B) Ο(n)
(C) Ο(log n)
(D) Ο(n2)
Answer: B
10.    The average case of quick sort has order
(A) O(n2)
(B) O(n)
(C) O(n log n)
(D) O(log n)
Answer: C

No comments:

Post a Comment