Page 354 - C++
P. 354

CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
                                       (2018-2019 Sub Code: 083       Paper Code: 91)

                            char    Address[20];
                            Packet  *LINK;
                          };
                          class QUEUE
                          {
                            Packet *Front, *Rear;
                          public:
                            QUEUE(){Front=NULL;Rear=NULL;}
                            void AddPacket();
                            void DeletePacket();
                            ~QUEUE();
                          };
                    Ans    void QUEUE::AddPacket()
                           {
                             if(Front != NULL)
                             {
                               Packet *T;
                               T=Front;
                               cout<<Front->PID<<Front->Address<<" removed"<<endl;
                               //OR cout<<T->PID<<T->Address<<" removed"<<endl;
                               Front = Front->LINK;
                               delete T;
                               if (Front==NULL)
                                 Rear=NULL;
                             }
                             else
                                cout<< "Queue Empty"<<endl;
                           }
                           OR
                           Any other equivalent code in C++

                           (1 Mark for checking EMPTY condition)
                           (½  Mark for declaring Packet T)
                           (½ Mark for assigning Front to T)
                           (½ Mark for deleting the previous Front Packet)
                           (½ Mark for changing LINK of Front)
                           (1 Mark for reassigning Rear with NULL if Queue becomes empty on
                           deletion)
                           NOTE:
                          ●   Marks should not be deducted if function header is written as
                             void QUEUE::DeletePacket()​instead of
                             void QUEUE::AddPacket()

                          ●   4 Marks to be awarded if Addition of Packet is done in place of
                              Deletion according to the following distribution
                              ● ( 1 Mark for creating a new Packet)
                              ● ( ½ Mark for entering data for the new Packet)
                              ● ( ½ Mark for assigning NULL to link of the new Packet)
                              ● ( ½ Mark for assigning Front to the first Packet as Front = T)

                                                        Page #12/35
   349   350   351   352   353   354   355   356   357   358   359