☰
×
Home
◈ Introduction
C - Data Types IQ
◈ C Data Type Tricky - I
◈ C Data Type Tricky - II
◈ C Data Type Tricky - III
◈ C Data Type Tricky - IV
◈ C Data Type Tricky - V
C - Operators IQ
◈ C Operators Tricky - I
◈ C Operators Tricky - II
◈ C Operators Tricky - III
Choose the Correct
◈ Choose the Correct Ans - I
◈ Choose the Correct Ans- II
◈ Choose the Correct Ans - III
◈ Choose the Correct Ans - IV
◈ Choose the Correct Ans - V
◈ Choose the Correct Ans - VI
Find Output - Tricky
◈ C Pgm Tricky Questions I
◈ C Pgm Tricky Questions II
◈ C Pgm Tricky Questions III
◈ C Pgm Tricky Questions IV
◈ C Pgm Tricky Questions V
◈ C Pgm Tricky Questions VI
◈ C Pgm Tricky Questions VII
◈ C Pgm Tricky Questions VIII
◈ C Pgm Tricky Questions IX
C - General IQ
◈ General C Questions I
◈ General C Questions II
◈ General C Questions III
◈ General C Questions IV
◈ General C Questions V
◈ General C Questions VI
◈ General C Questions VII
Home
About
Consulting
Training
Tutorial
Interview Questions
Contact
Interview Questions
C Tricky - Find Output
Home
C Interview Questions
◈ Introduction
C Data Types Tricky Questions
◈ C Data Type Tricky Questions I
◈ C Data Type Tricky Questions II
◈ C Data Type Tricky Questions III
◈ C Data Type Tricky Questions IV
◈ C Data Type Tricky Questions V
C Operators Interview Questions
◈ C Operators Tricky Questions I
◈ C Operators Tricky Questions II
◈ C Operators Tricky Questions III
Choose the Correct Answer
◈ Choose the Correct Answer I
◈ Choose the Correct Answer II
◈ Choose the Correct Answer III
◈ Choose the Correct Answer IV
◈ Choose the Correct Answer V
◈ Choose the Correct Answer VI
Find Output - Tricky C Program
◈ C Programs Tricky Questions I
◈ C Programs Tricky Questions II
◈ C Programs Tricky Questions III
◈ C Programs Tricky Questions IV
◈ C Programs Tricky Questions V
◈ C Programs Tricky Questions VI
◈ C Programs Tricky Questions VII
◈ C Programs Tricky Questions VIII
◈ C Programs Tricky Questions IX
General C Interview Questions
◈ General C Questions I
◈ General C Questions II
◈ General C Questions III
◈ General C Questions IV
◈ General C Questions V
◈ General C Questions VI
◈ General C Questions VII
C Programming Interview Questions
C Tricky Questions - Find Output VI
« Prev
Next »
C Tricky Questions - Find Output
Program 101 #include
#define a hello main() { printf("printf(""%chello\\n%c"");\n",34,34); printf("printf(\"hello\\n\");\n"); } Program 102 #include
#define MACRO(test) #test main() { printf(MACRO(magic)); } Program 103 #define sum(a,b,c) a+b+c #define avg(a,b,c) sum(a,b,c)/3 #define geq(a,b,c) avg(a,b,c)>=60 #define lee(a,b,c) avg(a,b,c)<=60 #define des(a,b,c,d) (d==1?geq(a,b,c):lee(a,b,c)) main() { int num=70; char ch='0'; float f=2.0; if des(num,ch,f,0) puts("lee.."); else puts("geq..."); } Program 104 main() { static char *s[]={"black","white","yello","violet"}; char **ptr[]={s+3,s+2,s+1,s},***p; p=ptr; **++p; printf("%s\n",*--*++p+3); } Program 105 main() { char *s="12345s"; printf("%d\n",sizeof(s)); } Program 106 main() { printf("%d %d\n",sizeof('*'),sizeof(int)); } Program 107 main() { int a=0xff; if(a<<4>>12) printf("right\n"); else printf("wrong\n"); } Program 108 main() { int a; printf("%d\n",a^a); } Program 109 main() { int i=20,k=0,j; for(j=1;j<1;j=1+4*(i/j)) k+=j<10?4:3; printf("%d\n",k); } Program 110 main() { int buf[5]; int *bptr=&buf[3]; bptr[-1]=2; bptr[-2]=1; bptr[-3]=0; printf("%d\n",buf[2]); } Program 111 main() { int x=10,y=20,z=5,i; i=x
0) return (n+func(n-2)); } Program 114 main() { static int a[]={0,1,2,3,4}; static int *p[]={a,a+1,a+2,a+3,a+4}; int **ptr; ptr=p; **ptr++; printf("%d %d %d\n",ptr-p,*ptr-a,**ptr); *++*ptr; printf("%d %d %d\n",ptr-p,*ptr-a,**ptr); ++**ptr; printf("%d %d %d\n",ptr-p,*ptr-a,**ptr); } Program 115 main() { int cnt=5,a; do { a/=cnt; }while(cnt--); printf("%d\n",a); } Program 116 main() { int x=50,y=75,z=100,res; res=(x+50?y>=75?z>100?4:3:0:1); printf("%d\n",res); } Program 117 main() { void *v; int integer=2; int *i=&integer; v=i; printf("%d\n",(int *)*v); } Program 118 main() { int a=5,b=10,c; int *p=&a,*q=&b; c=p-q; printf("%d\n",c); return 0; } Program 118 main() { int i; if(i=0) printf("hello\n"); else printf("heaven\n"); } Program 119 #define SQUARE(x) x*x main() { float s=10,u=30,t=2,a; a=2*(s-u*t)/SQUARE(t); printf("result:%f\n",a); return 0; } Program 120 main() { int x; x=3; f(x); printf("MAIN"); } f(int n) { printf("F"); if(n!=0) f(n-1); }
« Prev
Next »
Helpful Links
Sateeshkg Home
Interview Questions
Corporate Training
Recommended Books
Linux Consulting
Apply for Job Assistance
If you have any queries please email us at
info@motionzen.com