C programming tricky objective type operators questions and answers with explanation for written test and interview
(1)
What will be output of the following program?
#include<stdio.h>
int main(){
float a=0.7;d
if(a<0.7){
printf("C");
}
else{
printf("C++");
}
return 0;
return 0;
}
EXPLANATION
(2)
What will be output of the following program?
#include<stdio.h>
int main(){
int i=5,j;
j=++i+++i+++i;
printf("%d %d",i,j);
return 0;
}
EXPLANATION
(3)
What will be output of the following program?
#include<stdio.h>
int main(){
int i=1;
i=2+2*i++;
printf("%d",i);
return 0;
}
EXPLANATION
(4)
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;
}
EXPLANATION
(5)
What will be output of the following program?
#include<stdio.h>
void main(){
int x;
x=10,20,30;
printf("%d",x);
return 0;
}
EXPLANATION
(6)
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;
}
EXPLANATION
(7)
What will be output of the following program?
#include<stdio.h>
int main(){
int a;
a=015 + 0x71 +5;
printf("%d",a);
return 0;
}
EXPLANATION
(8)
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;
}
EXPLANATION
(9)
What will be output of the following program?
#include<stdio.h>
int main(){
int x=100,y=20,z=5;
printf("%d %d %d");
return 0;
}
EXPLANATION
(10)
What will be output of the following program?
#include<stdio.h>
int main(){
int a=2;
a=a++ + ~++a;
printf("%d",a);
return 0;
}
EXPLANATION
(11)
What will be output of the following program?
#include<stdio.h>
int main(){
int a;
a=sizeof(!5.6);
printf("%d",a);
return 0;
}
EXPLANATION
(12)
What will be output of the following program?
#include<stdio.h>
int main(){
float a;
(int)a= 45;
printf("%d,a);
return 0;
}
EXPLANATION
(13)
What will be output of the following program?
#include<stdio.h>
int main(){
int i=5;
int a=++i + ++i + ++i;
printf("%d",a);
return 0;
}
No comments:
Post a Comment