# Data structure and algorithm MCQ’s Chapter 02

Posted by

Data structure and algorithm MCQ’s with answers.

21. The depth of a complete binary tree is given by
(A) Dn = n log2n
(B) Dn = n log2n+1
(C) Dn = log2n
(D) Dn = log2 n+1

22. The complexity of Binary search algorithm is
(A) O(n)
(B) O(log )
(C) O(n log n)
(D) None of the above

23. The complexity of Bubble sort algorithm is
(A) O(n)
(B) O (n2)
(C) O(n log n)
(D) None of the above

24. When in order traversing a tree resulted E A C K F H D B G; the preorder traversal would return
(A) FAEKCDBHG
(B) FAEKCDHGB
(C) EAFKHDCBG
(D) FEAKDCHBG

25. When representing any algebraic expression E the following uses only binary operations in a 2-tree
(A) the variable in E will appear as external nodes and operations in internal nodes
(B) the operations in E will appear as external nodes and variables in internal nodes
(C) the variables and operations in E will appear only in internal nodes
(D) None of the above

26. When converting binary tree into extended binary tree, all the original nodes in binary tree are
(A) internal nodes on extended tree
(B) external nodes on extended tree
(C) vanished on extended tree
(D) None of the above

27. The post order traversal of a binary tree is DEBFCA. Find out the pre order traversal
(A) ABFCDE
(C) ABDECF
(D) None of the above

28. Which of the following data structure is linear data structure?
(A) Trees
(B) Graphs
(C) Arrays
(D) None of the above

29. The operation of processing each element in the list is known as
(A) Merging
(B) Inserting
(C) Traversal
(D) All the above

30. Finding the location of the element with a given value is called
(A) Traversal
(B) Search
(C) Sort
(D) All of the above

31. Arrays are best data structures for
(A) relatively permanent collections of data
(B) the size of the structure and the data in the structure are constantly changing
(C) both of above situation
(D) none of above situation

32. Linked lists are best suited for
(A) relatively permanent collections of data
(B) the size of the structure and the data in the structure are constantly changing
(C) both of above situation
(D) none of above situation

33. Each array declaration need not give, implicitly or explicitly, the information about the
(A) name of array
(B) data type of array
(C) first data from the set to be stored
(D) index set of the array

34. The complexity of merge sort algorithm is
(A) O(n)
(B) O(log n)
(C) O(n log n)
(D) None of these

35. The indirect change of the values of a variable in one module by another module is called
(A) internal change
(B) inter-module change
(C) side effect
(D) all the above

36. Two main measures for the efficiency of an algorithm are
(A) Time and space
(B) Processor and memory
(C) Complexity and capacity
(D) Data and space

37. The time factor when determining the efficiency of algorithm is measured by
(A) Counting the number of key operations
(B) Counting the number of statements
(C) Counting the kilobytes of algorithm
(D) None of the above

38. The space factor when determining the efficiency of algorithm is measured by
(A) Counting the maximum memory needed by the algorithm
(B) Counting the minimum memory needed by the algorithm
(C) Counting the average memory needed by the algorithm
(D) Counting the maximum disk space needed by the algorithm

39. All the above* Which of the following data structures are indexed structures
(A) linear arrays
(C) both of above
(D) none of above

40. Which of the following is not the required condition for binary search algorithm
(A) there must be mechanism to delete and/ or insert elements in list
(B) the list must be sorted
(C) there should be the direct access to the middle element in any sublist
(D) none of the above

21. (D) 22. (B) 23. (B) 24. (B) 25. (A)
26. (A) 27. (C) 28. (C) 29. (C) 30. (B)
31. (A) 32. (B) 33. (C) 34. (C) 35. (C)
36. (A) 37. (A) 38. (A) 39. (A) 40. (A)