You are here : Home >>All Company Study Materials >> Capgemini Archive >> Capgemini Pseudo Code Questions
1. What will be the output of following code :
int A[5][5], k, j;
for(k = 0; k<5; ++k)
for(j=0; j<5; j++)
A[k][j] = A[j][k];
A. It transposes the given matrix A
B. It does not alter the given matrix.
C. It makes the given matrix A, symmetric
D. None of the above.
Ans. A
Explanation : Above logic is to deduce the transpose of a matrix.
2. What is the output of given code :
#include<stdio.h>
int main()
{
long double a;
long double b;
int arr[sizeof(!a+b)];
printf(“%d”,sizeof(arr));
}
A. Run time Error
B. 32
C. 64 with warning
D. No output
Ans. C
Explanation : Size of long double in GCC Linux basede compilers : 16
Size of Integer : 4
So, Size of !(a+b) : 16
Integer array of size 16 : 16 * 4 => 64
sir in ques 1 answer should be ‘b’ i guess
No.
The answer is neither ‘b’ and nor ‘a’ it is ‘c’ because elements of upper triangle of the matrix are getting copied to lower triangle of the matrix therefore it is making the matrix ‘Symmetric’.
Sir can you please explain how c will be the option of question 2
Can u provide explanation…..
Sir my suggestions is that you should add the whole solutions of questions because anybody having trouble how they resolve their issue.
And is my solution and your option does not match how i get the concept???
Answer of Question No. 7 is 21