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. Write the major differences between Object Oriented Programming and Procedural Programming
  2. Name the header file to which the following belong:
    1. gotoxy()
    2. srand()
  3. List the characteristics of constructor and destructors?
  4. Define a class Shop in C++ with the description given below :
    private members
    name array of 40 characters
    address array of 40 characters
    type of item array of 3X20 characters
    availqty array of 3 integers
    totalqty array of 3 integers
    public members
    init() function to ask and store the values of address ,type of items , availqty & totalqty.
    purchase() function to ask the qty purchased and type of item from the user and updates the totalqty and avialqty accordingly .
    for example: if the type of items available in the shop are : “Cosmetic” , ”Food Products” , ”Medicines” . And the shop keeper purchases the “Cosmetic” item then updates the availqty and totalqty of the “Cosmetic” item.
    display() function to display the details of the item in the following format :
    Name : <SHOP NAME >
    Address : < ADDRESS >
    Items :< Type of Item 1> <Type of Item 2> <Type Of item 3>
    Balance Stock :< avialqty> <availqty> <avialqty>
  5. Answer the questions (i) to (IV) based on the following code:
    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: public CUSTOMER, protected 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?
  6. Observe the program segment given below carefully and fill in the blanks marked as statment1 and statement2 using write() and remove() functions for performing the required task.
    #include<fstream.h>
    class Emp
    {
    int Eno;
    char name[20];
    public :
    //function which will delete the data of a specific employee
    void deleteRec(int Eid);
    };
    void Emp::deleteRec(int Eid)
    {
    fstream file;
    file.open(“Emp.dat”,ios::in|ios::out|ios::binary);
    ofstream ofile(“temp.dat”);
    while(file)
    {
    file.read((char *)this,sizeof(eobj));
    if(this->Eno !=Eid)
    _________________//statement1
    }
    ________________//statement 2
    rename(“temp.dat”,”emp.dat”);
    }
  7. Write a function to reverse only those lines ends with vowel character from a text file poem.txt.
  8. Write a function in C++ to update the SUPPLIER NAME for a given SNO from a binary file “SUPP.DAT”, assuming the binary file is contained the objects of the following class:
    class SUPPLIER
    {
    int SNO;
    char SUPP_NAME [20];
    public:
    int SUPPNO ( ) { return SNO; }
    void Enter ( ) { cin >> SNO; gets (SUPP_NAME); }
    void Display ( ) { cout << SNO <<SUPP_NAME ; }
    };
  9. What is the difference between Global Variable and Local Variable? Also, give a suitable C++ code to illustrate both.
  10. What do you understand by Data Encapsulation and Data Hiding? Also, give a suitable C++ code to illustrate both.

 

Previous Index Next

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