C interview questions – page 11

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

Advertisement
  1. Difference between :- 1) NULL pointer and NULL macro ?

  2. Write one statement equivalent to the following two statements x = sqr(a); return(x);

  3. How to find the maximum rectangle in a histogram, and write C++ to implement it.

  4. You need to write a simple macro CHAR(x) which takes a character x and converts it into ASCII value of x.

  5. Int a[10]; a[-1] = 20;

  6. Differences between malloc() and calloc()

  7. What is the difference between following two?

  8. Size of integer and pointer? are they always same?

  9. Give a code snippet where using memcpy() will not give the desired output, but using memmove() will give the desired output.

  10. What is volatile keyword? can a register variable be volatile?

  11. Char a[5][15]; int b[5][15]; address of a 0x1000 and b is 0x2000, find address of a[3][4] and b[3][4]. Assume char is 8 bits and int is 32 bits

  12. How can you change the const int i = 10 to 11?

  13. Advertisement
  14. What is the output of below program?

  15. Sizeof(int)is a) always 2 bytes b) depends on compiler that is being used c) always 32 bits d) can't tell

  16. How would you return array from a function?

  17. Implement factorial, do remeber to handle the overflow case, which is actually the key point, otherwise this problem will be too simple

  18. Identify the incorrect expression

  19. Find out what this function does.

  20. How to convert decimal to octal and hexadecimal?

  21. Is there any way we can expansion other than Macros

  22. How do you pass a string to a function by its value ?

  23. Write Macros for decrement, subtract, dividewith, setZero, setEqual, ncreaseby1 and loop.

  24. What does the following function do?

  25. Some C function to swap int pointers.

  26. Advertisement
  27. Write your own memcopy function

  28. When free (ptr) is executed, then what will happen?

  29. Write a C program which measures the the speed of a context switch on a UNIX/Linux system.

  30. What are static functions in C?

  31. Differences b/w c++ structures & c structures.

  32. Implementation details about unions.

Advertisement