Page 358 - C++
P. 358

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

                            fstream SFIN;
                            SFIN.open("SCHOOLS.DAT",ios::binary|ios::in);
                            SCHOOLS S;
                            SFIN.seekg(5*sizeof(S));
                            SFIN.read((char*)&S, sizeof(S));
                            S.Display();
                            cout<<"Record :"<<SFIN.tellg()/sizeof(S) + 1<<endl;
                            SFIN.close();
                          }

                    Ans  1004#Holy Education School#140
                          Record :7

                          (½ Mark for displaying correct values of Record 6 )
                          (½ Mark for displaying correct value of SFIN.tellg()/sizeof(B) + 1)

              SECTION B - [Only for candidates, who opted for Python]

               1     (a)   Differentiate between Syntax Error and Run-Time Error? Also, write a suitable                               2
                          example in Python to illustrate both.
                    Ans  Syntax error​: An error of language resulting from code that does not conform to
                          the syntax of the programming language.
                          Example
                          a = 0
                          while a < 10   ​# : is missing as per syntax
                                 a = a + 1
                                 print a
                          Runtime error​: A runtime error is an error that causes abnormal termination of
                          program during running time..
                          Example
                          A=10
                          B=​int(raw_input("Value:"))
                          print A/B
                          # If B entered by user is 0, it will be run-time error

                          ( ½ mark each for defining syntax error and run-time error )
                          ( ½  mark for each correct example)
                          OR
                          ( Full 2 Marks for illustrating both through examples)

                     (b)  Name the Python Library modules which need to be imported to invoke the                                      1
                          following functions:

                          (i) ​sin()​         (ii)  ​search​()

                    Ans  (i) ​math​         (ii)  ​re

                          (½ Mark for writing each correct Library module)

                          Note: Ignore any other Library modules, if mentioned.


                                                        Page #16/35
   353   354   355   356   357   358   359   360   361   362   363