Cpp Inheritance MCQs 9

41.
Consider the following and answer the questions given below:

class ITEM
{
char ICodet10];
protected:
char IName[20];
public:
ITEM();
void Enter();
void Display();
}:
class SUPPLIER
{
char SCode[10];
protected:
char SName[25];
public:
SUPPLIER():
void TEnter();
void TDisplay();
}:
class SHOP : private SUPPLIER,
public ITEM
{
char SH0PADDRESSC[15],SEmai1[25];
public:
SHOP();
void Enter();
void Display();
}:

(i) Which type of inheritance is shown in the above example?

(ii) Write the name of all the member functions accessible from Enter]) function of class SHOP.

(iii) Write the names of all the member functions accessible through an object of class SHOP.

(iv) What will be the order of execution for the constructors ITEM]), SUPPLIER() and SHOP(), when an object of class SHOP is declared?

42.
Answer the questions (i) to (iv) based on the following:

class COMPANY
{
char location[20];
double budget, income;
protected:
void Accounts();
public:
COMPANY():
void Register();
void Show();
}:
class FACTORY : public COMPANY
{
char location[20];
int workers:
protected:
double Salary;
void Computer();
public:
FACTORY();
void Enter();
void Show();
};
class SHOP : private COMPANY
{
char location[20];
float area;
double sale;
public:
SHOP();
void Input();
void Output();
};

(i) Name the type of inheritance illustrated in the above C++ code.

(ii) Write the names of data members, which are accessible from the member functions of class SHOP.

(iii) Write the names of all the member functions, which are accessible from objects belonging to class FACTORY.

(iv) Write the names of all the members, which are accessible from objects of class SHOP.

43.
Answer the questions (i) to (iv) based on the following:

class ORGANISATION
{
char Address[20];
double budget,Income;
protected:
void Compute();
public:
ORGANISATION();
void Get();
void Show();
};
class WORKAREA : public ORGANISATION
{
char Address[20];
int staff;
protected:
double pay;
void Calculate();
public:
WORKAREA();
void Enter();
void Display();
};
class SHOWROOM : private ORGANISATION
{
char Address[20];
float Area;
double Sale;
public:
SHOWROOM();
void Enter!();
void Show();
};

(i) Name the type of inheritance illustrated in the above C++ code.

(ii) Write the names of data members, which are accessible from member functions of class SHOWROOM.

(iii) Write the names of the member functions, which are accessible from objects belonging to class WORKAREA.

(iv) Write the names of all the members, which are accessible from objects of class SHOWROOM.

44.
Answer the questions (i) to (iv) based on the following:
class Student
{
int Rno;
char name[20];
float Marks;
protected:
void Result();
public:
Student();
void Register();
void Display ();
};
class Faculty
{
long Fcode;
char Fname[20];
protected:
float Pay;
public:
Faculty();
void Enter();
void Show();
};
class Course : public Student,
private Faculty
{
long CCode[10];
char CourseName[50];
char StartDate[8],EndDate[8];
public:
Course();
void Commerce();
void CDetai1();
};

(i) Which type of inheritance is illustrated in the above C++ code?

(ii) Write the names of the data members, which is/are accessible from the member function Commerce of class Course.

(iii) Write the name of all the member functions, which are accessible from object of class Course.

(iv) Write the name of all the member function’s, which are accessible from object of class Faculty.

45.
Answer the questions (i) to (iv) based on the following:

class Student
{
int Roll no;
char Sname[20];
float Marksl;
protected:
void Result();
public:
Student();
void Enroll() ;
void Display!);
}:
class Teacher
{
long Tcode;
char Tname[20];
protected:
float Salary;
public:
Teacher();
void Enter();
void Show();
}:
class Course : public Student,
private Teacher
{
long CCode[10];
char CourseName[50];
char StartDate[8];
char EndDate[8];
public:
Course();
void Commerce();
void CDetail();
}:

(i) Write the name of all the member functions, which are accessible from object of class Course.

(ii) Write the name of the data members, which is/are accessible from the member function Commerce of class Course.

(iii) Write the name of all the member functions, which are accessible from object of class Teacher.

(iv) Which type of inheritance is illustrated in the above C++ code?