Function/Variable Scope   «Prev 

C++ Functions and Scope - Quiz

Each question is worth one point. Select the best answer for each question.
1. The function header int foo(int y, int x = 4) means:
  A. y is called by value
  B. x has default value 4
  C. foo returns an int
  D. all of these

2. When two functions with the same name are defined in the same scope, the function is:
  A. double
  B. static
  C. overloaded
  D. inline

3. An overloaded function must have:
  A. different return types
  B. different executable statements
  C. different types and/or number of arguments
  D. all of these

4. To speed up a function make it:
  A. use doubles
  B. static
  C. overloaded
  D. inline

5. Only one of the following statements concerning resolving external references in multifile programs is true. Which one is it?
  A. External nonstatic variables must be defined in only one place.
  B. External static variables must be defined in only one place.
  C. Using the keyword extern with an initializer constitutes a declaration.
  D. Using the keyword extern without an initializer constitutes a definition.

6. To provide a unique scope similar in effect to the use of static external declarations, use:
  A. a default argument
  B. an inline function
  C. an anonymous namespace
  D. a function prototype

Correct answers:

Your Score: 0