Вы находитесь на странице: 1из 5

1

COMPUTER SCIENCE & APPLICATIONS (NET)


Unit Test: DATA STRUCTURE
Time: 00:50 Hour M.M. : 50

______________________________________________________________________________
INSTRUCTIONS: Attempt all the 25 questions. Each question carry two marks.

1. Consider the following statements


(I) A is an array of integers in non-increasing order. A represents a valid heap.
(II) H is an array representing heap. The elements of H are in non increasing order.
(III) Count sort take O(n3) time to sort n numbers in the range [1........n3]
Which of the above statements are correct.
(a) I (b) II (c) III (d) I, II, III
2. Consider the following statements
(I) O(n2) algorithm is always faster than O(n3) algorithm
(II) The maximum number of nodes possible in a heap of height h is 2h+1–1.
(III) Both heapsort and Quicksort are inplace sorting algorithm.
Which of the above statements are correct?
(a) I, II (b) II, III (c) I, II, III (d) None of these
3. Consider the following statements.
n
(I) The master method can be used to solve the recurrence T  n   n T    n but not for
2

 n 
T  n   2T  n
 n
(II) Suppose you write a program that frequently sorts arrays whose size varies between 5 and 10. You should
do this using merge sort instead of insertion sort since the running time of merge sort   n log n  while insertion

sort is O  n 2  .
Which of the above is correct.
(a) I (b) II (c) I, II (d) None of these
4. Minimum number of comparisions for finding second minimum out of n-elements is
(a) 2(n–1) (b) n + log + 2 (c) n + log n (d) n + log n–2
5. Consider the following statements
(I) Quicksort depends upon whether the partition is balanced or unbalanced. If partition is balanced running
time is   n log n  , however when the partition is unbalanced the running time is   n 2  .

(II) 2n 3    2 n 1  (III) n log n  O  n 3/2 


Which is correct?
(a) I, II (b) I, III (c) II, III (d) I, II, III
H.O.: 28-A/11, Jia Sarai, Near-IIT, New Delhi-16 , Ph : 011-26851008, 26861009 www.careerendeavour.com
B.O.: 48, First Floor, Mall Road, G.T.B. Nagar (Metro Gate No. 3), Delhi-09, Ph: 011-65462244, 9540292991
2

n
6. If T  n   2 n /2 T    2n then T  n   ?
2
(a)   n log n  (b)   2n  (c)   2n log n  (d)   n 2 

7. Consider the following statements


(I) f  n   O f  n 
2

(II) f  n   O  f  n      f  n  

(III) f  n     g  n   and f  n   O  g  n  
Which of the above is correct.
(a) I (b) II (c) I, III (d) II, III

8. If T  n   T  n   log log n then T  n   ?


(a)   log log n  (b)   log n  (c) O  n 2  (d) O  n log log n 

9. If T  n   T  n  2   log n then T  n   ?

(a)   log n  (b)   n log n  (c)   n 2  (d) none of these

10. Consider the following statements


(I) There is some input for which randamized quicksort always runs in   n 2 
(II) There are n people born between the year 0 A.D. and year 2003 A.D. It is possible to sort all of them by
birth date in O(n) time.
(III) The follwoing Array A is min heap:
2, 5, 9, 8, 10, 13, 12, 22, 50
Which of the above is correct.
(a) I, II (b) I, III (c) II, III (d) I, III, II
11. Consider the following statement
(I) Radix sort works correctly if we sort each individual digit with HEAPSORT instead of counting sort.
(II) The 2-3-4 tree is a special case of B tree where leaves can have different paths.
(III) Two determine whether two binary search tree on the same set of keys have identical tree structure, one
could perform inorder tree walk on both and compare the output lists.
Which of the above statements are corrects.
(a) I, II (b) II, III (c) I, III (d) none of these
12. Consider x > 0 and y > 0
x = X, y = Y; u = X; v = Y
while  x  y 
{
if (x > y)
{ x = x – y; u = u + v;
}
else
{ y = y–x; v = v+u;

H.O.: 28-A/11, Jia Sarai, Near-IIT, New Delhi-16 , Ph : 011-26851008, 26861009 www.careerendeavour.com
B.O.: 48, First Floor, Mall Road, G.T.B. Nagar (Metro Gate No. 3), Delhi-09, Ph: 011-65462244, 9540292991
3

} }
xy uv
print   ; print  
 2   2 
The above program print respectively.
(a) GCD(X, Y) and LCM (X, Y) (b) GCD (X, Y) and GCD ( X, Y)
(c) LCM (X, Y) and GCD (X, Y) (d) LCM (X, Y) and LCM (X, Y)
13. Avg number of comparision for successful search for the following tree.
X

Y C

D
Z

A B E F

G
(a) 3.6 (b) 3.2 (c) 3.7 (d) none of these
14. Consider the following program code
int d = 0;
for (int a = 1; a < 11; ++a)
for (int b = 1; b < 11; ++b)
for (int c = 1; c < 11; ++c)
[body]
Consider the 2 body of the program

body 1 body 2
if   a  b  c  %3  0 if   a%2   0  ||   b%3  0  ||   c%4   0 
d  d 1 d  d 1

The value of ‘d’ if the body is body1 and body2 respectively.


(a) 970, 334 (b) 666, 1000 (c) 334, 970 (d) 680, 81
15. The minimum number of interchange need to convert the array 89, 19, 40, 17, 12, 10, 2, 5, 7, 11, 6, 9, 70 into
a heap with the maximum element at the root node is
(a) 0 (b) 1 (c) 2 (d) 3
16. When searching for the key value 60 in a binary search tree. Node containing the key value 10, 20, 40, 50, 80,
90 are traversal, not necessarly in the order given. How many different order are possible in which these key
values can occure on the search path from the root node containing the value 60?
(a) 35 (b) 64 (c) 128 (d) 5040
17. A 3-array tree is a tree in which every internal node has exactly 3 children. The number of leaf nodes in such a
tree with 6 internal nodes will be
(a) 10 (b) 23 (c) 17 (d) 13
18. Assume 5 buffer pages are available to sort a file of 105 pages. The cost of sorting using m-way merge sort is
(a) 206 (b) 618 (c) 840 (d) 926
19. Which one of the following array represents a binary max heap
(a) 50, 40, 30, 20, 1, 100 (b) 100, 50, 1, 20, 30, 40
(c) 100, 50, 40, 30, 20, 1 (d) 100, 50, 40, 1, 30, 20

H.O.: 28-A/11, Jia Sarai, Near-IIT, New Delhi-16 , Ph : 011-26851008, 26861009 www.careerendeavour.com
B.O.: 48, First Floor, Mall Road, G.T.B. Nagar (Metro Gate No. 3), Delhi-09, Ph: 011-65462244, 9540292991
4

20. Suppose a hash table has 20 elements and collision is resolved using linear probing then how many element
must be there in hash table so that the probability of collision is more than 0.5
(a) 5 (b) 8 (c) 10 (d) 11
21. Key values 8, 3, 1, 5, 11, 6, 7, 9 are inserted into a BST in above order. The preorder traversal for the BST.
Which is not possible.
(a) 3, 1, 6, 7, 5, 8, 11, 9 (b) 8, 3, 1, 6, 5, 7, 11, 9
(c) 8, 5, 3, 1, 6, 7, 11, 9 (d) 8, 3, 1, 5, 6, 7, 11, 9
22. Suppose we are sorting an array of 8 integers using quicksort and we have just finished the first partitioning with
array looking as follows 2, 5, 1, 7, 9, 12, 11, 10
Then which can be pivot.
(a) 7 or 9 (b) 7 but not 9 (c) 9 but not 7 (d) neither 7 nor 9
23. How many maxheap tree possible with 4 distinct node?
(a) 2 (b) 3 (c) 4 (d) None of these
24. Given a sorted array A[n] and an integer X. If we write a function that counts the occurence of X in array A.
What is the time complexity.
(a) O(1) (b) O(log n) (c) O(n) (d) none of these
25. Given array of n integers which is initially increasing and then decreasing find the maximum value in the array.
How much time it will take?
(a) O(1) (b) O(log n) (c) O(n) (d) none of these

H.O.: 28-A/11, Jia Sarai, Near-IIT, New Delhi-16 , Ph : 011-26851008, 26861009 www.careerendeavour.com
B.O.: 48, First Floor, Mall Road, G.T.B. Nagar (Metro Gate No. 3), Delhi-09, Ph: 011-65462244, 9540292991
5

COMPUTER SCIENCE & APPLICATIONS (NET)


Unit Test : DATA STRUCTURE

1. (a) 2. (c) 3. (d) 4. (d) 5. (c) 6. (c) 7. (b)


8. (a) 9. (b) 10. (c) 11. (d) 12. (a) 13. (b) 14. (c)
15. (c) 16. (a) 17. (d) 18. (c) 19. (c) 20. (d) 21. (a)
22. (a) 23. (a) 24. (b) 25. (b)

H.O.: 28-A/11, Jia Sarai, Near-IIT, New Delhi-16 , Ph : 011-26851008, 26861009 www.careerendeavour.com
B.O.: 48, First Floor, Mall Road, G.T.B. Nagar (Metro Gate No. 3), Delhi-09, Ph: 011-65462244, 9540292991

Вам также может понравиться