You are here : Home >> All Company Study Materials >> Capgemini Archive >> Capgemini Pseudo Code Questions
15. Consider the following code:
if (condition 1) {
if (condition 2)
{ // Statement A } else
if (condition 3)
{ // Statement B} else
{// Statement C } else
if (condition 4)
{// Statement D}
else
{// Statement E}
}
Which of the following condition will allow execution of statement A?
A. NOT(condition2) AND NOT(condition3)
B. condition1 AND condition4 AND NOT(condition2) AND NOT(condition3)
C. condition1 AND condition2 AND condition4
D. NOT(condition1) AND condition2 AND NOT(condition4)
Ans. C
16. What will be the output of following code :
#include<stdio.h>
int main()
{
int num = 8;
printf (“%d %d”, num << 1, num >> 1);
return 0;
}
A. 8 0
B. 0 0
C. 16 4
D. Error : Can’t Perform operation
Ans. C
Explanation : ‘<<‘ This is the left shift operator. It takes two numbers, left shifts the bits of the first operand, the second operand decides the number of places to shift. ‘>>’ This is the right shift operator.
8 in binary form : 00001000
Performing Left Shift (<<) : 00010000 => 16
Performing Right Shift (>>) : 00000100 => 4
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