Tutorials - C++ Programming Quiz on Inline Functions

Quiz: Inline Functions in C++

If you're not sure you're ready to take a quiz on linline functions in C++, be sure to read through Cprogramming.com's inline functions tutorial. Otherwise, best of luck!

1. What does the inline keyword do?
A. Indicates a function declaration
B. Tells the compiler to use the function only within the same source code file
C. Causes all function calls to be replaced by the code from the function
D. Allows one-line function declarations

2. Why would you want to use inline functions?
A. To decrease the size of the resulting program
B. To increase the speed of the resulting program
C. To simplify the source code file
D. To remove unnecessary functions

3. Which of the following is a limit on inline functions?
A. Inline functions cannot return a value.
B. Inline functions must resturn a value.
C. Inline functions must be less than ten lines.
D. The compiler may choose to ignore an inline directive.

4. Which of the following is a valid inline for function foo?
A. inline void foo() {}
B. void foo() inline {}
C. inline:void foo() {}
D. None of the above

5. How can you ensure that an inline function isn't inlined for a particular function call for function foo?
A. unline x();
B. noexpand x();
C. x();
D. This is not possible on a case-by-case basis

Answer Key
Next lesson: Lesson 14, reading command-line arguments