← All topics
Quiz: C++ Classes and Objects: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What is the default access level of members in a C++ class?
- Q2. When does a destructor run?
- Q3. What does this print? (code)
- Q4. What does a const member function promise?
- Q5. How many copies of a static data member exist for 100 objects?
- Q6. What does this print? (code)
- Q7. What does this print? (code)
- Q8. Why should members be set in the constructor's initializer list rather than by assignment in the body?
- Q9. Why can a static member function not use non-static data members directly?
- Q10. A setter returns this by reference. What does this make possible?