C interview questions – page 3

2,130 questions. Tap “Show answer” to check yourself.

Advertisement
  1. prototype of sine function.

  2. #define min((a),(b)) ((a)

  3. int a=1,b=2,c=3; printf("%d,%d",a,b,c); What is the output?

  4. proc() { static i=10; printf("%d",i); } If this proc() is called second time, what is the output?

  5. int arr[] = {1,2,3,4} int *ptr=arr; *(arr+3) = *++ptr + *ptr++; Final contents of arr[]

  6. In scanf h is used for

  7. x=2,y=6,z=6 x=y==z; printf(%d",x)

  8. int i =10 main() { int i =20,n; for(n=0;n

  9. f=(x>y)?x:y a) f points to max of x and y b) f points to min of x and y c)error

  10. which of the function operator cannot be over loaded a)

  11. long int size a) 4 bytes b) 2 bytes c) compiler dependent d) 8 bytes

  12. i=20,k=0; for(j=1;j

  13. Advertisement
  14. HOW DO YOU HANDLE EXCEPTIONS IN C?

  15. WHAT IS THE DIFFERENCE BETWEEN malloc() and calloc() in c file management?

  16. Give the output for the following program. #define STYLE1 char main() { typedef char STYLE2; STYLE1 x; STYLE2 y; clrscr(); x=255; y=255; printf("%d %dn",x,y); }

  17. #ifdef TRUE int I=0; #endif main() { int j=0; printf("%d %dn",i,j); }

  18. What is the output for the following program #include main() { char a[5][5],flag; a[0][0]='A'; flag=((a==*a)&&(*a==a[0])); printf("%dn",flag); }

  19. What is the output of the program given below #include main() { char i=0; for(;i>=0;i++) ; printf("%dn",i); }

  20. What is the output of the following program #include main() { int i=0; fork(); printf("%d",i++); fork(); printf("%d",i++); fork(); wait(); }

  21. What is the memory allocated by the following definition ? int (*x)[10];

  22. What is the memory allocated by the following definition ? int (*x)();

  23. What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; main() { BAD g1; g1=1; printf("%d",g1); }

  24. what is the difference between const char *p, char const *p, const char* const p

  25. Write a program to interchange two variables without using the third variable?

  26. Advertisement
  27. Write a routine that prints out a 2-D array in spiral order!

  28. Write a program to compare two strings without using the strcmp() function

  29. macros and function are related in what aspect? a)recursion b)varying no of arguments c)hypochecking d)type declaration

  30. enum day = { jan = 1 ,feb=4, april, may} what is the value of may? a)4 b)5 c)6 d)11 e)none of the above

  31. 2.main { int x,j,k; j=k=6;x=2; x=j*k; printf("%d", x);

  32. fn f(x) { if(x

Advertisement