Question: 1. Select the derived class method definitions that represent actual method chaining (never mind the reason or effect, as long as it demonstrates a derived

1.

Select the derived class method definitions that represent actual method chaining (never mind the reason or effect, as long as it demonstrates a derived class method chaining to a base class method). There is more than one correct answer.

A.
string SubClass::toString(string msg) { return BaseClass::toString(msg) + " hi dad."; } 
B.
string SubClass::toString() { return BaseClass::toString("My Message ----") + " hi dad."; } 
C.
void SubClass::methodTwo(int a) { BaseClass::methodTwo(4); // calling int-parameter method // other stuff } 
D.
BaseClass::methodTwo(int a) : BaseClass::methodTwo(a) { // other stuff } 
E.
SubClass::methodTwo(int a) { BaseClass::methodOne(a); // other stuff } 

2.. Consider the following code fragment (assumed to be in an otherwise correct program):

 double *dubPtr; double dubArray[100]; dubPtr = new double[50]; dubPtr = dubArray; dubPtr[75] = 9; delete[] dubPtr; 

Assume there are no omitted statements within this fragment -- you see everything. Check the true statements (may be more than one):

A. It will compile without error but probably crash (i.e., generate a run-time error).
B. It has a compiler error.
C. It has an array bounds violation, possibly causing a fatal runtime error.
D. It has no compiler or runtime errors, although it is a little odd looking.
E. Some allocated memory becomes inaccessible, and therefore lost for further use in main(), while the program is still executing.
F.

Illegally attempts to delete non-dynamic memory.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!