☰
×
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 IX
« Prev
Next »
C Tricky Questions - Find Output
Program 161 static void pass() { printf("in pass function\n"); } (*fp)()=&pass; Program 162 #include
main() { union { struct { char c[2]; char ch[2]; }s; struct { short int i; short int j; }st; }u={12,1,15,1}; printf("%d %d",u.st.i,u.st.j); } Program 163 #include
int main() { int x=011,i; for(i=0;i
char* g() { static char x[1024]; return x; } main() { char *g1="first string"; strcpy(g(),g1); g1=g(); strcpy(g1,"second string"); printf("%s\n",g()); } Program 165 #include
main() { register a,b,x; scanf("%d%d",&a,&b); x=a+b; } Program 166 #include
int fn(int v) { if(v==1 || v==0) return 1; if(v%2==0) return fn(v/2)+2; else return fn(v-1)+3; } main() { printf("%d \n",fn(7)); } Program 167 #include
main() { enum bool {true,false }; if(true == (2==3)) printf("..vector"); else printf("..institute"); } Program 168 #include
main() { int i=300; char *ptr=&i; *++ptr=2; printf("%d \n",i); } Program 169 #include
main() { static char *s[]={"black","white","yellow","violet" }; char **ptr[]={s+3,s+2,s+1,s},***p; p=ptr; **++p; printf("%s\n",*++*++p + 3); } Program 170 If the textfile named file.txt contains "SATEESH" then what would the output of the following program ? #include
main() { FILE *ptr; ptr=fopen("file.txt","r"); printf("%c",fgetc(ptr)); fseek(ptr,2,1); printf("%c",fgetc(ptr)); fseek(ptr,-2,1); printf("%c",fgetc(ptr)); } Program 171 #define big(a,b) a>b ? a : b #define swap(a,b) temp=a; a=b; b=temp; main() { int a=3,b=5,temp=0; if((3+big(a,b)) > b) swap(a,b); printf("%d %d ",a,b); } Program 172 #include
#include
main() { char s1[20]="chennai-600233"; char s2[20]="\0"; strncat(s2,s1,7); // strncat(s1,s2,7); printf("s1 = %s s2 = %s \n",s1,s2); /* char a[]="abc"; char b[]="\0"; strcat(b,a); printf("b=%s\n",b); */ } Program 173 #include
struct null { char name[20]; char string[20]; }; main() { struct null v1,v2={"alpha"}; v1=v2; printf("%s....%s\n",v1.string,v2.name); } Program 174 #include
main() { int x=100; printf("%d..%d..%d\n",x++,x++,x++);// 102 101 100 } Program 175 #include
#define type1 char main() { typedef char type2 ; type1 x; type2 y; x=255; y=255; printf("%d.....%d\n",x,y); } Program 176 #include
main() { char *string="Sateeshkg"; printf("%d\n",sizeof(*string)); printf("%d\n",sizeof(string)); } Program 177 #include
#define square(x) x*x main() { int x=3; printf("%d\n",square(x++)); printf("%d\n",square(x--)); } Program 178 #include
main(int argc,char **argv) { printf("%d %c %s \n",argc,++*++argv,*++argv); } Program 179 #include
main() { int a,b; a=10; b=0x10; printf("%x...%x\n",a<<8,(~~b)); } Program 180 #include
main() { union A { unsigned short a : 5; unsigned short b : 5; unsigned short c : 6; unsigned long d; }x; x.d=0xffff; printf("%x..%x..%x\n",x.a,x.b,x.c); } Program 181 #include
main() { int i=0; if(7 & 7) { printf("%d\n",i); } else { printf("end\n"); } } Program 182 main() { //unsigned char int ; unsigned short char ; } Program 183 What is the output ('a' is at address 0x10000 and 0x10004) #include
main() { int *a,*p; a=(int*)&p; p=(int*)&a; *a=p; *p=a; printf(" 0x%08X, 0x%08X,0x%08X,0x%08X\n",a,p,*a,*p); } Program 184 #include
void fun(); void print(); #define VALUE_MACRO 10 main() { printf("%d.",VALUE_MACRO); fun(); printf("%d.",VALUE_MACRO); print(); } void fun() { #undef VALUE_MACRO #define VALUE_MACRO 50 } void print() { printf("%d\n",VALUE_MACRO); } Program 185 #include
#define max(a,b) ( a>b ? a : b) main() { int a=1; int b=2; int c; c=max(a++,b++); printf("a=%d b=%d c=%d\n",a,b,c); } Program 186 #include
main() { unsigned short x=0x1234,y=10,z=11; y=x^0x8765; z=~y; x=z & y; printf("%04x %04x %04x\n",x,y,z); } Program 187 #include
main() { int a=4,b=3; a&=b |=a&=b; printf("a=%d b=%d\n",a,b); }
« 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