Page 220 - C++
P. 220

dimensional array of integers.
                                                                      12     3     9    14

                                                                      24    25   16   31
                     If the 2D array is
                                                                      19    32   45   27

                                                                      11     5    28   18

                  The resultant ID arrays is 12, 3, 9, 24, 25, 45, 9, 5, 18                                                              [3]
             d) Write a function in C++ to insert and delete a node containing city’s information (i.e. city
                  name and its population) from a dynamically allocated Queue of cities.                                  [4]
             e) Convert the following infix expression to its equivalent postfix expression showing stack contents
                 for the conversion:         (A + B) * ( C ^ ( D – E ) + F ) - G                                                      [2]

          Q.4 a) Write appropriate C++ commands to do the following:
                 (i) To open a file named RESULT.DAT for editing records
                                 th
                 (ii) To got to the 70  byte in a file DATA.DAT                                                                        [1]
                 b) Write a C++ program to display the data in a text file TEXT.DAT. While displaying the data,
                      if the number of lines exceed by 20, the text file should be displayed screen by screen.     [2]
                 c) Given a binary file “AMOUNT.DAT” , containing records of the given class outstand type.
                      class outstand
                     {
                                 int memno;
                                 int outamt;
                          public:
                                 void getit( )
                                {           cin>>memno>>outamt;             }
                                void putit( )
                                {          cout<<memno<<outamt;             }
                                int returnamt( )
                                {           return outamt;                  }
                                int ret_memno()
                                {           return memno;                                                }
                     };
          Write a function to delete a particular memno from the file
          “AMOUNT.DAT” .                                                                                                                     [2]
          Q.5 a) Observe the following Table and answer the parts(i) and (ii) accordingly
                                Table   :   MEMBER
          Mno                       Name                      Qty                       PurchaseDate

          101                       Pen                       102                       12-12-2011

          102                       Pencil                    201                       21-02-2012
          102                       Eraser                    90                        09-08-2010

          109                       Sharpener                 90                        31-08-2012
          113                       Clips                     900                       08-08-2011








              (i)  In the above table, can we take Mno as Primary Key? (Answer in YES/NO only). Justify your
                 answer with a valid reason .

                                                                                                             4
   215   216   217   218   219   220   221   222   223   224   225