☰
×
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 IV
« Prev
Next »
C Tricky Questions - Find Output
Program 61 #include
main() { union { struct { char c[2]; char ch[2]; }s; /*struct { short int i; short int j; }st;*/ struct { int i; int j; }st; }u={12,1,15,1}; printf("%d %d\n",u.st.i,u.st.j); } Program 62 #include
main() { struct { char a[11]; int i; }st={"done",10}; printf("%s\n",(&st)->a); printf("%d\n",(&st)->i); } Program 63 #include
main() { char *ptr; ptr=(char *)strtok("jan:feb:mar",":"); printf("%s\n",ptr); do { ptr=strtok('\0',":"); if(ptr) printf("%5s\n",ptr); }while(ptr); } Program 64 #include
main() { int a,b,c,d; a=3; b=5; c=a,b; d=(a,b); printf("%d %d\n",c,d); } Program 65 #include
struct st{ int a; int b; }; void foo(struct st *p) { char *pt; p->a=768; p->b=128; pt=(char*)p; printf("%d\n",*++pt); } Program 66 main() { struct st ab={128,768}; struct st *pq=&ab; foo(pq); } Program 67 #include
main() { int a[][3]={1,2,3,4,5,6}; int (*ptr)[3]=a; printf("%d %d ",(*ptr)[1],(*ptr)[2]); ++ptr; printf("%d %d \n",(*ptr)[1],(*ptr)[2]); } Program 68 #include
main() { int i=3; int j; j=sizeof(++i + ++i + ++i); printf("i=%d j=%d\n",i,j); } Program 69 #include
void f1(int *,int); void f2(int *,int); void (*p[2])(int *,int); main() { int a; int b; p[0]=f1; p[1]=f2; a=3; b=5; p[0](&a,b); printf("%d\t %d\t",a,b); p[1](&a,b); printf("%d\t %d\t",a,b); } void f1(int *p,int q) { int temp; temp=*p; *p=q; q=temp; } void f2(int *p,int q) { int temp; temp=*p; *p=q; q=temp; } Program 70 #include
main() { int q,i,j,count; i=j=0; q=2; count=6; switch(3) { case 0:while(--count>0) { case 1:++j; case 2:++i; case 3: ; case 4: ; case 5: ; } printf("%d ",i); printf("%d \n",j); } } Program 70 #include
main() { char a[]="abcde"; char *p=a; p++; p++; p[2]='z'; printf("%s",p); } Program 71 #include
void t1(char *q) { if(*q!='r') { putchar(*q); //t1(q++);//segmentation fault t1(++q); } } main() { char *p; p="abcder"; t1(p); } Program 72 #include
static unsigned char h[5]={1,2,3,4,5}; main() { struct ad{ unsigned short a; unsigned short b; }; struct ad *it; it=(struct ad *)h; printf("%d ",it->a); printf("%d \n",it->b); } Program 73 #include
main() { char *p; char buf[10]={1,2,3,4,5,6,9,8}; p=(buf+1)[5]; printf("%d\n",p); } Program 74 #include
main() { int i,j; i=1; j=1; while(i^j || i-- || --j) // while(1) { //sleep(2); printf("%d %d \n",i,j); } } Program 75 #include
main() { static int a[2][3]={{1,2,3},{4,5,6}}; printf("%d\n",a[1,1][1,2]); } Program 76 #include
main() { int count; printf("12345%n6\n",&count); printf("count=%d\n",count); } Program 77 #include
main() { char *p="real time"; printf(":%.*s:\n",5,p); printf(":%12.*s:\n",10,p); } Program 77 #include
main() { printf("ABCDE"+sizeof("ABC")); } Program 78 #include
#include
void string(char *q) { char *r=q+strlen(q)-1; //printf("%d\n",*r); for(;q
main() { struct a{ int temp[3]; }; int j; static int p[3]={1,2,3}; static int q[3]={4,5,6}; *(struct a*)q=*(struct a*)p; for(j=0;j<3;j++) printf("%3d ",*(q+j)); printf("\n"); } Program 80 #include
typedef union { struct{ int a; }A; struct{ int a; float b; }B; }dd; main() { dd D; D.A.a=3; D.B.b=5.3; printf("%d \n",D.B.a); }
« 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