1
GATE CSE 2014 Set 3
MCQ (Single Correct Answer)
+2
-0.6
Consider the C function given below. Assume that the array listA contains n (> 0) elements, sored in ascending order.
int ProcessArray(int *listA, int x, int n) 
{ 
      int i, j, k; 
      i = 0; 
      j = n-1; 
      do 
      { 
         k = (i+j)/2; 
         if (x <= listA[k]) 
           j = k-1; 
         if (listA[k] <= x) 
           i = k+1; 
      } 
      while (i <= j); 
      if (listA[k] == x) 
           return(k); 
      else 
           return -1; 
}
Which one of the following statements about the function ProcessArray is CORRECT?
A
It will run into an infinite loop when x is not in listA
B
It is an implementation of binary search.
C
It will always find the maximum element in listA.
D
It will return −1 even when X is present in listA.
2
GATE CSE 2014 Set 3
Numerical
+1
-0
Suppose depth first search is executed on the graph below starting at some unknown vertex. Assume that a recursive call to visit a vertex is made only after first checking that the vertex has not been visited earlier. Then the maximum possible recursion depth (including the initial call) is _________. GATE CSE 2014 Set 3 Data Structures - Graphs Question 22 English
Your input ____
3
GATE CSE 2014 Set 3
MCQ (Single Correct Answer)
+2
-0.6
Consider a hash table with 100 slots. Collisions are resolved using chaining. Assuming simple uniform hashing, what is the probability that the first 3 slots are unfilled after the first 3 insertions?
A
97 × 97 × 97)/1003
B
(99 × 98 × 97)/1003
C
(97 × 96 × 95)/1003
D
(97 × 96 × 95)/(3! × 1003)
4
GATE CSE 2014 Set 3
Numerical
+2
-0
Suppose we have a balanced binary search tree T holding n numbers. We are given two numbers L and H and wish to sum up all the numbers in T that lie between L and H. Suppose there are m such numbers in T. If the tightest upper bound on the time to compute the sum is O( na logb n + mc logd n ), the value of a + 10b + 100c + 1000d is _______.
Your input ____
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
CBSE
Class 12