Second Monthly Test Question Paper -xiiB-CS


KENDRIYA VIDYALAYA NO. 1 , NAUSENABAUGH, VISAKHAPATNAM-05

Second Monthly Test  Question Paper  Subject : Computer Science

Class :  XII      Section : B      Duration: 90 Min.           Max Marks :50

  1. Wat is Inheritance ? Define the needs and objectives of Inheritance.                             (1M)
  2. What is the use and syntax/prototype  of seekg(), seekp(),tellg(),tellp() functions.  (1M)
  3. Define and Give an example of nested class                                                                            (1M)
  4. Distinguish between the functioning of ios::out,  ios::ate and ios::app file modes.      (1M)
  5. Show the hierarchy /relationship of  various classes used in File  handling.                (1M)

      6 .   What are the different types of inheritance ? Give example of each type and

               write code to  implement each type in C++ .                                                                        (10 M)

  1. Answer the questions (i) to (v) based on the following code                                           
    class stationary
    {                                                                                                                                                                                                                                                                                                    char Type;
              protected :  char Manufacturer [10];
               public:
     stationary( )   {cout<<”\n The  stationary classs object created  now     “;}                         ~stationary( ) {cout<<”\n The  stationary classs object destroyed now  “;}
               void Read_sta_details( );
               void Disp_sta_details( );
    };
    class office: public stationary
    {
              protected :  int no_of_types;
                                 float cost_of_sta;
               public:

   office ( )   {cout<<”\n The  office classs object created  now     “;}

~ office( )   {cout<<”\n The  office classs object destroyed now  “;}

               void Read_off_details( );

private :  void Disp_off_details( );
};
class printer: private office
{
           int no_of_users;
           char delivery_date[10];
           public:

 printer ( )   {cout<<”\n The  printer classs object created  now     “;}    

                    ~ printer ( ) {cout<<”\n The  printer classs object destroyed now  “;}

           void Read_pri_details( );
           void Disp_pri_details( );
};
void main ( )
{   printer MyPrinter; office MyOffice; stationary MyStationary;   }

  1. Mention the member names which are accessible by MyPrinter declared in main() function                                                                                                                                           (2M)
  2. What is the size of MyPrinter, MyOffice , MyStationary objects in bytes?                   (2M)
  3. Mention the names of functions accessible from the member function
    Read_pri_details () of class printer.                                                                                         (2M)
  4. What will be the output of the above program ?                                                                 (2M)
  5. Mention the names of members accessible from the member functions
     of class office.                                                                                                                                (2M)

8. How are binary file differ from text files in c++?                                                                            (2M)

9. void main( )                                                                                                                                                (2M)
          {   fstream fileout(”data.dat”,ios::out);
                fileout<<”1234560000”;
                int p = fileout.tellg( );0000000000000
                cout<<p;
}
What is the output if the file content before the execution of the program is the string “ABC” (Note that” “are not part of the file)

10.Write a function to count the number of words present in a text file named “PARA.TXT”. Assume that each word is separated by a single blank/space character and no blanks/spaces in the beginning and end of the file.                                                                                                              (5M)                                                                                                                                                                                                                                                                                                                            

11.Following is the structure of each record in a data file named “COLONY.DAT”.                    (6M)
struct          COLONY
{        char Colony Code[10];
         char Colony Name[10];
         int No of People;
};
Write a function in C++ to update the file with a new value of No _of_People. The value of Colony_Code and No_of_People are read during the execution of the program.

***************** THE END*********************

Popular posts from this blog

XII- CS-- SOLVED SQL queries (SQL PRACTICAL ASSIGNMENS)

SQL--HOME ASSIGNMENTS(XII Class)

Python-MySQL Connectivity