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.

Wednesday, 6 September 2017

Data Structures and Algorithms Multiple Choice Questions - Set 16

151.       If h is any hashing function and is used to hash n keys in to a table of size m, where n<=m, the expected number of collisions involving a particular key x is :
(A) less than 1
(B) less than n
(C) less than m
(D) less than n/2
Answer: A
152.       The worst case of quick sort has order ..............
(A) O(n2)
(B) O(n)
(C) O (n log2 n)
(D) O (log2 n)
Answer: A
153.       Let A be an adjacency matrix of a graph G. The ijth entry in the matrix AK , gives
(A) The number of paths of length K from vertex Vi to vertex Vj.
(B) Shortest path of K edges from vertex Vi to vertex Vj.
(C) Length of a Eulerian path from vertex Vi to vertex Vj.
(D) Length of a Hamiltonian cycle from vertex Vi to vertex Vj.
Answer: B
154.       The OS of a computer may periodically collect all the free memory space to form contiguous block of free space. This is called:
(A) Concatenation
(B) Garbage collection
(C) Collision
(D) Dynamic Memory Allocation
Answer: B
155.       What is the following code segment doing?
void fn( ){
char c;
cin.get(c);
if (c != ‘\n’) {
fn( );
cout.put(c);
}
}
(A) The string entered is printed as it is.
(B) The string entered is printed in reverse order.
(C) It will go in an infinite loop.
(D) It will print an empty line.
Answer: B

156.       You have to sort a list L consisting of a sorted list followed by a few “random” elements.
Which of the following sorting methods would be especially suitable for such a task?
(A) Bubble sort
(B) Selection sort
(C) Quick sort
(D) Insertion sort
Answer: D
157.       B Trees are generally
(A) very deep and narrow
(B) very wide and shallow
(C) very deep and very wide
(D) cannot say
Answer: D
158.       Linked list search complexity is ...............
(A) Ο(1)
(B) Ο(n)
(C) Ο(log n)
(D) Ο(log log n)
Answer: B
159.       If the data collection is in sorted form and equally distributed then the run time complexity of interpolation search is ............
(A) Ο(n)
(B) Ο(1)
(C) Ο(log n)
(D) Ο(log (log n))
Answer: D
160.    A technique for direct search is ............
(A) Binary Search
(B) Linear Search
(C) Tree Search
(D) Hashing
Answer: D


No comments:

Post a Comment