You are here : Home >> All Company Study Materials >> Capgemini Archive >> Capgemini Pseudo Code Questions
35. What will be the output of following code :
#include<stdio.h>
#define NULL 0
int main()
{
while (NULL == 0)
{
printf(“Loop”);
break;
}
return 0;
}
A. Loop
B. Null
C. 0
D. Error : Null can not be compared
Ans. A
Explanation : Null is equivalent to 0. And hence, Option A is correct.
36. What will be the output of following code :
#include<stdio.h>
int main(){
float ft = 7.5;
while(ft)
{
printf(“Loop”);
ft = ft – .5;
if(ft == 5.0f)
break;
}
return 0;
}
A. LoopLoopLoopLoopLoop
B. Loop
C. No output
D. None of these
Ans. A
Explanation : while loop will run for 5 times, i.e for the values 7.5, 7.0, 6.5, 6.0, 5,5. Hence, printing “Loop” for 5 times.
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