☰
×
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 II
« Prev
Next »
C Tricky Questions - Find Output
Program 21 #include
#include
struct st { int a; char b; void *c; }; main() { struct st *ptr=NULL; printf("a:%d\tb:%d\tc:%d\t*ptr:%d\n", sizeof(ptr->a), sizeof(ptr->b), sizeof(ptr->c), sizeof(*ptr)); } Program 22 #include
#include
main() { int *p1,*p2,*p3; p1=malloc(10); free(p1); p2=malloc(5); free(p1); p3=malloc(5); } Program 23 #include
#define ABC() 20 #define XYZ 10 #define NUM ABC()-XYZ main() { int a=10,c; c=a*NUM; printf("%d\n",c); } Program 24 #include
#include
void allocate(char *s) { s=malloc(10); strcpy(s,"hello"); } main() { char *ptr; allocate(ptr); printf("%s\n",ptr); } Program 25 #include
main() { char a[20]; char *p,*q; p=&a[0]; q=&a[10]; printf("%d %d\n",q-p,&q-&p); } Program 26 #include
main() { register int i=10; int *ptr; ptr=&i; printf("%d\n",*ptr); } Program 27 #include
main() { int i=258; char c1=i; char c2=i>>8; printf("c1=%d c2=%d c1+c2=%d\n",c1,c2,c1+c2); } Program 28 #include
#include
main() { static int i,c,d,j,p,q,l; char z[70], a[]="abcdefghijklmnopqustuvwxyz"; char b[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //z=malloc(sizeof (a)+sizeof (b) +1); do { for(i;i<=c+d;i++) z[l++]=a[i]; c++; for(j;j<=p+q;j++) z[l++]=b[j]; p++; d=i; q=j; }while(b[j]!='\0'); z[l]='\0'; printf("%s\n",z); } Program 29 #include
main() { if(!printf("hello")) { } else printf("world\n"); printf("%d"); } Program 30 /*int i=7,*p; *p=i; printf("%d %d\n",*p,p); } */ /*int a[10]={1,2,3,4}; int i; for(i=0;i<9;i++); printf("i=%d a[i]=%d\n",i,a[i]); }*/ Program 31 #include
main() { char ch; scanf(" %c",&ch,printf("enter the character..\n")); if(ch>='A' && ch<='Z') printf("%c\n",(90-ch)+65); else printf("%c\n",(122-ch)+97); } Program 32 #include
#include
/*main(int argc,char *p[printf("hai\n")]) { } */ /*main() { printf("%d\n"); }*/ Program 33 char *pri(void); main() { char *p,*q; q=pri(); printf("%s\n",q); } char* pri(void) { return "hello"; //hello is diffferent then "hello" Program 34 main() { char *p="hello"; p[0]='H'; printf("%s\n",p); } Program 35 main(int argc,char **argv) { int r; printf("MAIN\n"); r=(main && argc)?main(argc-NULL):0; printf("%d\n",r); } Program 36 main() { printf("%x\n",-1<<3); printf("%x\n",-1<<2); } Program 37 main() { int arr[]={10,20}; int *p; char *q; p=arr; p++; q=(char *)arr; //array converted to char arr q++; printf("%d\n",*p); printf("%d\n",*q); } Program 38 int n=5; main() { int p[5]={5,4,3,2,1}; int i,n; pri(&p); } void pri(int *a) { int i;//,n=5; for(i=0;i
« 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