Page 150 - C++
P. 150

(e)  Evaluate the following postfix expression using a stack. Show the contents of stack after execution
                   of each operation:                                                                   [2]
                   TRUE, FALSE, TRUE, FALSE, NOT, OR, TRUE, OR, OR, AND
                 (f)  Give the necessary declarations of a queue containing integers. Write a user defined function in C++
                   to delete an integer from the queue. The queue is to be implemented as a linked structure.   [4]
              4. (a)  Differentiate between ifstream class and ofstream class.                          [2]
                (b)  Assuming the class STOCK, write functions in C++ to perform following:             [4]
                    (i)  Write the objects of STOCK to a binary file.
                    (ii)  Read the objects of STOCK from binary file and display them on screen.
                   class STOCK
                    {
                    int ITNO;
                    char ITEM[10];
                    public :
                    void GETIT( )
                    {
                    cin>>ITNO;
                    gets(ITEM);
                    }
                    void SHOWIT( ){cout<<ITNO<< " "<<ITEM<<endl;}
                    };
                (c)  Consider the following class declaration:                                          [4]
                    class employee
                    {
                    int code;
                    char name [20];
                    float salary;
                    public:
                    void input( ) {cin>>code>>name>>salary;}
                    void show( ) {cout<<code<<name<<salary<<endl;}
                    float retsal( ) {return salary;}
                    };
                    Give function definitions to do the following:
                    (i)  Write the objects of employee to a binary file.
                    (ii)  Read the objects of employee from a binary file and display all the objects on the screen where
                       salary is between ` 10,000 and ` 20,000.
              5. (a)  Differentiate between SQL commands DROP TABLE and DROP VIEW.                      [2]
                    Write SQL commands for (b) to (e) and write the outputs for (g) on the basis of table GRADUATE:
                     SNo       Name        Department     Date of joining   Salary (`)  Sex
                      1.   Raja            Computer          21-05-98         8000       M
                      2.   Sangita         History           21-05-97         9000        F
                      3.   Ritu            Sociology         29-08-98         8000        F
                      4.   Kumar           Linguistics       13-06-96        10000       M
                      5.   Venkatraman     History           31-10-99         8000       M
                      6.   Sidhu           Computer          21-05-86        14000       M
                      7.   Aishwarya       Sociology         11-01-98        12000        F
              Model Test Papers                                                                      MTP.5
   145   146   147   148   149   150   151   152   153   154   155