Objects and Classes Questions

Practice Objects and Classes MCQs with answers and explanations. Page 1 of 3.

Category
C++ Programming
Topic
Objects and Classes
Page
1 / 3
Mode
Practice

Questions

Open any question to view the answer and explanation.

C++ constructors vs. destructors: which statement correctly compares their ability to take arguments and return values?
Open
View answer
C++ abstract classes: what is the correct way to make a class abstract (non-instantiable)?
Open
View answer
C++ class design: what relationship is expressed by the following definitions? class Bike { Engine objEng; }; class Engine { float CC; };
Open
View answer
C++ virtual base classes: what is their primary purpose in a multiple-inheritance hierarchy?
Open
View answer
C++ data members: which category is shared by all instances of the class?
Open
View answer
C++ friendship: which statement correctly describes valid use of the friend keyword inside a class?
Open
View answer
C++ static member functions: evaluate two claims about their access and how they are called.
Open
View answer
C++ public inheritance: under public inheritance, how do base-class public members appear in the derived class?
Open
View answer
C++ classes: what is the default access specifier used inside a class definition (if none is written)?
Open
View answer
In C++ polymorphic class design, which statement is correct regarding the destructor of a base class that may be deleted through a base pointer? Choose the best practice that prevents resource leaks and undefined behavior.
Open
View answer
In object-oriented analysis and design (C++/UML), what does a class hierarchy primarily depict? Select the relationship a class–subclass tree is intended to model.
Open
View answer
C++ static member function pointer: consider the program below. What is the correct outcome when compiling/linking? class CuriousTab { public: static void MyFunction(); }; int main() { void(ptr)() = &CuriousTab::MyFunction; return 0; }
Open
View answer
In C++ terminology, which entity is also known as an instance of a class? Select the most accurate term used in object-oriented programming.
Open
View answer
In C++ language features, which of the following can be overloaded to provide multiple meanings based on parameter types or counts? Choose the most complete answer.
Open
View answer
C++ inheritance syntax check: what happens when compiling the following class definitions? class Birds {}; class Peacock : protected Birds {};
Open
View answer
Dot operator (.) in C++: which pair of entities, read from left to right, can it legally connect? Pick the most precise description of member access.
Open
View answer
C++ syntax basics: what is the only technical difference between a struct and a class in C++ (ignoring stylistic conventions)?
Open
View answer
In object-oriented design, what term describes the use of an object of one class inside the definition of another class (i.e., a has-a relationship)?
Open
View answer
Access control in C++ classes: who can access private data members or private member functions of a class? Choose the most accurate rule.
Open
View answer
In C++ access control, which keyword is used specifically to control access to a class member (i.e., to set its accessibility level within and outside the class)?
Open
View answer

Practice smarter

Solve a few questions daily and revisit weak topics regularly to improve accuracy.