(Paper) Sample Paper Class - XII Computer Science 2008-4

Disclaimer: This website is NOT associated with CBSE, for official website of CBSE visit - www.cbse.gov.in

Inheritance

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

class PUBLISHER

{                class Pub[12];

                  double Turnover;

             protected;

                  void Register();

             public :

                 PUBLISHER();

                 void Enter ();

                 void Display();

} ;

class BRANCH

{               char CITY[20] ;

        protected :

                 float Employees ;

        public:

              BRANCH() ;

              void Haveit();

              void Giveit();

} ;

class AUTHOR : private BRANCH, public Publisher

{             int Acode;

               char Aname[20];

               float Amount:

           public:

               AUTHOR();

               void Start();

               void Show(); };

(i ) Write the names of data members, which are accessible from objects belonging to class   

      AUTHOR.

(ii) Write the names of all the members 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 wiil be required by an object belonging to class AUTHOR?                

(v)  Is enter() is accessible through the object of Author

 

Q2.     Answer the following question ( i) to (iv) based on following code:

class World

{

int H;

protected

int s;

public:

void INPUT(int);

void OUTPUT();

class Country : private WORLD

{

int T;

protected

int U;

Public :

void INDATA(int, int);

void OUTDATA();

};

class STATE : Public COUNTRY

{

int M;

public :
void DISPLAY(void);

};

 

(i)            Name the base class and derived class of the class COUNTRY.

(ii)          Name the data member that can be accessed from function DISPALAY()

(iii)         Name the member functions, which can be accessed from the objects of class STATE.

(iv)        IS the member function OUTPUT() accessible by the objects of the class COUNTRY ?                

                                          

      Q3. Answer the questions (i) to (iv) based on the following class declaration:                             

         class Medicine

           {

              char category[10];

              char Date_of_Manufacture[10];

              char Date_Of_Expiry[10];

              protected:

              char company[20];

            public:

               int x,y;

               Medicine();

               void Enter();

               void Show();

             };

             class Tablet :protected Medicine

              {

                 protected:

                             char tablet_name[30];

                             char volume_label[20];

                             void disprin();

                  public:

                           float price;

                  Tablet();

                            void enterdet();

                            void showdet();

              };

         class PainReliver : public Tablet

         {

                  int Dosage_units;

                  long int  tab;

                          char effects[20];

      protected:

              I   int use_within_Days;

              public :

                             PainReliver()

                             void enterpr();

                             showpr();

          };

 

i)   How many bytes will be required by an object of class Drug and an object of class PainReliver  respectively.                                                                             

ii) Write names of all the data members which are accessible from the object of class PainReliver.     

iii) Write names of all member functions which are accessible from objects of class PianReliver.        

iv) Write the names of all the data members which are accessible from the functions enterpr().          

 

                                               

Q4.   Consider the following declarations and answer the questions given below:  [4]

            class Animal

            {

                        int leg:

                        protected:

                        int tail;

                        public:

                        void INPUT (int );

                        void OUT ( );

            };

            class wild : private Animal

            {

                        int Non_veg;

                        protected:

                        int teeth;

                        Public:

                        void INDATA (int, int )

                        void OUTDATA( );

            };

            class pet : public Animal

            {

                        int veg;

                        public:

                        void DISP (void);

            };

(i)                  Name the base class and derived class of the class wild.

(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 pet.

(iv)              Is the member function OUT( ) accessible by the objects of the class wild?

 

 

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

            class vehicle

            {

                                                int wheels;

                                    protected:

                                                int passenger;

                                       public:

                                                void inputdata();

                                                void outputdata();

            };                                                                              

            class heavyvehicle : protected vehicle

            {

                                                int diesel_petrol;

                                    protected:

                                                int load;

                                    public:

                                                void readdata(int, int);

                                                void writedata();

            };

            class bus : private heavyvehicle

            {

                                                char make[20];

                                    public:

                                                void fetchdata();

                                                void displaydata();

            };

    i) Name the base class and derived class of heavyvehicle class.

    ii) Name the data member(s) that can be accessed from the function displaydata().

    iii) How many bytes will be required by an object of vehicle and heavyvehicle classes respectively?

    iv) Is the member function outputdata() accessible to the objects of the class heavyvehicle?

 

   Q6. Consider the following C++ declaration and answer the questions given below:
         class A

         {

             void any();

              protected:

                         int a,b;

                         void proc();

              public:

                         A( );

                         void get( );

                         void put( );

           };

           class B:protected A

            {

                          int c,d;

                protected:

                          int e,f;

                          void get2( );

                public:

                          B( );

                          void put2( );

             };

           class C: private B

            {

                          int p;

                  protected:

                          int q;

                          void get3( );

                  public:

                           void show3( );   

            };

(a)    Name all the member functions which are accessible by the objects of class C.

(b)   Name all the protected members of class B

(c)    Name all the data members which are accessible from member functions of class C

(d)   How many bytes does as object belonging to class C require?

(e)    Which class constructor will be called first at the time of declaration of an object of class C

(f)     Is the member function proc() which can be accessed form the objects of class C

(g)    Name the base class and derived class of class B

(h)    Name all the protected members of class C              

 

< Pervious

 Next >


  Go To Page :   1,   2,   3,   456   >>