Page 357 - C++
P. 357

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

                           int Count=0;
                           SCHOOLS S;

                           while(F.read((char*)&S,sizeof(S)))
                             Count += S.RNOT();

                           cout<<"Total number of teachers :"<<Count<<endl;
                           F.close();  //IGNORE
                          }
                          OR
                          void TotalTeachers()
                          {
                           ifstream F;
                           F.open("SCHOOLS.DAT",ios::binary);
                           SCHOOLS S;
                           while(F.read((char*)&S,sizeof(S)))
                             cout<<S.RNOT()<<endl;//OR S.Display();
                           F.close();  //IGNORE
                          }
                          OR
                          Any other correct function definition

                          (½ Mark for opening ​SCHOOLS.DAT​ correctly)
                          (½  Mark for reading each record​ from the file)

                          (½ Mark for finding Total number of teachers)
                          (½ Mark for displaying Total number of teachers)
                          OR
                          (1 mark for displaying number of teachers in Each Record)

                     (c)   Find the output of the following C++ code considering that the binary file                                      1
                          SCHOOLS.DAT exists on the hard disk with the following records of 10 schools of
                          the class SCHOOLS as declared in the previous question (4 b).
                             SCode       SName                                NOT
                             1001        Brains School                        100
                             1003        Child Life School                    115
                             1002        Care Share School                    300

                             1006        Educate for Life School              50
                             1005        Guru Shishya Sadan                   195
                             1004        Holy Education School                140
                             1010        Rahmat E Talim School                95
                             1008        Innovate Excel School                300
                             1011        Premier Education School             200

                             1012        Uplifted Minds School                100
                          void main()
                          {


                                                        Page #15/35
   352   353   354   355   356   357   358   359   360   361   362