CBSE Important Questions

CBSE Guess > Papers > Important Questions > Class XII > 2013 > Computer Science > Computer Science - by Mr. Sandip Kumar Srivastava

CBSE CLASS XII

Computer Science (C++ and Data Structure)

Previous Index Next

 

  1. Define a class FLIGHT in C++ with following description:
    Private Members:
    • A data member Flight number of type integer
    • A data member Destination of type string
    • A data member Distance of type float
    • A data member Fuel of type float
    • A member function CALFUEL() to calculate the value of Fuel as per the following criteria :
    Distance Fuel
    <=1000 500
    more than 1000 and <=2000 1100
    more than 2000 2200

    Public Members:

    • " A function FEEDINFO() to allow user to enter values for Flight Number, Destination, Distance & call function CALFUEL() to calculate the quantity of Fuel
    • " A function SHOWINFO() to allow user to view the content of all the data members

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

    class CUSTOMER
    {
    int Cust_no;
    char Cust_Name[20];
    protected:
    void Register();
    public:
    CUSTOMER();
    void Status();
    };
    class SALESMAN
    {
    int Salesman_no;
    char Salesman_Name[20];
    protected:
    float Salary;
    public:
    SALESMAN();
    void Enter();
    void Show();
    };
    class SHOP : private CUSTOMER , public SALESMAN
    {
    char Voucher_No[10];
    char Sales_Date[8];
    public:
    SHOP();
    void Sales_Entry();
    void Sales_Detail();
    };

    1. Write the names of data members which are accessible from objects belonging to class CUSTOMER.
    2. Write the names of all the member functions which are accessible from objects belonging to class SALESMAN.
    3. Write the names of all the members which are accessible from member functions of class SHOP.
    4. How many bytes will be required by an object belonging to class SHOP?
  3. Write a function in C++ to count the number of lines present in a text file "STORY.TXT".
  4. Given a binary file PHONE.DAT, containing records of the following structure type.

    class Phonlist
    {
    char Name[20] ;
    char Address[30] ;
    char AreaCode[5] ;
    char phoneNo[15] ;    
    public :
    void Register();
    void show();
    int CheckCode(char AC[ ])
    {
    return strcmp(Areacode, AC) ;
    }
    } ;

    Write a function TRANSFER () in C++, that would copy all those records which are having AreaCode as “DEL” from PHONE.DAT to PHONBACK.DAT.

  5. Give one advantage of function overloading with default arguments
  6. Differentiate between object oriented programming and procedural programming
  7. What do you understand by Copy constructor? Specify two instances when copy constructor is invoked?
  8. Differentiate between containership and inheritance with example.

 

Previous Index Next

Submitted By : Mr. Sandip Kumar Srivastava
Email : [email protected]