Choose the correct statement about inline function in C++.

2023

Choose the correct statement about inline function in C++.

  1. A.

    It speeds up the execution.

  2. B.

    It slows down the execution.

  3. C.

    It decreases the code size.

  4. D.

    More than one of the above

  5. E.

    None of the above

Attempted by 191 students.

Show answer & explanation

Correct answer: A

Inline functions in C++ are a suggestion to the compiler to replace function calls with the function body, reducing the overhead of function calls. This can improve execution speed, especially for small functions called frequently. However, inlining increases code size because the function code is duplicated at each call site. Therefore, excessive inlining may lead to larger executables and potentially slower performance due to increased cache pressure. The compiler decides whether to inline based on heuristics, and the 'inline' keyword is just a hint.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs