You are here : Home >> All Company Study Materials >> Capgemini Archive >> Capgemini Pseudo Code Questions
27. What will be the output of following code :
#include<stdio.h>
int main(){
int i = 5, j = 4;
if(!printf(“”))
printf(“%d %d”, i, j);
else
printf(“%d %d”, i++, ++j);
return 0;
}
A. 5 5
B. 5 4
C. 5 6
D. 6 6
Ans. B
Explanation : 5 4 will be the output as the statements inside if block will be executed. This is because :
if(printf(“”)) is false(as it is not printing any mess.) and
if( ! printf(“”)) is true
However, if there was any text written inside “” in printf(“”), then if(printf(“”)) would have become true.
28. What will be the output of following code :
#include<stdio.h>
int main()
{
int i = 25;
if(i == 25);
i = 50;
if(i == 25)
i = i + 1;
else
i = i + 1;
printf(“%d”, i);
return 0;
}
A. 51
B. 25
C. 50
D. None of these
Ans. A
Explanation : 51 is the correct answer as the first if-condition is true. So, i becomes 50. Again the second if condition is false, so corresponding else to that if statement will be executed, so i = 50 + 1 .
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