Page 141 - C++
P. 141
Race(); //function 1
Race(int CN); //function 2
Race(Race &R) //function 3
void Register(); //function 4
void Drive(); //function 5
};
void main()
{
Race R;
}
(i) Out of the following, which of the options is correct for calling function 2?
Option 1 - Race T(30);
Option 2 - Race U(R);.
(ii) Name the feature of object oriented programming, which is illustrated by function1, function2
and function 3 combined together.
(c) Declare a class myfolder with the following specification: [4]
Private members of the class
l Filenames – an array of strings of size[10][25]( to represent all the names of files inside myfolder)
l Availspace – long ( to represent total number of bytes available in myfolder)
l Usedspace – long ( to represent total number of bytes used in myfolder)
Public members of the class
l Newfileentry() – A function to accept values of Filenames, Availspace and Usedspacefromuser
l Retavailspace() – A Fucntion that returns the value of total Kilobytes available (1 Kilobytes =
1024 bytes)
l Showfiles() – a function that displays the names of all the files in myfolder
(d) Consider the following declarations and answer the questions given below: [4]
class WORLD
{
int H;
protected:
int S;
public:
void INPUT(int);
void OUTPUT();
};
class COUNTRY : private WORLD // Base class WORLD & Sub class Contry
{
int T;
protected:
int U;
public:
void INDATA( int, int)
void OUTDATA();
};
class STATE : public COUNTRY // Base Class COUNTRY & Sub Class STATE
Model Test Papers MTP.3