0% found this document useful (0 votes)
40 views3 pages

Assessment Type: Summative: End of CO: in LMS

This document contains an assessment on implementing inheritance in C++. It includes 4 multiple choice questions testing recall of key concepts such as abstract classes having pure virtual functions and the ability to create instances of abstract classes. It also provides an example of an abstract base class Shape with derived classes Rectangle and Circle, demonstrating polymorphism through the draw() method.

Uploaded by

Sujit Birajdar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views3 pages

Assessment Type: Summative: End of CO: in LMS

This document contains an assessment on implementing inheritance in C++. It includes 4 multiple choice questions testing recall of key concepts such as abstract classes having pure virtual functions and the ability to create instances of abstract classes. It also provides an example of an abstract base class Shape with derived classes Rectangle and Circle, demonstrating polymorphism through the draw() method.

Uploaded by

Sujit Birajdar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

<CO3I>: <22316>: <Object Oriented Programming>: < Implement Inheritance in C++>: <LO5>:

<Assessments>: <Formative>

<Pratibha Pednekar>

Assessment Type: Summative: End of CO: in LMS

Summative: Q 1 Summative: Q 2

We can create instance of abstract A class having pure virtual


class_____
function is called as_____

Recall/ Remembering Recall/ Remembering

a. True a) virtual class

b) false b) abstract class

c) c)both of these

d) d)none of these

Ans: b Ans: b

Summative: Q 3 Summative: Q 4

Which among the following best describes abstract classes? Is it necessary that all the abstract methods must
be defined from an abstract class?

Recall/ Remembering Recall/ Remembering

A. If a class has more than one virtual function, it’s abstract A. Yes, depending on code
class
B. If a class have only one pure virtual function, it’s abstract B. Yes, always
class

C. If a class has at least one pure virtual function, it’s C. No, never
abstract class

D. If a class has all the pure virtual functions only, then it’s D. No, if function is not used, no
abstract class definition is required
Ans: C Ans: B
Assessment Type: Practice Worksheets: End of CO: in LMS/ downloadable PDF
If students have access to laptop/ desktop – they can answer it on LMS, else download it and answer it and file
it for later use. They can also copy the question in their notebook in case the space provided is insufficient.

1. Best suited for subjective questions.


2. Numerical problems
3. Short answer questions

A. Explain Abstract class in inheritance?

► Abstract class is a class which has at least one


pure virtual function.

► The object of Abstract class can not be created.

► The main objective is to provide some traits to


the derived classes and to create base pointer
to achieve run time polymorphism.

#include <iostream>  

using namespace std;  

 class Shape    

{    

    public:   

    virtual void draw()=0;    

};    

 class Rectangle : Shape    

{    

10.     public:  

11.      void draw()    

12.     {    

13.         cout < <"drawing rectangle..." < <endl;    

14.     }    

15. };    

16. class Circle : Shape    

17. {    
18.     public:  

19.      void draw()    

20.     {    

21.         cout <<"drawing circle..." < <endl;    

22.     }    

23. };    

24. int main( ) {  

25.     Rectangle rec;  

26.     Circle cir;  

27.     rec.draw();    
28.     cir.draw();   

29.    return 0;  

30. }  

Output:

drawing rectangle...

drawing circle...

You might also like