Vous êtes sur la page 1sur 9

1.What will be output of the following program?

#include<stdio.h>
int main(){
volatile int a=11;
printf("%d",a);
return 0;
}
2. What will be output of the following program?

#include<stdio.h>
int main(){
float a=0.7;
if(a<0.7){
printf("C");
}
else{
printf("C++");
}
return 0;
}
3. What will be output of the following program?

#include<stdio.h>
int main(){
int a=2,b=7,c=10;
c=a==b;
printf("%d",c);
return 0;
}
4.What will be output of the following program?

#include<stdio.h>
void main()
{
int x;
x=10,20,30;
printf("%d",x);
return 0;
}
5. What will be output of the following program?
#include<stdio.h>
int main(){
int a=0,b=10;
if(a=0){
printf("true");
}
else{
printf("false");
}
return 0;
}

6. What will be output of the following program?

#include<stdio.h>
int main(){
printf("%d %d %d " , sizeof(3.14) , sizeof(3.14f) ,
sizeof(3.14L));
return 0;
}

7. What will be output of the following program?

#include<stdio.h>
int main(){
int a;
a=sizeof(!5.6);
printf("%d",a);
return 0;
}

8. What will be output of the following program?

#include<stdio.h>
int main(){
float a;
(int)a= 45;
printf("%d,a);
return 0;
}

9. What will be output of the following program?


void main(){
int x=1;
if(x--)
printf("One");
printf(" Two");
else
printf("Three");
}
10. What will be output of the following program?
#include<stdio.h>
void main(){
int a=100;
if(a>10)
printf("M.S. Dhoni");
else if(a>20)
printf("M.E.K Hussey");
else if(a>30)
printf("A.B. de villiers");
}

11. What will be output of the following program?


#include<stdio.h>
void main(){
int a=5,b=10;
if(++a||++b)
printf("%d %d",a,b);
else
printf("John Terry");
}
12.What will be output when you will execute following
c code?
#include<stdio.h>
void main(){
int check=2;
switch(check){
case 1: printf("One");
case 2: printf(" Two");
case 3: printf(" Three");
default: printf(" Four");
}
}

13.What will be output when you will execute following


c code?
#include<stdio.h>
void main(){
int no=1;
switch(movie<<2+movie){
default:printf("One");
case 4: printf(" Two");
case 5: printf(" Three");
case 8: printf(" Four");
}
}

14.What will be output when you will execute following


c code?

#include<stdio.h>
#define n 10

void main(){
auto money=10;
switch(money,money*2){
case n:
printf("Willian");
break;
case n*2:
printf("Warren");
break;
case n*3:
printf("Carlos");
break;
default:
printf("Lawrence");

case n*4:
printf("Inqvar");
break;
}
}

15.What will be output when you will execute following


c code?

#include<stdio.h>
enum actor{
SeanPenn=5,
AlPacino=-2,
GaryOldman,
EdNorton
};
void main(){
enum actor a=0;
switch(a){
case SeanPenn: printf("Kevin Spacey");
break;
case AlPacino: printf("Paul Giamatti");
break;
case GaryOldman:printf("Donald Shuterland");
break;
case EdNorton: printf("Johnny Depp");
}
}
16.What will be output when you will execute following
c code?

void main(){
if(printf("Hello world")){
}
}

17.What will be output when you will execute following


c code?

void main()

{
int a=5,b=10;
a=a^b;
b=a^b;
a=b^a;
printf("\na= %d b= %d",a,b);
}

18.What will be output if you will compile and execute


the following c code?
void main(){
int a=-12;
a=a>>3;
printf("%d",a);
}

19.What will be output if you will compile and execute


the following c code?
void main(){
int a,b;
a=1,3,15;
b=(2,4,6);
clrscr();
printf("%d ",a+b);
getch();
}

20. What will be output of the following program?

void main(){
int i=0;
if(i==0){
i=((5,(i=3)),i=1);
printf("%d",i);
}
else
printf("equal");
}

21. What will be output of the following program?

void main(){
int a=25;
clrscr();
printf("%o %x",a,a);
getch();
}

22. What will be output of the following program?

void main(){
if(printf("cquestionbank"))
printf("I know c");
else
printf("I know c++");
}

23. What will be output of the following program?


#define x 5+2
void main(){
int i;
i=x*x*x;
printf("%d",i);
}

24. What will be output of the following program?

void main()
{
int x,y;
for(x=1,y=5;x+y<=10;x++)
{
printf(%d%d,x,y);
Y++;
}

25. What will be output of the following program?


-
-10?printf(Instagram):printf(Twitter);

26. What will be output of the following program?

void main()
{
int a=13,b=5;
i=0;
while(a>b)
{
a=a-b;
i++;
}
printf(%d%d,i,a);
}
27. What will be output of the following program?

void main()
{
int i=-3,j=2,k=0,m;
m=++i&&++j||++k;
printf(%d%d%d%d,i,j,k,m);
}

28. What will be output of the following program?

void main(){
int x=1;
if(x--)
printf("One");
else
printf("Three");
}

Vous aimerez peut-être aussi