Multiple choice technology programming languages

During Compilation, The function call is replaced by function code for which function?

  1. Virtual functions

  2. Inline functions

  3. Static functions

  4. Friend functions

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Inline functions are expanded at compile time - the compiler replaces the function call with the actual function code, eliminating the overhead of function call mechanism. Virtual functions use dynamic binding, static functions have class scope, and friend functions are non-member functions with special access rights.

AI explanation

Inline functions are expanded by the compiler at each call site: the function call is literally replaced with the function's own code, avoiding the overhead of a normal function call at the cost of a larger compiled binary. Virtual functions, by contrast, are resolved at runtime via a vtable and specifically cannot be inlined when called polymorphically, since the actual implementation isn't known until execution.