GATE 2015 (Session 2) Computer Science and Information Technology (CS) Questions with Solutions

GATE 2015 (Session 2)

64 questions

MCQ 42 · NAT 221-mark 29 · 2-mark 35

Questions 46–50 of 64

Q47Divide and Conquer2 marksMCQ−0.67 if wrong
Given below are some algorithms, and some algorithm design paradigms.
1. Dijkstra’s Shortest Path 2. Floyd-Warshall algorithm to compute all pairs shortest path 3. Binary search on a sorted array 4. Backtracking search on a graph i. Divide and Conquer ii. Dynamic Programming iii. Greedy design iv. Depth-first search v. Breadth-first search
Match the above algorithms on the left to the corresponding design paradigm they follow.

Q48Dynamic Programming2 marksNAT
A Young tableau is a 2D array of integers increasing from left to right and from top to bottom. Any unfilled entries are marked with ∞\infty, and hence there cannot be any entry to the right of, or below a ∞\infty. The following Young tableau consists of unique entries.
12514346231012182531∞∞∞
When an element is removed from a Young tableau, other elements should be moved into its place so that the resulting table is still a Young tableau (unfilled entries may be filled in with a ∞\infty). The minimum number of entries (other than 1) to be shifted, to remove 1 from the given Young tableau is _______.

Q49Sorting2 marksMCQ−0.67 if wrong
Suppose you are provided with the following function declaration in the C programming language.

int partition(int a[ ], int n);

The function treats the first element of a[] as a pivot, and rearranges the array so that all elements less than or equal to the pivot is in the left part of the array, and all elements greater than the pivot is in the right part. In addition, it moves the pivot so that the pivot is the last element of the left part. The return value is the number of elements in the left part.
The following partially given function in the C programming language is used to find the kthk^{th} smallest element in an array a[ ] of size n using the partition function. We assume k≤nk \leq n
  int kth_smallest(int a[], int n, int k)
{
    int left_end = partition(a,n);
    if ( left_end+1 == k ){
         return a[left_end];
    }
    if ( left_end+1 > k ){
         return kth_smallest( ________ );
    } else {
         return kth_smallest( ________ );
    }
} 

The missing argument lists are respectively

Q50Hashing2 marksMCQ−0.67 if wrong
Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for i ranging from 0 to 2020?

Q51Numerical Solution of Algebraic Equations2 marksMCQ−0.67 if wrong
The secant method is used to find the root of an equation f(x)=0. It is started from two distinct estimates xax_{a} and xbx_{b} for the root. It is an iterative procedure involving linear interpolation to a root. The iteration stops if f(xb)f(x_{b}) is very small and then xbx_{b} is the solution. The procedure is given below. Observe that there is an expression which is missing and is marked by ?. Which is the suitable expression that is to be put in place of ? so that it follows all steps of the secant method?
Secant Initialize: xa, xb, ε, N // ε = convergence indicator // N = maximum no. of iteration fb = f(xb) i = 0 while (i < N and |fb| > ε) do i = i + 1 // update counter xt = ? // missing expression for // intermediate value xa = xb // reset xa xb = xt // reset xb fb = f(xb) // function value at new xb end while if |fb| > ε then // loop is terminated with i=N write “Non-convergence” else write “return xb” end if