Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++'

Disable ads (and more) with a membership for a one time $2.99 payment

Test your C++ skills with our quiz based on Bruce Eckel's 'Thinking in C++'. Dive into object-oriented programming, advanced topics, and fundamentals. Perfect for learners and experts alike. Assess your knowledge and become a C++ master!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What keyword is used to define an inline function?

  1. inline

  2. macro

  3. define

  4. const

The correct answer is: inline

Inline functions are functions that are defined and declared within the same line and are automatically expanded at compile time. This allows for faster execution and reduced runtime overhead compared to conventional functions. Therefore, the "inline" keyword is specifically used for this purpose. As for the other options, "macro" and "const" are also used in code but not specifically for defining inline functions. "Define" is a generic C++ keyword used for defining things such as constants, variables, and data types, but it is not specific to inline functions. Therefore, option A is the most appropriate and specific keyword for defining an inline function.