github

Made bySaurav Hathi

CSE - Practice Test -22

Q1:

Which of the following standard algorithms is not Dynamic Programming based.

Tags:
Section:
Algorithm
Options:
Q2:

Kadane algorithm is used to find:

Tags:
Section:
Algorithm
Options:
Q3:

We use dynamic programming approach when

Tags:
Section:
Algorithm
Options:
Q4:

Which of the following standard algorithms is not a Greedy algorithm?

Tags:
Section:
Algorithm
Options:
Q5:

When a top-down approach of dynamic programming is applied to a problem, it usually _____________

Tags:
Section:
Algorithm
Options:
Q6:

In dynamic programming, the technique of storing the previously calculated values is called ___________

Tags:
Section:
Algorithm
Options:
Q7:

If a problem can be broken into subproblems which are reused several times, the problem possesses ____________ property.

Tags:
Section:
Algorithm
Options:
Q8:

Consider a sequence F00 defined as : F00(0) = 1, F00(1) = 1 F00(n) = 10 ∗ F00(n – 1) + 100 F00(n – 2) for n ≥ 2 Then what shall be the set of values of the sequence F00 ?

Tags:
Section:
Algorithm
Options:
Q9:

We use dynamic programming approach when

Tags:
Section:
Algorithm
Options:
Q10:

You are given a knapsack that can carry a maximum weight of 60. There are 4 items with weights {20, 30, 40, 70} and values {70, 80, 90, 200}. What is the maximum value of the items you can carry using the 0-1 knapsack?

Tags:
Section:
Algorithm
Options:
Q11:

Consider the polynomial p(x) = a0 + a1x + a2x^2 +a3x^3, where ai != 0, for all i. The minimum number of multiplications needed to evaluate p on an input x is:

Tags:
Section:
Algorithm
Options:
Q12:

What does fun2() do in general?

int fun(int x, int y)

{

if (y == 0)   return 0;

return (x + fun(x, y-1));

} 

int fun2(int a, int b)

{

if (b == 0) return 1;

return fun(a, fun2(a, b-1));

}

Tags:
Section:
Algorithm
Options:
Q13:

What does the following function print for n = 25?

void fun(int n)

{

if (n == 0)

return;

printf("%d", n%2);

fun(n/2);

}

Tags:
Section:
Algorithm
Options:
Q14:

Consider the following recursive function fun(x, y). What is the value of fun(4, 3)

int fun(int x, int y)

{

if (x == 0)

return y;

return fun(x - 1,  x + y);

}

Tags:
Section:
Algorithm
Options:
Q15:

Predict output of following program

#include <stdio.h>

int fun(int n)

{

if (n == 4)

return n;

else return 2*fun(n+1);

}

int main()

{

printf("%d ", fun(2));

return 0;

}

Tags:
Section:
Algorithm
Options: