Page 149 - C++
P. 149

(d)  Answer the questions (1) to (4) based on the following:                            [4]
                    class Student
                    { private :
                       char Rollno[20], Sname[30];
                               protected:
                           auto float marks;
                    public:
                       Student( );
                       void ENROL( );
                       void SHOW( );
                    };
                    class Graduate: public Student
                    {   char Fname[30];
                    protected:
                       unsigned int age;
                    public:
                       Graduate( );
                       void GENROL( );
                       void GSHOW( );
                    };
                       class Pgraduate: private Graduate
                       {
                       char Mname[25];
                       signed int year;
                       public:
                           Pgraduate( );
                    void PGENROL( );
                           void PGSHOW( );
                    }
                     1.  Mention the member names that are accessible by an object of Pgraduate class.
                    2.  Name the data members which can be accessed by the objects of Graduate class.
                    3.  Name the data members that can be accessed by the functions of Pgraduate class.
                    4.  How many bytes will be occupied by an object of class Pgraduate?
              3. (a)  Suppose X, Y, Z are arrays of integers of size M,N and M+N respectively. The numbers in array
                   X and Y appear in descending order. Write a user defined function in C++ to produce third array
                   Z by merging arrays X and Y in descending order.                                     [3]
                (b)  An array DATA[1..10][1..10] requires 8 bytes of storage. If the base address of array DATA is 1500.
                   Determine the location of DATA [4][5], when the array DATA is stored:                [3]
                    (i)  Row wise
                    (ii)  Column wise.
                (c)  What is the pre-condition for applying binary algorithm?                           [1]
                (d)  Differentiate between a LIFO list and FIFO list.                                   [1]





              MTP.4                                                          Computer Science with C++ —CBSE XII
   144   145   146   147   148   149   150   151   152   153   154