My Report (&Account)

Object Oriented Programming Inheritance Test – 2


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)

1. If class A has two nested classes B and C. Class D has one nested class E, and have inherited class A. If E inherits B and C, then ________________

Question 1 of 10 (sanfoundry.com)

2. Which among the following is true?

Question 2 of 10 (sanfoundry.com)

3. Which type of inheritance is illustrated by the following code?

class student{ public: int marks; };
class topper: public student { public: char grade; };
class average{ public: int makrs_needed; };
class section: public average{ public: char name[10];  };
class overall: public average{  public: int students;  };

Question 3 of 10 (sanfoundry.com)

4. How many classes can be inherited by a single class in java?

Question 4 of 10 (sanfoundry.com)

5. Which among the following is correct for the following code?

class A
{  
    public : class B 
    { 
        public : B(int i): data(i)
        { 
        }
        int data;
    }
};
class C: public A
{
     class D:public A::B{ };
};

Question 5 of 10 (sanfoundry.com)

6. Which type of inheritance cannot involve private inheritance?

Question 6 of 10 (sanfoundry.com)

7. If 6 classes uses single level inheritance with pair classes (3 pairs), which inheritance will this be called?

Question 7 of 10 (sanfoundry.com)

8. Which among the following best describes multiple inheritance?

Question 8 of 10 (sanfoundry.com)

9. How many types of inheritance can be used at a time in a single program?

Question 9 of 10 (sanfoundry.com)

10. If multi-level inheritance is used, First class B inherits class A, then C inherits B and so on. Till how many classes can this go on?

Question 10 of 10 (sanfoundry.com)


 

Start practicing “1000 MCQs on Object Oriented Programming”, and once you are ready, you can take tests on all topics by attempting our “Object Oriented Programming Test Series”.

advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
I’m Manish - Founder and CTO at Sanfoundry. I’ve been working in tech for over 25 years, with deep focus on Linux kernel, SAN technologies, Advanced C, Full Stack and Scalable website designs.

You can connect with me on LinkedIn, watch my Youtube Masterclasses, or join my Telegram tech discussions.

If you’re in your 20s–40s and exploring new directions in your career, I also offer mentoring. Learn more here.