Question 1
The weight of a sequence a0 , a1 , …, an–1 of real numbers is defined as a0 + a1 / 2 + …+ a n–1 /2n–1 . A subsequence of a sequence is obtained by deleting some elements from the sequence, keeping the order of the remaining elements the same. Let X denote the maximum possible weight of a subsequence of a0 , a1 ,..., an-1 . Then X is equal to
GATE CSE 2010 - [2Marks] (MCQ)
max(Y, a0 + Y)
max(Y, a0 + Y/2)
max(Y, a0 + 2Y)
a0 + Y/2
Question 2
Four matrices M1, M2, M3 and M4 of dimensions pxq, qxr, rxs and sxt respectively can be multiplied is several ways with different number of total scalar multiplications. For example, when multiplied as ((M1 X M2) X (M3 X M4)), the total number of multiplications is pqr + rst + prt. If p = 10, q = 100, r = 20, s = 5 and t = 80, then the number of scalar multiplications needed is:
GATE CSE 2011 - [2Marks] (MCQ)
248000
44000
19000
25000
Question 3
An algorithm to find the length of the longest monotonically increasing sequence of numbers in an array A[0: n - 1] is given below. Let L; denote the length of the longest monotonically increasing sequence starting at index i in the array. Initialize L n-1 = 1. For all i such that 0 ≤ i ≤ n – 2
[Tex]\begin{aligned}
&L_i = \\
&\begin{cases}
1 + L_{i+1} & \text{if } A[i] < A[i + 1] \\
1 & \text{otherwise}
\end{cases}
\end{aligned}[/Tex]
Finally the length of the longest monotonically increasing sequence is Max (L 0 , L 1 ,……., L n-1 ). Which of the following statements is TRUE?
GATE CSE 2011 - [1Marks] (MCQ)
The algorithm uses dynamic programming paradigm
The algorithm has a linear complexity and uses branch and bound paradigm
The algorithm has a non-linear polynomial complexity and uses branch and bound paradigm
The algorithm uses divide and conquer paradigm.
Question 4
Consider two strings A "= qpqrr " and B ="pqprqrp". Let x be the length of the longest common subsequence (not necessarily contiguous) between A and B and let y be the number of such longest common subsequences between A and B. Then x+10y = _____.
GATE CSE 2014,SET2 - [2Marks] (NAT)
Question 5
The Floyd-Warshall algorithm for all-pair shortest paths computation is based on
GATE CSE 2016,SET2 - [1Marks] (MCQ)
Greedy paradigm
Divide-and-Conquer paradigm.
Dynamic Programming paradigm.
Neither Greedy nor Divide-and-Conquer nor Dynamic Programming paradigm
Question 6
Consider the weighted undirected graph with 4 vertices, where the weight of edge {i, j} is given by the entry W ij in the matrix W.

The largest possible integer value of x, for which at least one shortest path between some pair of vertices will contain the edge with weight x is______.
GATE CSE 2016,SET1 - [2Marks] (NAT)
Question 7
Let A1 , A2 , A3 , and A4 be four matrices of dimensions 10 × 5, 5 × 20, 20 × 10, and 10 × 5, respectively. The minimum number of scalar multiplications required to find the product A1 A2 A3 A4 using the basic matrix multiplication method is ____.
GATE CSE 2016,SET2 - [2Marks] (NAT)
Question 8
Assume that multiplying a matrix G 1 of dimension p×q with another matrix G 2 of dimension q × r requires scalar multiplications. Computing the product of matrices
G1 G2 G3 ……Gn can be done by parenthesizing in different ways. Define Gi Gi+1 as an explicitly computed pair for a given parenthesization if they are directly
multiplied. For example, in the matrix multiplication chain G1 G2 G3 G4 G5 G6 using parenthesization (G1 (G2 G3 )) (G4 (G5 G6 )).G2 G3 and G5 G6 are the only explicitly computed pairs. Consider a matrix multiplication chain F1 F2 F3 F4 F5 , where matrices F1 F2 F3 F4 F5 are of dimensions 2 × 25, 25 × 3, 3 × 16, 16 × 1 and 1 × 1000, respectively. In the parenthesization of F1 F2 F3 F4 F5 that minimizes the total number of scalar multiplications, the explicitly computed pairs is/are:
GATE CSE 2018 - [2Marks] (MCQ)
F1 F2 and F3 F4
F2 F3 only
F3 F4 only
F1 F2 and F4
Question 9
Consider a table T, where the elements T[i][j], 0 <= i, j <= n, represent the cost of the optimal solutions of different subproblems of a problem that is being solved using a dynamic programming algorithm. The recursive formulation to compute the table entries is as follows:
T[0][k] = T[k][0] = 1 for k = 0, 1, 2, …, n
T[i][j] = 2T[i−1][j]+3T[i][j−1] for 1 ≤ i, j ≤ n
Consider the following two algorithms to compute entries of T. Assume that for both the algorithms, for all 0 ≤ i, j ≤ n, T[i][j] has been initialized to 1.
Algorithm B₁:
For i = 1 to n
For j = 1 to n
T[i][j] = 2T[i − 1][j] + 3T[i][j − 1]
Algorithm B₂:
For s = 2 to 2n
For i = 1 to n
For j = 1 to n
If (i + j == s)
T[i][j] = 2T[i − 1][j] + 3T[i][j − 1]
Algorithm Bₖ, k ∈ {1, 2}, is said to be correct if and only if it calculates the correct values of T[i][j], for all 0 ≤ i, j ≤ n, as per the recursive formulation, at the end of the execution of the algorithm Bₖ.
Which one of the following statements is true? [GATE 2026 || SET-2 MCQ || 2-mark]
Both algorithms B1 and B2 are correct
Algorithm B1 is correct, but algorithm B2 is incorrect
Algorithm B2 is correct, but algorithm B1 is incorrect
Both algorithms B1 and B2 are incorrect
There are 9 questions to complete.