Page 302 - C++
P. 302

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


                            )              -                           XYZ+U/
                            *              -*
                            V                                          XYZ+U/V
                            )                                          XYZ+U/V*
                            )                                          XYZ+U/V*-

                           Postfix= XYZ+U/V*-

                           OR
                           Any other method for converting the given ​infix​​​ expression to its equivalent
                           postfix ​expression showing stack contents.

                           (½  Mark for correctly converting till each operator)
                           OR
                           (1 Mark to be given for writing correct answer without showing the stack
                           content on each step)

              4.   (a)    Polina Raj has used a text editing software to type some text in an article. After                                               3
                          saving the article as ​MYNOTES.TXT​, she realised that she has wrongly typed alphabet
                          K in place of alphabet C everywhere in the article.

                          Write a function definition for PURETEXT() in C++ that would display the corrected
                          version of the entire article of the file ​MYNOTES.TXT with all the alphabets “K” to
                          be displayed as an alphabet “C” on screen​.
                          Note: Assuming that  ​MYNOTES.TXT​ does not contain any  C alphabet otherwise.
                          Example:
                          If Polina has stored the following content in the file ​MYNOTES.TXT​:

                            I OWN A KUTE LITTLE KAR.
                            I KARE FOR IT AS MY KHILD.
                          The function PURETEXT() should display the following content:

                            I OWN A CUTE LITTLE CAR.
                            I CARE FOR IT AS MY CHILD.


                   Ans     void PURETEXT()
                           {
                             char ch;
                             ifstream F("MYNOTES.TXT" );
                             while(F.get(ch))
                             {
                               if(ch==’K’)
                                ch=’C’;
                               cout<<ch;
                             }
                             F.close(); ​//IGNORE
                           }
                           OR
                           Any other correct function definition


                             (1 Mark for opening MYNOTES.TXT correctly)
                             (1  Mark for reading each character ​(using any method)​ from the file)
                             (1  Mark for displaying ‘C’ in place of ‘K’)


                                                     Page #12 of 28
   297   298   299   300   301   302   303   304   305   306   307