NTA UGC NET Dec 2023 Paper-2
May 23, 2024NTA UGC NET Dec 2023 Paper-2
May 23, 2024NTA UGC NET Dec 2023 Paper-2
Question 26 |
Which of the statement are CORRECT ?
(A) Constructors are invoked automatically when the objects are created.
(B) Constructors do not have return types, not even void and therefore they cannot return values.
(C) Constructors cannot be inherited through a derived class and can call the base class constructors.
(D) Constructors can be declared as virtual.
Choose the correct answer from the options given below :
(A) Constructors are invoked automatically when the objects are created.
(B) Constructors do not have return types, not even void and therefore they cannot return values.
(C) Constructors cannot be inherited through a derived class and can call the base class constructors.
(D) Constructors can be declared as virtual.
Choose the correct answer from the options given below :
(A), (B) and (D) only | |
(A), (B) and (C) Only | |
(B), (C) and (D) Only | |
(A),(C) and (D) only |
Question 26 Explanation:
(A) Constructors are invoked automatically when the objects are created.
True. This is the primary purpose of constructors: to initialize objects when they’re created, ensuring they’re in a valid state.
(B) Constructors do not have return types, not even void, and therefore they cannot return values.
True. Constructors are not designed to return values. Their role is to set up the object’s initial state, not to produce output.
(C) Constructors cannot be inherited, though a derived class can call the base class constructors.
True. Constructors are not inherited like regular member functions. However, derived classes can explicitly call constructors from their base classes to ensure proper initialization of inherited members.
(D) Constructors can be declared as virtual.
False. Constructors cannot be virtual. Virtual functions enable dynamic dispatch at runtime, but constructors are invoked during object creation, before polymorphism comes into play.
True. This is the primary purpose of constructors: to initialize objects when they’re created, ensuring they’re in a valid state.
(B) Constructors do not have return types, not even void, and therefore they cannot return values.
True. Constructors are not designed to return values. Their role is to set up the object’s initial state, not to produce output.
(C) Constructors cannot be inherited, though a derived class can call the base class constructors.
True. Constructors are not inherited like regular member functions. However, derived classes can explicitly call constructors from their base classes to ensure proper initialization of inherited members.
(D) Constructors can be declared as virtual.
False. Constructors cannot be virtual. Virtual functions enable dynamic dispatch at runtime, but constructors are invoked during object creation, before polymorphism comes into play.
Correct Answer: B
Question 26 Explanation:
(A) Constructors are invoked automatically when the objects are created.
True. This is the primary purpose of constructors: to initialize objects when they’re created, ensuring they’re in a valid state.
(B) Constructors do not have return types, not even void, and therefore they cannot return values.
True. Constructors are not designed to return values. Their role is to set up the object’s initial state, not to produce output.
(C) Constructors cannot be inherited, though a derived class can call the base class constructors.
True. Constructors are not inherited like regular member functions. However, derived classes can explicitly call constructors from their base classes to ensure proper initialization of inherited members.
(D) Constructors can be declared as virtual.
False. Constructors cannot be virtual. Virtual functions enable dynamic dispatch at runtime, but constructors are invoked during object creation, before polymorphism comes into play.
True. This is the primary purpose of constructors: to initialize objects when they’re created, ensuring they’re in a valid state.
(B) Constructors do not have return types, not even void, and therefore they cannot return values.
True. Constructors are not designed to return values. Their role is to set up the object’s initial state, not to produce output.
(C) Constructors cannot be inherited, though a derived class can call the base class constructors.
True. Constructors are not inherited like regular member functions. However, derived classes can explicitly call constructors from their base classes to ensure proper initialization of inherited members.
(D) Constructors can be declared as virtual.
False. Constructors cannot be virtual. Virtual functions enable dynamic dispatch at runtime, but constructors are invoked during object creation, before polymorphism comes into play.