🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Function Pointers in C: questions with answers

15 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does int (fp)(double); declare?
  2. Q2. What does this print? (code)
  3. Q3. What does int f(int); declare?
  4. Q4. A qsort comparator should return a negative value when:
  5. Q5. Why do qsort comparators take const void parameters?
  6. Q6. What is a callback?
  7. Q7. What does this print? (code)
  8. Q8. Why is return a - b; risky as a comparator for ints?
  9. Q9. Which line correctly stores the address of void greet(void) in a pointer?
  10. Q10. Why does a typedef help with function pointers?
  11. Q11. What does this print? (code)
  12. Q12. What does this print? (code)
  13. Q13. If fp is a function pointer, are fp(5) and (fp)(5) different?
  14. Q14. How do you make a qsort comparator sort ints in descending order?
  15. Q15. What happens if you call a function pointer that is NULL?