Question: e the C++ program below is executed. Answer questions (i) and (ii) about the program's output. (OlI pt.] What is printed when Line V and

 e the C++ program below is executed. Answer questions (i) and

e the C++ program below is executed. Answer questions (i) and (ii) about the program's output. (OlI pt.] What is printed when Line V and Line W are executed? Circle the one correct answer: (a) Each of Line V and Line W prints "BaseClass's g" (b) Each of Line V and Line W prints "DerivedClass's g" (c) Line V prints "BaseClass's g", and Line W prints "Derivedclass's g (d) Line V prints "DerivedClass's g",and Line W prints "BaseClass's g" (e) The output is implementation-dependent, as there are two functions named g (ii)[1 pt.] What is printed when Line X and Linc Y are executed? Circle the one correct answer: (a) Each of Line X and Line Y prints "BaseClass's g" (b) Each of Line X and Line Y prints "DerivedClass's g" (c) Line X prints "Baseclass's g", and Line Y prints "DerivedClass's g (d) Line X prints "DerivedClass's g", and Line Y prints "BaseClass's g (e) The output is implementation-dependent, as there are two functions named g Suppose we modif the program by deleting the word "virtual " on Line A and on Line B, and we execute the modified program. Answer questions (ii) and (iv) about the modified program's output. (iii) 1pt. What is printed when Line V and Line are executed? Circle the one correct answer (a) Each of Line V and Line W prints "Baseclass's g" (b) Each of Line V and Line W prints "DerivedClass' s 9 (c) Line V prints "BaseClass's g", and Line W prints "Derivedclass's g". (d) Line V prints "DerivedClass's g", and Line W prints "Baseclass's g". (e) The output is implementation-dependent, as there are two nonvirtual functions named g (iv)II pt.] What is printed when Line X and Line Y are executed? Circle the one correct answer: (a) Each of Line X and Line Y prints "Baseclass's g" (b) Each of Line X and Line Y prints "DerivedClass's g" (c) Line X prints "BaseClass's g", and Line Y prints "DerivedClass's g" (d) Line X prints "DerivedClass's g", and Line Y prints "Baseclass's g". (e) The output is implementation-dependent, as there are two nonvirtual functions named g linclude using namespace std; class BaseClass i public: void cal1 g) g) virtual void g?) { cout call g) // Line W BaseClass *pBas new Derivedci ass; // Linev pBas->g() pBas->call g) // Line Y // Line X Page 9 of 1

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!