0% found this document useful (0 votes)
3 views

Module 3 (Quiz)

The document is a record of a quiz taken by a respondent on C++ inheritance concepts, where they scored 2 out of 10 points. It includes questions about inheritance types, the Diamond Problem, and access specifiers, with some correct and incorrect answers noted. The quiz was conducted by VIT Bhopal University.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Module 3 (Quiz)

The document is a record of a quiz taken by a respondent on C++ inheritance concepts, where they scored 2 out of 10 points. It includes questions about inheritance types, the Diamond Problem, and access specifiers, with some correct and incorrect answers noted. The quiz was conducted by VIT Bhopal University.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

05/04/2024, 16:17 Module-3 (Quiz)

Module-3 (Quiz) Total points 2/10

The respondent's email ([email protected]) was recorded on


submission of this form.

Reg No. *

aafi

What is the purpose of inheritance in C++? ···/2

A) Code reusability

B) Polymorphism

C) Encapsulation

D) All of the above

E) None of the above

No correct answers

https://docs.google.com/forms/d/e/1FAIpQLSdCWqRc57aukIQwn-Ak677kE0Y16iUyUoUmRM-CPvmYbV6MBQ/viewscore?viewscore=AE0zAgC… 1/5
05/04/2024, 16:17 Module-3 (Quiz)

Which type of inheritance involves a class being derived from two 0/1
classes, one of which is a base class and the other is derived from that
base?

A) Single inheritance

B) Multiple inheritance

C) Multilevel inheritance

D) Hybrid inheritance

Correct answer

D) Hybrid inheritance

What is the Diamond Problem in C++? 1/1

A) A problem where two classes inherit from the same base class, and a class
derived from these two classes tries to access a member of the base class.

B) A problem where two classes inherit from each other, causing ambiguity in
accessing members.

C) A problem where a class has multiple base classes that have a common base
class, leading to ambiguity in member access.

D) A problem related to multiple inheritance in C++.

How do you call the base class constructor from a derived class 0/1
constructor in C++?

A) super();

B) BaseClass();

C) BaseClass::BaseClass();

D) DerivedClass::BaseClass();

https://docs.google.com/forms/d/e/1FAIpQLSdCWqRc57aukIQwn-Ak677kE0Y16iUyUoUmRM-CPvmYbV6MBQ/viewscore?viewscore=AE0zAgC… 2/5
05/04/2024, 16:17 Module-3 (Quiz)

How can the Diamond Problem in C++ be resolved? 0/2

A) Using virtual inheritance

B) Using multiple inheritance

C) Using static inheritance

D) By avoiding multiple inheritance altogether

Correct answer

A) Using virtual inheritance

D) By avoiding multiple inheritance altogether

Which access specifier is used to specify that a base class member is 0/1
accessible only within the base class and its derived classes?

A) private

B) protected

C) public

D) internal

Correct answer

B) protected

https://docs.google.com/forms/d/e/1FAIpQLSdCWqRc57aukIQwn-Ak677kE0Y16iUyUoUmRM-CPvmYbV6MBQ/viewscore?viewscore=AE0zAgC… 3/5
05/04/2024, 16:17 Module-3 (Quiz)

Which type of inheritance allows a class to inherit from more than one 0/1
base class?

A) Single inheritance

B) Multiple inheritance

C) Multilevel inheritance

D) Hybrid inheritance

Correct answer

B) Multiple inheritance

Which of the following statements about virtual inheritance in C++ is true? 1/1

A) It ensures that only one copy of the base class's member variables is inherited
by the derived class.

B) It resolves the Diamond Problem by ensuring that the base class is inherited
only once in the hierarchy.

C) It is achieved by using the keyword virtual when inheriting a base class.

D) It is recommended to use virtual inheritance whenever multiple inheritance is


involved.

This form was created inside of VIT Bhopal University. Report Abuse

Forms

https://docs.google.com/forms/d/e/1FAIpQLSdCWqRc57aukIQwn-Ak677kE0Y16iUyUoUmRM-CPvmYbV6MBQ/viewscore?viewscore=AE0zAgC… 4/5
05/04/2024, 16:17 Module-3 (Quiz)

https://docs.google.com/forms/d/e/1FAIpQLSdCWqRc57aukIQwn-Ak677kE0Y16iUyUoUmRM-CPvmYbV6MBQ/viewscore?viewscore=AE0zAgC… 5/5

You might also like