☰
×
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 I
« Prev
Next »
C Tricky Questions - Find Output
Program 1 #include
main() { int a[5]={5,1,15,16,17}; int i,j,m; i=++a[1]; j=a[1]++; m=a[++i]; printf("%d..%d..%d\n",i,j,m); } Program 2 #include
main() { char c='d'; switch(c) { case 'a' : printf("a"); break; case 'b' : case 'c' : case 'd' : printf("bcd"); case 5 : printf("5"); case 6 : printf("6"); break; default : printf("7"); } printf("\n"); } Program 3 #include
main() { static int i=5; do { printf("%d\n",i); while(i-- > 0) { printf("%d",--i); } }while(i>0); } Program 4 #include
main() { char *ptr="e"; char str[]="e-Consystems"; *(str+5)=ptr[1]; printf("%s\n",str); } Program 5 #include
main() { int x=2,y=6,z=6; x=y==z; printf("%d\n",x); } Program 6 #include
void foo(int*); main() { int i=97,*p=&i; foo(&i); printf("%d\n",*p); } void foo(int *p) { int j=2; p=&j; printf("%d\n",*p); } Program 7 #include
#define sqr(x) x*x main() { printf("%d\n",sqr((3+3)+3)); } Program 8 #include
main() { int x,y=5,z=5; x=y==z; printf("%d\n",x); } Program 9 union utemp { int a; double b; char c; }u; main() { u.a=1; u.c='A'; printf("%d\n",sizeof(u)); } Program 10 #define swap(a,b) { int temp; temp=a; a=b; b=temp; } Program 11 main() { int a=3,b=2; if(a>b) { swap(a,b); } else { b=a; } printf("%d %d\n",a,b); } Program 12 #include
struct student { char *name; }; struct student s; struct student fun(void) { s.name="newton"; printf("%s\n",s.name); s.name="alan"; return s; } main() { struct student m=fun(); printf("%s\n",m.name); m.name="turning"; printf("%s\n",s.name); } Program 13 #include
struct student { char *name; }; struct student s; struct student fun(void) { s.name="vector"; printf("%s\n",s.name); s.name="chennai"; return s; } main() { struct student m=fun(); printf("%s\n",m.name); m.name="india"; printf("%s\n",s.name); } Program 14 #include
int x=5; m() { x=8; n(); } n() { printf("%d\n",x); } main() { int x=3; m(); printf("%d\n",x); } Program 15 #include
main() { char *str[]={"a","b","c","d"}; printf("%d\n",sizeof(str)); } Program 16 #include
#define condition 0 #if condition void main() { printf("Hai\n"); } #endif void main() { printf("Hello\n"); } Program 17 #include
int *f() { int *j=(int *)malloc(sizeof(int)); *j=10; return j; } main() { int *p=f(); printf("%d\n",*p); } Program 18 #include
struct st { int a:8; int b:5; }s; struct sm { int c:8; // int d:0; int e:8; }s1; main() { printf("%d\n",sizeof(s)); printf("%d\n",sizeof(s1)); } Program 19 #include
#include
enum a{NEGATIVE=-1,ZERO,POSITIVE}; void fun(int val) { if(val<=NEGATIVE) printf("negative\n"); else if(val>=POSITIVE) printf("positive\n"); else printf("its zero\n"); } main() { fun(-3); fun(2); return 0; } Program 20 //using printf() library function same like that use system call function pass one argument of string ex:printf("hello world!"); main() { char *str="hello world!"; //write(str); printf("%s\n",str); system("./p2"); //execv("hello world!"); }
« 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