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.


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.