☰
×
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 Pgm - Choose the Correct Ans
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 - Choose the Correct Answer III
« Prev
Next »
C Program - Choose the Correct Answer
21. What is the output? #include
int main() { char *p; p="Hello"; printf("%c\n",*&*p); } Options a) Hello b) H c) some address will be printed d) None of these 22. What is the output of this C code? #include
int main() { int i=97,*p=&i; foo(&i); printf("%d\n",*p); return 0; } void foo(int *p) { int j=2; p=&j; printf("%d\n",*p); } Options a) 2 97 b) 2 2 c) compile time error d) 97 97 23. Which files will get closed through the fclose() in the following program ? #include
int main() { FILE *fs,*ft,*fp; fp=fopen("A.C","r"); fp=fopen("B.C","r"); fp=fopen("C.C","r"); fclose(fp,fs,ft); return 0; } Options a) "A.C""B.C""C.C" b) "B.C""C.C" c) "A.C" d) error in flcose() 24. Point out the correct statement which correctly free the memory pointed by 's' and 'p' in the following program ? #include
#include
int main() { struct ex { int i; float j; char *s; }; struct ex *p; p=(struct ex*)malloc(sizeof(struct ex)); p->s=(char*)malloc(20); return 0; } Options a) free(p); , free(p->s); b) free(p->s); , free(p); c) free(p->s); d) free(p); 25. What is the output of this code? #include
struct temp { int a; int b; int c; }p[]={0}; main() { printf("%d\n",sizeof(p)); } Options a) a)4) b) b)12 c) c)16 d) d)can’t be estimated due to ambiguous initialization of array 26. What is the output of this C code? #include
void main() { char *msg="hi"; printf(msg); } Options a) hi b) h c) hi followed by garbage value d) error 27. What will be the output of the program if the file sample.txt contains the string "e-con systems”? #include
int main() { FILE *ptr; char i; ptr=fopen("sample.txt","w"); while((i=fgetc(ptr))!=EOF) printf("%c",i); return 0; } Options a) compilation error b) print contents of file "sample.txt" up to NULL character c) infinite loop d) no output 28. How do you update x[2] to 10 using ptr2 ? #include
main() { int x[]={1,2,3,4,5}; int *ptr,**ptr2; ptr=x; ptr2=&ptr; //(**ptr2+2)=10;// lvalue //**(ptr2+2)=10;// s.g *(*ptr2+2)=10;// correct //*(&ptr2 + 2)=10; // 3 .. Incorrect printf("%d\n",x[2] ); } Options a) (**ptr2 + 2)=10 b) **(ptr2+2)=10 c) *(*ptr2+2)=10 d) *(&ptr2+2)=10 29. Assuming the processor is 32 bit memory addressing scheme #include
main() { char *p; short *q; long *r; p=q=r=0; p++; q++; r++; printf("%p...%p...%p\n",p,q,r); } 30. What is the max value that can be stored in the variable "test.a" struct mybits { unsigned short a : 3; unsigned short b : 5; unsigned short c : 7; }test; Options a) 127 b) 255 c) 7 d) 3
« 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