AllInfoHub Logo

AllInfoHub – MCQ Practice

Functions – Multiple Choice Questions (MCQs)

  1. 13. What is a base case in a recursive function?

    • A. The case where the function calls itself
    • B. The condition that stops the recursion
    • C. The initial value passed to the function
    • D. The return type of the function
  2. 14. What is the stack overflow error related to recursion?

    • A. Occurs when the base case is not reached
    • B. Occurs when the function returns the wrong value
    • C. Occurs due to insufficient memory for local variables
    • D. Occurs when there are too many global variables
  3. 15. What is a library function in C?

    • A. A function defined by the user
    • B. A function that calls other functions
    • C. A pre-written function available in C libraries
    • D. A function with no return value
  4. 16. Which header file typically contains standard input/output functions like printf and scanf?

    • A. stdio.h
    • B. conio.h
    • C. math.h
    • D. string.h
  5. 17. Which header file typically contains mathematical functions like sqrt and pow?

    • A. stdio.h
    • B. conio.h
    • C. math.h
    • D. string.h
  6. 18. What is pass by value in C?

    • A. Passing the actual value of a variable to a function
    • B. Passing the memory address of a variable to a function
    • C. Passing a copy of the variable to the function
    • D. Modifying the original variable inside the function
  7. 19. What is pass by reference (using pointers) in C?

    • A. Passing the actual value of a variable to a function
    • B. Passing the memory address of a variable to a function
    • C. Passing a copy of the variable
    • D. The original variable cannot be modified
  8. 20. What is a function pointer in C?

    • A. A pointer to a variable
    • B. A pointer to the first instruction of a function
    • C. A pointer to the return value of a function
    • D. A pointer to the parameters of a function
  9. 21. What is the purpose of using function pointers?

    • A. To pass functions as arguments to other functions
    • B. To store the return value of a function
    • C. To declare variables inside a function
    • D. To define the function body
  10. 22. What is a static function in C?

    • A. A function that can only be called once
    • B. A function that is stored in static memory
    • C. A function whose scope is limited to the file in which it is defined
    • D. A recursive function
  11. 23. What is an inline function in C?

    • A. A function that is executed in a separate memory block
    • B. A function whose code is substituted at the point of call
    • C. A function that is defined outside the main function
    • D. A recursive function
  12. 24. What is the advantage of using inline functions?

    • A. Reduced function call overhead
    • B. Increased code size
    • C. Improved code readability
    • D. Easier debugging