Testclassesconsinh
Testclassesconsinh
Testclassesconsinh
1.
(b) Answer the questions (i) and (ii) after going through the following class:
class Seminar
{
int Time;
public:
Seminar() //Function 1
{
Time=30;cout<<”Seminar starts now”<<end1;
}
void Lecture() //Function 2
{
cout<<”Lectures in the seminar on”<<end1;
}
Seminar(int Duration) //Function 3
{
Time=Duration;cout<<”Seminar starts now”<<end1;
}
~Seminar() //Function 4
{
cout<<”Vote of thanks”<<end1;
}
};
i) In Object Oriented Programming, what is Function 4 referred as and when does it get
invoked/called?
(i) Write the names of data members, which are accessible from objects belonging to class
AUTHOR.
(ii) Write the names of all the member functions which are accessible from objects belonging to
class BRANCH.
(iii) Write the names of all the members which are accessible from member functions of class
AUTHOR.
(iv) How many bytes will be required by an object belonging to class AUTHOR?
2.
(a) What is a copy constructor? What do you understand by constructor overloading?
(b) Define a class student with the following specification
Private members of class student
admno integer
sname 20 character
eng. math, science float
total float
ctotal() a function to calculate eng + math + science with
float return type.
class PPP
{
int H:
protected :
int S;
public :
void INPUT (int);
void OUT();
};
class QQQ : private PPP
{
int T;
protected :
int U;
public :
void INDATA(int, int);
void OUTDATA();
};
class RRR : public QQQ
{
int M;
public
:
void DISP( void );
};
(i)Name the base class and derived class of the class QQQ.
(ii) Name the data member(s) that can be accessed from function DISP().
(iii) Name the member function(s), which can be accessed from the objects of class
RRR. (iv)Is the member function OUT() accessible by the object of the c.ass QQQ?
3. (a) Given the following C++ code, answer the questions (i) & (ii).
class TestMeOut
{
public:
~TestMeOut() //Function 1
{cout<<“Leaving the examination hall”<<endl;}
TestMeOut() //Function 2
{cout<<“Appearing for examination”<<endl;}
(i) Name the members, which can be accessed from the member
functions of class human.
(ii) Name the members, which can be accessed by an object of class ape.
(iii) Name the members, which can be accessed by an object of class human.
(iv) What will be the size of an object (in bytes) of class human ?