Algorithm Design questions

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

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

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

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/70 correct0 marks

Related topics in Algorithms