Tutorials  Articles  Notifications  Login  Signup

Introduction CapGemini Pseudo Code set 1 CapGemini Pseudo Code set 2 CapGemini Pseudo Code set 3



CapGemini Pseudo Code set 2



1.

What will be the output of following code :

#include<stdio.h>
int main(){
int i = 16;
i =! i > 15;
printf(“i = %d”,i);
return 0;
}
A. i = -1
B. i = 0
C. i = 1
D. Error : Undefined operation


2.

What will be the output of following code :

#include<stdio.h>
int main()
{
int x[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
printf(“%d”,sizeof(x));
return 0;
}
A. 40
B. 10
C. 20
D. Error


3.

 What will be the output of following code :

#include<stdio.h>
int main()
{
int x = 2;
(x & 1) ? printf(“true”) : printf(“false”);
return 0;
}
A. true
B. false
C. 0
D. Error


4.

What will be the output of following code :

#include<stdio.h>
int main()
{
int a = 4, b = 2;
printf(“a^b = %d”, a^b);
return 0;
}
A. 4
B. 1
C. 0
D. 6


5.

 What will be the output of following code :

#include<stdio.h>
int main()
{
int a = 4, b = 2;
printf(“a|b = %d\n”, a|b);
return 0;
}
A. 4
B. 1
C. 0
D. 6


6.

What will be the output of following code :

#include<stdio.h>
int main()
{
int a = NULL – true;
printf(“%d”,a);
return 0;
}
A. -1
B. Garbage value
C. 0
D. Error


7.

What will be the output of following code :

#include<stdio.h>
int x = 0;
int main(){
if(x == x)
printf(“if”);
else
printf(“else”);
return 0;
}
A. Two same variables can not be compared
B. ifelse
C. else
D. if


8.

What will be the output of following code :

#include<stdio.h>
#define FALSE -1
#define NULL 0
#define TRUE 1

int main(){
if(NULL)
printf(“NULL”);
else if(FALSE)
printf(“TRUE”);
else
printf(“FALSE”);
return 0;
}
A. TRUE
B. FALSE
C. NULL
D. ERROR


9.

What will be the output of following code :

#include<stdio.h>
int main(){
int i;
if(true)
printf(“work”);
else
printf(“not work”);
return 0;
}
A. work
B. not work
C. compiler error
D. runtime error


10.

What will be the output of following code :

#include<stdio.h>
int main()
{
if(printf(“0”))
printf(“inside if block”);
else
printf(“inside else block”);
return 0;
}
A. inside else block
B. 0
C. 0inside if block
D. Error – If can not have print statement


11.

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


12.

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


13.

What would be output of following program ?

#include<stdio.h>
int main()
{
    enum grade {A, B, C};
    enum result student1, student2, student3;
    student1 = A;
    student2 = B;
    student3 = C;
    printf("%d, %d, %d\n", student1, student2, student3);
    return 0;
}

 

A.

0, 1, 2

B.

1, 2, 3

C.

0, 2, 1

D.

1, 3, 2





HackerFriend Logo

Join the community of 1 Lakh+ Developers

Create a free account and get access to tutorials, jobs, hackathons, developer events and neatly written articles.


Create a free account