Page 251 - C++
P. 251

CBSE AISSCE 2016-2017 Marking Scheme for Computer Science
                                         (Sub Code: 083 Paper Code 91/1 Delhi)

                          };
                          class QUEUE
                          {
                            Member *Rear,*Front;
                          public:
                            QUEUE(){Rear=NULL;Front=NULL;}
                            void ADDMEM();
                            void REMOVEMEM();
                            ~QUEUE();
                          };

                   ANS  void QUEUE::ADDMEM()
                          {
                            Member *T;
                            T=new Member;
                            cin>>T->MNO;
                            gets(T->MNAME);
                            T->Next=NULL;
                            if (Rear==NULL)
                            {
                              Rear=T;Front=T;
                            }
                            else
                            {
                              Rear->Next=T;
                              Rear=T;
                            }
                          }
                          OR

                          Any other equivalent code in C++

                           (1 Mark for creating a new Node)
                           (1 Mark for accepting values of  MNO and MNAME)
                           (½ Mark for checking EMPTY condition)
                           (½ Mark for assigning NULL to Rear and Front as T)
                           (½ Mark for connecting Rear with T)
                           (½ Mark for assigning Rear as T)


                   (e)    Convert the following Infix expression to its equivalent Postfix expression, showing                               2
                          the stack contents for each step of conversion.
                                P + ( Q - R ) * S / T

                   Ans  (P+(((Q-R)*S)/T))
                          INFIX                      STACK                      POSTFIX

                          P                                                     P
                          +                          +                          P
                          Q                          +                          PQ
                          -                          +-                         PQ

                          R                          +-                         PQR

                                                     Page #10 of 28
   246   247   248   249   250   251   252   253   254   255   256