C++ Class Construct  «Prev  Next»

C++ Class Internals - Quiz

Each question is worth one point. Please select the correct answer.
 
1. The expression cout << ::i means: Please select the best answer.
  A. print the global variable i
  B. print the local variable i
  C. print the value of i in the nearest enclosing scope
  D. none of these

2. An int i is a static data member of class X if which condition is met:
Please select the best answer.
  A. it is declared static within the class
  B. it is shared by all variables of that class
  C. it is accessible as X::i
  D. all of the above

3. If class IN is declared in class OUT and int i is in IN, how would you reference i unambiguously? Please select the best answer.
  A. IN::OUT::i
  B. OUT::i
  C. OUT::IN::i
  D. ::i

4. The this pointer: Please select the best answer.
  A. is const and therefore cannot have its value altered
  B. is available for native types
  C. is mutable and can have its value altered
  D. must be explicitly declared in a class

5. A static member function: Please select the best answer.
  A. does not have access to this pointer arguments
  B. must be public
  C. is a class variable
  C. none of the above

Correct answers:

Your Score: 0