Let \(A\) be the square matrix of size \(n \times n\). Consider the following…

GATE · 2014 · CS · Set 3 · Computer Science & IT

Let AA be the square matrix of size n×nn \times n. Consider the following pseudocode. What is the expected output?

C = 100;
for i = 1 to n do
    for j = 1 to n do
    {
        Temp = A[i][j] + C;
        A[i][j] = A[j][i];
        A[j][i] = Temp - C;
    }
for i = 1 to n do
    for j = 1 to n do
        output (A[i][j]);
  1. A.

    The matrix AA itself

  2. B.

    Transpose of the matrix AA

  3. C.

    Adding 100 to the upper diagonal elements and subtracting 100 from lower diagonal elements of AA

  4. D.

    None of the above

Attempted by 262 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…