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
- Wat is Inheritance ? Define the
needs and objectives of Inheritance. (1M)
- What is the use and syntax/prototype of seekg(), seekp(),tellg(),tellp()
functions. (1M)
- Define and Give an example of nested
class
(1M)
- Distinguish between the functioning
of ios::out, ios::ate and ios::app
file modes. (1M)
- 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)
- 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:
};
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; }
void Read_pri_details( );
void Disp_pri_details( );
};
void main ( )
{ printer MyPrinter; office MyOffice; stationary MyStationary; }
- Mention the member names which are accessible
by MyPrinter declared in main() function (2M)
- What is the size of MyPrinter, MyOffice ,
MyStationary objects in bytes? (2M)
- Mention the names of functions accessible from
the member function
Read_pri_details () of class printer. (2M) - What will be the
output of the above program ? (2M)
- 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)
{ 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.
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*********************