Let A be a square matrix of size n x n. Consider the following program. What…

PYQ Hexaware Hiring Assessment 2023

Let A be a square matrix of size n x n. Consider the following program. 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 A itself

  2. B.

    Transpose of matrix A

  3. C.

    Adding 100 to the upper diagonal elements and subtracting 100 from diagonal elements of A

  4. D.

    None of the above

Attempted by 52 students.

Sign up free to check your answer

Sign up free

Explore the full course: Cdac C Cat Complete Preparation

Loading lesson…