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 3



1.

What will be the output of following code :

#include<stdio.h>
int main()
{
if(sizeof(0))
printf(“Hai”);
else
printf(“Bye”);
return 0;
}
A. 2
B. Bye
C. Runtime Error
D. Hai


2.

What will be the output of following code :

#include<stdio.h>
int main()
{
if(sizeof(‘\0’))
printf(“inside if block”);
else
printf(“inside else block”);
return 0;
}
A. inside if block
B. inside else block
C. Null Pointer Exception
D. None of these


3.

What will be the output of following code :

#include<stdio.h>
int main()
{
int i = 65;
switch(i)
{
case 65:
printf(“Integer 65”);
break;
case ‘A’:
printf(“Char 65”);
break;
default:
printf(“Bye”);
}
return 0;
}
A. Integer 65
B. Char 65
C. Bye
D. Error : Duplicate Values


4.

What will be the output of following code :

#include<stdio.h>
int main()
{

switch(2/3)
{
case 1:
printf(“case 1 executed “);

case 2:
printf(“case 2 executed “);
break;
default:
printf(“Default block executed”);
}
return 0;
}
A. case 1 executed
B. case 2 executed
C. Default block executed
D. Error : Switch statements can not hold


5.

 What will be the output of following code :

#include<stdio.h>
int main()
{
int i = 1;
switch(i)
{
case i:
printf(“case 1 executed”);
break;
case i + 1;
printf(“case 2 executed”);
break;
default:
printf(“default block executed”);
break;
}
return 0;
}
A. case 1 executed
B. case 2 executed
C. default block executed
D. Error : i is not usable


6.

What will be the output of following code :

#include<stdio.h>
int main(){
while(printf(“%d”, 5) < 4)
printf(“Loop “);
return 0;
}
A. Loop Loop Loop Loop Loop
B. Infinite loop
C. 5Loop 5Loop 5Loop 5Loop 5Loop
D. None of these


7.

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


8.

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


9.

What will be the output of following code :

#include<stdio.h>
int main()
{
while(!!7)
printf(“Hai”);
return 0;
}
A. Hai
B. HaiHai
C. Infinite loop
D. None of these


10.

What will be the output of following code :

#include<stdio.h>
int main(){
while(!printf(“awesome”));
return 0;
}
A. awesome
B. Error
C. Infinite loop
D. None of these


11.

What can you say about following line of code:

extern int i;

 

A.

It is declaring variable i

B.

It is defining variable i

C.

It will throw error

D.

It's a function.





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