Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

12. Consider C++ class. Which one of the following choices is NOT correct? A. Cl

ID: 3716607 • Letter: 1

Question

12. Consider C++ class. Which one of the following choices is NOT correct?

A. Class instances can be static, stack dynamic, or heap dynamic.

B. If static or stack dynamic, they are referenced directly with value variables.

C. If stack dynamic, they are referenced through pointers.

D. Stack dynamic instances of classes are always created by the elaboration of an object declaration.

E. The lifetime of such a class instance ends when the end of the scope of its declaration is reached.

13. Consider C++ class. Which one of the following choices is NOT correct?

A. Heap dynamic class instances are created with the new operator.

B. Heap dynamic class instances are destroyed with the delete operator.

C. Stack-dynamic classes can have pointer data members that reference heap dynamic data.

D. Heap-dynamic classes can have pointer data members that reference stack-dynamic data.

14. Consider C++ class. Which one of the following choices is NOT correct?

A. C++ allows the user to include constructor, to initialize the data members of newly created objects.

B. C++ constructor may also allocate the heap-dynamic data that are referenced by the pointer members of the new object.

C. C++ Constructors are implicitly called when an object of the class type is created.

D. C++ constructor has the same name as the class whose objects it initializes.

E. C++ Constructors can be inherited but cannot be overloaded.

15. Consider C++ class. Which one of the following choices is NOT correct?

A. C++ class can also include a destructor, which is implicitly called when the lifetime of an instance of the class ends.

B. Destructor function can include a delete operator on the pointer members to deallocate the heap space they reference.

C. Destructors are often used as a debugging aid, in which case they simply display or print the values of some or all of the object’s data members before those members are deallocated.

D. The name of a destructor is the class’s name, preceded by a tilde (~).

E. Constructors or destructors have return types.

Explanation / Answer

13.
   Ans: D. Heap-dynamic classes can have pointer data members that reference stack-dynamic data.
14.
   Ans: E. C++ Constructors can be inherited but cannot be overloaded.

15.
   ANs: E. Constructors or destructors have return types.