In C++, constructors and destructors are special member functions critical for the Resource Acquisition Is Initialization (RAII) paradigm and safe memory management. A constructor automatically initializes an object when it is instantiated, allowing for default, parameterized, and copy variations to establish an object’s initial state. Conversely, a destructor is invoked automatically when an object goes out of scope or is explicitly deleted, ensuring that dynamically allocated memory and system resources are safely released. Advanced C++ programming relies heavily on constructor initializer lists for const or reference members, and virtual destructors to prevent memory leaks during polymorphic base-class deletion. Understanding the strict execution hierarchy—where base class constructors execute before derived ones, and destructors execute in the exact reverse order—is essential for robust object-oriented software design.
C++ Constructors and Destructors MCQs
1 min read
Correct Answer: a) Initialize objects
Explanation:
Constructors set up initial state when objects are created.
Correct Answer: b) The class name
Explanation:
A constructor has the same name as its class.
Correct Answer: c) It has no return type
Explanation:
Constructors do not declare return types.
Correct Answer: d) At object creation
Explanation:
Constructors run when an object is created.
Correct Answer: a) A constructor that can be called with no arguments
Explanation:
Default constructors create objects without requiring arguments.
Correct Answer: b) A constructor that takes arguments
Explanation:
Parameterized constructors initialize objects using supplied values.
Correct Answer: c) Initializes an object from another object of the same class
Explanation:
Copy constructors create new objects as copies.
Correct Answer: d) Transfers resources from an rvalue source
Explanation:
Move constructors avoid deep copies by transferring ownership.
Correct Answer: a) ~MyClass
Explanation:
Destructors use a tilde before the class name.
Correct Answer: b) It has no return type
Explanation:
Destructors do not declare return types.
Correct Answer: c) None
Explanation:
Destructors cannot take arguments.
Correct Answer: d) When an object is destroyed
Explanation:
Destructors clean up objects at end of lifetime.
Correct Answer: a) Yes
Explanation:
Private constructors restrict object creation.
Correct Answer: b) Yes
Explanation:
Private destructors restrict deletion or destruction.
Correct Answer: c) Yes
Explanation:
A class can have multiple constructors with different signatures.
Correct Answer: d) No
Explanation:
A class has only one destructor with no parameters.
Correct Answer: a) No
Explanation:
Constructors cannot be virtual.
Correct Answer: b) Yes
Explanation:
Virtual destructors support safe polymorphic deletion.
Correct Answer: c) No
Explanation:
Constructors are associated with object initialization, not static dispatch.
Correct Answer: d) No
Explanation:
Destructors operate on objects and cannot be static.
Correct Answer: a) No
Explanation:
Constructors initialize objects and are not const-qualified.
Correct Answer: b) Yes
Explanation:
Member functions can be called, but object state may still be incomplete.
Correct Answer: c) Yes, using syntax such as obj.~MyClass()
Explanation:
Explicit destructor calls are allowed but usually avoided.
Correct Answer: d) No, unless using special techniques like placement new
Explanation:
Automatic and delete-based cleanup normally calls destructors.
Correct Answer: a) The compiler may declare a default constructor
Explanation:
An implicit default constructor may be declared when needed.
Correct Answer: b) The compiler generates a destructor
Explanation:
An implicit destructor is provided if none is declared.
Correct Answer: c) Initializes members before the constructor body runs
Explanation:
Initializer lists perform direct member initialization.
Correct Answer: d) A reference member
Explanation:
References must be bound during initialization.
Correct Answer: a) Declaration order
Explanation:
Members are initialized in the order they are declared.
Correct Answer: b) Base class construction
Explanation:
Base subobjects are constructed before derived parts.
Correct Answer: c) Derived destructor body runs, then base destruction occurs
Explanation:
Destruction proceeds from most derived to base.
Correct Answer: d) Fully constructed subobjects are destroyed
Explanation:
Construction failure destroys already-constructed parts.
Correct Answer: a) A constructor that calls another constructor in the same class
Explanation:
Delegating constructors reduce duplicated initialization code.
Correct Answer: b) using Base::Base;
Explanation:
A using declaration can inherit base constructors.
Correct Answer: c) Implicit conversions from the constructor argument
Explanation:
explicit requires direct initialization.
Correct Answer: d) A constructor that can convert from another type
Explanation:
It allows construction from a compatible argument.
Correct Answer: a) Compiler optimization that omits a copy or move
Explanation:
Copy elision can avoid creating temporary objects.
Correct Answer: b) Destructor, copy constructor, copy assignment operator
Explanation:
If one of these is needed, the others often are too.
Correct Answer: c) Move constructor and move assignment operator
Explanation:
C++11 adds move operations to resource management.
Correct Answer: d) Let default or compiler-generated special members manage resources
Explanation:
Prefer classes that do not need custom special member functions.
Correct Answer: a) MyClass() = default;
Explanation:
= default requests compiler-generated behavior.
Correct Answer: b) = delete
Explanation:
Deleted functions cannot be used.
Correct Answer: c) To prevent copying
Explanation:
Deleted copy construction makes objects non-copyable.
Correct Answer: d) Yes
Explanation:
MyClass() = delete; prevents default construction.
Correct Answer: a) Yes
Explanation:
MyClass(const MyClass&) = default; uses compiler behavior.
Correct Answer: b) Yes
Explanation:
MyClass(MyClass&&) = default; requests default move behavior.
Correct Answer: c) They are not implicitly available
Explanation:
Declaring move operations suppresses implicit copy operations.
Correct Answer: d) They are not implicitly declared
Explanation:
User-declared destructors suppress implicit move operations.
Correct Answer: a) They are not implicitly declared
Explanation:
Declaring copy operations suppresses implicit move operations.
Correct Answer: b) It is not implicitly declared
Explanation:
Any user-declared constructor suppresses the implicit default constructor.
Correct Answer: c) A constructor defined by the user
Explanation:
User-provided constructors have user-written definitions.
Correct Answer: d) Default constructor
Explanation:
Object creation without arguments uses a default constructor.
Correct Answer: a) Copy constructor
Explanation:
Direct initialization from an object uses copy construction.
Correct Answer: b) Copy constructor
Explanation:
Copy initialization creates a new object using copy construction.
Correct Answer: c) Copy assignment operator
Explanation:
Assignment to an existing object uses assignment, not construction.
Correct Answer: d) Move constructor
Explanation:
An rvalue argument can invoke move construction.
Correct Answer: a) Yes, in the initializer list
Explanation:
Derived constructors can pass arguments to base constructors.
Correct Answer: b) In the initializer list
Explanation:
Base initialization appears after the constructor parameter list.
Correct Answer: c) Derived constructor must explicitly call a base constructor
Explanation:
The derived class must choose an accessible base constructor.
Correct Answer: d) The default base constructor is used if available
Explanation:
Otherwise, compilation fails if no default constructor exists.
Correct Answer: a) A constructor is called for each element
Explanation:
Each array element is constructed.
Correct Answer: b) Allocates memory and calls a constructor
Explanation:
new combines allocation and construction.
Correct Answer: c) Calls destructor and frees memory
Explanation:
delete destroys the object then releases memory.
Correct Answer: d) Calls a constructor for each of the 10 elements
Explanation:
Array new constructs every element.
Correct Answer: a) Calls a destructor for each element
Explanation:
Array delete destroys all elements.
Correct Answer: b) Yes
Explanation:
A pure virtual destructor can make a class abstract.
Correct Answer: c) A definition outside the class
Explanation:
Derived destructors need the base destructor definition.
Correct Answer: a) When deleting derived objects through base pointers
Explanation:
It ensures the correct destructor chain runs.
Correct Answer: a) Undefined behavior
Explanation:
Only the base destructor may run.
Correct Answer: b) Yes
Explanation:
Protected destructors restrict who can destroy objects.
Correct Answer: c) Restricts destruction to derived classes or friends
Explanation:
It controls object lifetime access.
Correct Answer: d) Restricts destruction
Explanation:
Private destructors prevent normal deletion outside the class.
Correct Answer: a) Automatic destruction
Explanation:
Smart pointers delete objects when ownership ends.
Correct Answer: b) delete
Explanation:
unique_ptr releases its owned object with delete.
Correct Answer: c) When the last shared_ptr owner is destroyed or reset
Explanation:
shared_ptr uses reference counting.
Correct Answer: d) No
Explanation:
weak_ptr does not own the object.
Correct Answer: a) Yes
Explanation:
Default arguments can reduce constructor overloads.
Correct Answer: b) Yes
Explanation:
Constructors defined inside a class are implicitly inline.
Correct Answer: c) Yes, if requirements are met
Explanation:
constexpr constructors allow compile-time initialization.
Correct Answer: d) Release resources acquired by the object
Explanation:
RAII ties resource cleanup to object destruction.
Correct Answer: a) Delegating constructor syntax
Explanation:
A constructor can delegate to another constructor.
Correct Answer: b) Yes
Explanation:
Constructors can have separate declarations and definitions.
Correct Answer: c) Yes
Explanation:
Destructors can also be defined out of line.
Correct Answer: d) Delete it
Explanation:
Destructors release owned dynamic memory.
Correct Answer: a) Double deletion
Explanation:
Two objects may delete the same resource.
Correct Answer: b) Allocate separate resources for the new object
Explanation:
Deep copies prevent shared ownership problems.
Correct Answer: c) Leave it in a safe state
Explanation:
Moved-from objects should be safely destructible and assignable.
Correct Answer: d) Avoid throwing exceptions
Explanation:
Throwing from destructors can cause termination during stack unwinding.
Correct Answer: a) Destructors are noexcept by default in modern C++
Explanation:
Since C++11, destructors are implicitly noexcept unless specified otherwise.
Correct Answer: b) Yes
Explanation:
noexcept can specify that construction does not throw.
Correct Answer: c) No
Explanation:
A failed constructor means the object was not created successfully.
Correct Answer: d) Before the body
Explanation:
Member initialization happens before constructor body execution.
Correct Answer: a) Base classes
Explanation:
Base subobjects are constructed before derived members.
Correct Answer: b) After the destructor body
Explanation:
The destructor body runs before members are destroyed.
Correct Answer: c) After derived members are destroyed
Explanation:
Destruction order is derived body, members, then bases.
Correct Answer: d) At program exit
Explanation:
Static local objects are destroyed during program termination.
Correct Answer: a) At program exit
Explanation:
Global objects are destroyed during program shutdown.
Correct Answer: b) Calling the destructor explicitly
Explanation:
Placement new separates allocation from construction.
Correct Answer: c) Controlling object creation
Explanation:
Factories can choose and construct appropriate objects.
Correct Answer: d) Use RAII with constructors and destructors
Explanation:
RAII provides predictable resource management.
Related Posts
New
NewNew

C++ Classes and Objects - MCQs
In C++, a class is a fundamental building block of Object-Oriented Programming (OOP) that acts as a user-defined blueprint for…
October 19, 2026By MCQs Generator
No Image
C++ Inheritance and Polymorphism - MCQs
1. What is the main purpose of a constructor? a) Initialize objects b) Delete objects c) Allocate globals d) Define…
October 19, 2026By MCQs Generator

C++ Memory Management MCQs
Memory management in C++ empowers developers with direct control over hardware resources, primarily through the allocation and deallocation of memory…
October 20, 2026By MCQs Generator








