C Interview Questions And Answers

adplus-dvertising
C FAQS
Previous Home Next

   C Question

  1. What is a structure and a union in C?
     
  2. Define a structure for a simple name/address record.
     
  3. What does the typedef keyword do?
     
  4. Use typedef to make a short-cut way to declare a pointer to the nameAddr structure above. Call it addrPtr.
    Declare a variable with addrPtr called address.
    Assuming the variable address above, how would one refer to the city portion of the record within a C expression?
     
  5. What is the difference between: #include <stdio.h> and #include "stdio.h"
     
  6. What is #ifdef used for?
     
  7. How do you define a constant in C?
     
  8. Why can't you nest structure definitions?
     
  9. Can you nest function definitions?
     
  10. What is a forward reference?
     
  11. What are the following and how do they differ: int, long, float and double?
     
  12. Define a macro called SQR which squares a number.
     
  13. Is it possible to take the square-root of a number in C. Is there a square-root operator in C?
     
  14. Using fprintf() print a single floating point number right-justified in a field of 20 spaces, no leading zeros, and 4 decimal places. The destination should be stderr and the variable is called num.
     
  15. What is the difference between the & and && operators and the | and || operators?
     
  16. What is the difference between the -> and . operators?"
     
  17. What is the symbol for the modulus operator?
     
  18. From the standpoint of logic, what is the difference between the fragment:
     if (next < max)
    next++;
    else
    next = 0;
    and the fragment:
    next += (next < max)? (1):(-next);

    What does the following fragment do?
    while((d=c=getch(),d)!=EOF&&(c!='\t'||c!=' '||c!='\b')) *buff++ = ++c;
     
  19. Is C case sensitive (ie: does C differentiate between upper and lower case letters)?
     
  20. Specify how a filestream called inFile should be opened for random reading and writing. the file's name is in fileName.
    Previous Home Next