Algorithms questions

Q13

GATE CS 2014 CS-2Algorithm AnalysisMCQ1 mark−1/3 if wrong
Which one of the following correctly determines the solution of the recurrence relation with T(1)=1T(1) = 1?

T(n)=2T(n2)+log⁡nT(n) = 2T\left(\frac{n}{2}\right) + \log n
Show answer without attempting

Answer: A

Q14

GATE CS 2014 CS-2Graph AlgorithmsMCQ1 mark−1/3 if wrong
Consider the tree arcs of a BFS traversal from a source node W in an unweighted, connected, undirected graph. The tree T formed by the tree arcs is a data structure for computing
Show answer without attempting

Answer: B

Q19

GATE CS 2014 CS-2Algorithm DesignMCQ1 mark−1/3 if wrong
Which one of the following is TRUE?
Show answer without attempting

Answer: C

Q37

GATE CS 2014 CS-2Algorithm DesignNAT2 marks
Consider two strings AA = "qpqrr" and BB = "pqprqrp". Let xx be the length of the longest common subsequence (not necessarily contiguous) between AA and BB and let yy be the number of such longest common subsequences between AA and BB. Then x+10yx + 10y = ___.
Show answer without attempting

Answer: 34

Q38

GATE CS 2014 CS-2Algorithm DesignNAT2 marks
Suppose P, Q, R, S, T are sorted sequences having lengths 20, 24, 30, 35, 50 respectively. They are to be merged into a single sequence by merging together two sequences at a time. The number of comparisons that will be needed in the worst case by the optimal algorithm for doing this is ____.
Show answer without attempting

Answer: 358

Q13

GATE CS 2014 CS-3Graph AlgorithmsNAT1 mark
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 _________.
Question figure
Show answer without attempting

Answer: 19

Q14

GATE CS 2014 CS-3Searching Sorting and HashingMCQ1 mark−1/3 if wrong
You have an array of nn elements. Suppose you implement quicksort by always choosing the central element of the array as the pivot. Then the tightest upper bound for the worst case performance is
Show answer without attempting

Answer: A

Q37

GATE CS 2014 CS-3Algorithm DesignNAT2 marks
Suppose you want to move from 0 to 100 on the number line. In each step, you either move right by a unit distance or you take a shortcut. A shortcut is simply a pre-specified pair of integers i,ji, j with i<ji < j. Given a shortcut i,ji, j if you are at position ii on the number line, you may directly move to jj. Suppose T(k)T(k) denotes the smallest number of steps needed to move from kk to 100. Suppose further that there is at most 1 shortcut involving any number, and in particular from 9 there is a shortcut to 15. Let yy and zz be such that T(9)=1+min⁡(T(y),T(z))T(9) = 1 + \min(T(y), T(z)). Then the value of the product yzyz is _____.
Show answer without attempting

Answer: 150

Q38

GATE CS 2014 CS-3Graph AlgorithmsMCQ2 marks−2/3 if wrong
Consider the decision problem 2CNFSAT defined as follows:

{Φ∣Φ is a satisfiable propositional formula in CNF with at most two literals per clause}\{\Phi \mid \Phi \text{ is a satisfiable propositional formula in CNF with at most two literals per clause}\}

For example, Φ=(x1∨x2)∧(x1∨x3‾)∧(x2∨x4)\Phi = (x_1 \lor x_2) \land (x_1 \lor \overline{x_3}) \land (x_2 \lor x_4) is a Boolean formula and it is in 2CNFSAT.

The decision problem 2CNFSAT is
Show answer without attempting

Answer: B

Q40

GATE CS 2014 CS-3Searching Sorting and HashingMCQ2 marks−2/3 if wrong
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?
Show answer without attempting

Answer: A

Q3

GATE CS 2014 CS-1Graph AlgorithmsMCQ1 mark−1/3 if wrong
Let G=(V,E)G=(V,E) be a directed graph where VV is the set of vertices and EE the set of edges. Then which one of the following graphs has the same strongly connected components as GG ?
Show answer without attempting

Answer: B

Q11

GATE CS 2014 CS-1Graph AlgorithmsMCQ1 mark−1/3 if wrong
Let GG be a graph with nn vertices and mm edges. What is the tightest upper bound on the running time of Depth First Search on GG, when GG is represented as an adjacency matrix?
Show answer without attempting

Answer: C

Q14

GATE CS 2014 CS-1Searching Sorting and HashingMCQ1 mark−1/3 if wrong
Let PP be a quicksort program to sort numbers in ascending order using the first element as the pivot. Let t1t_1 and t2t_2 be the number of comparisons made by PP for the inputs [1  2  3  4  5][1\;2\;3\;4\;5] and [4  1  5  3  2][4\;1\;5\;3\;2] respectively. Which one of the following holds?
Show answer without attempting

Answer: C

Q18

GATE CS 2014 CS-1Algorithm DesignMCQ1 mark−1/3 if wrong
Match the following:

1) Waterfall model
a) Specifications can be developed incrementally
2) Evolutionary model
b) Requirements compromises are inevitable
3) Component-based software engineering
c) Explicit recognition of risk
4) Spiral development
d) Inflexible partitioning of the project into stages
Show answer without attempting

Answer: B

Q38

GATE CS 2014 CS-1Algorithm DesignMCQ2 marks−2/3 if wrong
Suppose a polynomial time algorithm is discovered that correctly computes the largest clique in a given graph. In this scenario, which one of the following represents the correct Venn diagram of the complexity classes P, NP and NP Complete (NPC)?
Show answer without attempting

Answer: D

Q39

GATE CS 2014 CS-1Searching Sorting and HashingNAT2 marks
The minimum number of comparisons required to find the minimum and the maximum of 100 numbers is _________________.
Show answer without attempting

Answer: 147.1 to 148.1

Q40

GATE CS 2014 CS-1Searching Sorting and HashingMCQ2 marks−2/3 if wrong
Consider a hash table with 9 slots. The hash function is h(k)=k mod 9h(k) = k \text{ mod } 9. The collisions are resolved by chaining. The following 9 keys are inserted in the order: 5, 28, 19, 15, 20, 33, 12, 17, 10. The maximum, minimum, and average chain lengths in the hash table, respectively, are
Show answer without attempting

Answer: A

Q41

GATE CS 2014 CS-1Algorithm DesignMCQ2 marks−2/3 if wrong
Consider the following C function in which size is the number of elements in the array E:
int MyX(int *E, unsigned int size)
{
  int Y = 0;
  int Z;
  int i, j, k;

  for(i = 0; i < size; i++)
      Y = Y + E[i];

  for(i = 0; i < size; i++)
      for(j = i; j < size; j++)
      {
          Z = 0;
          for(k = i; k <= j; k++)
              Z = Z + E[k];
          if (Z > Y)
              Y = Z;
      }
  return Y;
}
The value returned by the function MyX is the
Show answer without attempting

Answer: A

0/190 correct0 marks

Related topics in GATE CS