C interview questions – page 13

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

Advertisement
  1. X = fopen (b, c) what is b? a) pointer to a character array which contains the filename b) filename whithin double quotes c) can be anyone of the above d) none

  2. Write a program which accepts a filename as a command line argument and reverses the contents of the file( ie first character becomes the last character of the file and so on) Input: The program takes the file name whose content should be reversed. Output

  3. What would be the output of the following program? main() { int i=4; switch(i) { default: printf("n A mouse is an elephant built by the Japanese"); case 1: printf(" Breeding rabbits is a hair rai

  4. which of s, t and u are availeble to a function present in another file a. only s b. s & t c. s, t, u d. none ...

  5. What is extern?

  6. If the following program (myprog) is run from the command line as myprog friday tuesday sunday, What would be the output? main(int argc, char *argv[]) { printf("%c",*++argv[1]); }

  7. Int i = 20; printf ("%x", i); what is the output? a) x14 b) 14 c) 20 d) none of the above

  8. What is the output of the above program segment ?

  9. Pick up the correct function declaration.

  10. When you compiler a C and C++ code on X86 processor, what are the difference you see in object file?

  11. 1.WAP find the largest of 4 no using macros2.WAP read a line from file from location N1 to N2 using command line agruments Eg:exe 10 20 a.c

  12. What is the output of the following program:int main(){ char buff[]={ 0x11,0x11,0x11,0x11,0x22,0x22,0x22,0x22,0x33,0x33,0x33,0x33}; char* pEnd = buff + sizeof(buff) -1; long * plong = buff; short* pshort = buff; for(; plong<pEnd; plong++)

  13. Advertisement
  14. Give difference between structure and union and demonstrate union uses with examples.

  15. Read the function conv() given below

  16. when redirected to a screen what will be printed. 2 when redirected to file what will be printed.

  17. Z = scanf("%d %d", &x, &y); printf("%d", z);

  18. For(i=0; i<=10; i++, printf("%d",i));

  19. What is the output of the program?

  20. What is :- Token , identifier , block , parameter , argument , scope of variable , Macro ?

  21. Which of the following about automatic variables within a function is correct ?

  22. Given definition for a function which returns an array of pointers with argument of int*.

  23. How do u have constant members in a class?

  24. What is the value of *p; a) 2 b) 3 c) 4 d) 5 2) What is the value of (p - (&p - 2))? a) b) 2 c) d)

  25. Sizeof(structure)?

  26. Advertisement
  27. Write your own grep command in C. your program should handle basic regular expressions like * , . , ^ , $

  28. 1)What is static identifier? 2)Where are the auto variables stored?

  29. A variable carries a value.(already assigned OR from Scanf..what ever the way). I want to know whether the variable is positive or negative.Conditions:-----------1.NO looping logic should be used such as for ..while..etc.2.should not use > or <.3.should n

  30. Main must be written as

  31. Assume necessary header files are included. O/P ?

  32. Which of the following about the C comments is incorrect ?

Advertisement