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

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

Master C++ with our comprehensive quiz based on 'Thinking in C++'. Test your knowledge through flashcards and multiple-choice questions to enhance your understanding of C++. Prepare effectively for your exam!

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.


How are class objects declared static inside functions initialized?

  1. Using assignment to zero

  2. With a default constructor call

  3. With arbitrary expressions

  4. They cannot be initialized

The correct answer is: With a default constructor call

Static class objects can be initialized only with a simple constant expression, not arbitrary expression, thus eliminating the option C. These objects can be initialized even without a constructor function, so A and D are incorrect.