Data Structures and Algorithms Multiple Choice Questions - Set 12

111.       A sorted file contains 16 items. Using binary search, the maximum number of comparisons to search for an item in this file is ...........
(A) 15
(B) 8
(C) 1
(D) 4
Answer: D
112.       Which of the following is not possible with an array in C programming language?
(A) Declaration
(B) Definition
(C) Dynamic Allocation
(D) Array of strings
Answer: C
113.       One can determine whether an infix expression has balanced parenthesis or not by using .............
(A) Array
(B) Queue
(C) Stack
(D) Tree
Answer: C
114.       An adaptive sorting algorithm ..............
(A) adapts to new computers
(B) takes advantage of already sorted elements
(C) takes input which is already sorted
(D) None of these
Answer: B
115.       The average number of key comparisons done in successful sequential search in a list of length n is ..............
(A) log n
(B) (n-1)/2
(C) n/2
(D) (n+1)/2
Answer: D
116.       What are the time complexities of finding 8th element from beginning and 8th element from end in a singly linked list? Let n be the number of nodes in linked list, you may assume that n>8.
(A) O(n) and O(n)
(B) O(1) and O(1)
(C) O(n) and O(1)
(D) O(1) and O(n)
Answer: D
117.       Recursion is memory-intensive because:
(A) Recursive functions tend to declare many local variables.
(B) Previous function calls are still open when the function calls itself and the activation records of these previous calls still occupy space on the call stack.
(C) Many copies of the function code are created.
(D) It requires large data values.
Answer: B
118.       The maximum number of nodes in a binary tree of depth 5 is ...............
(A) 31
(B) 16
(C) 32
(D) 15
Answer: A
119.       Travelling salesman problem is an example of ...................
(A) Dynamic Algorithm
(B) Greedy Algorithm
(C) Recursive Approach
(D) Divide & Conquer
Answer: B
120.    In a min-heap:
(A) parent nodes have values greater than or equal to their Childs
(B) parent nodes have values less than or equal to their Childs
(C) both statements are true
(D) both statements are wrong
Answer: A

Post a Comment