Page 281 - C++
P. 281
(c) Find the output of the following C++ code considering that the
binary file CLIENTS.DAT exists on the hard disk with a data of 200
clients : 1
class CLIENTS
{
int CCode;char CName[20];
public:
void REGISTER(); void DISPLAY();
};
void main()
{
fstream File;
File.open("CLIENTS.DAT",ios::binary|ios::in);
CLIENTS C;
File.seekg(6*sizeof(C));
File.read((char*)&C, sizeof(C));
cout<<"Client Number:"<<File.tellg()/sizeof(C) + 1;
File.seekg(0,ios::end);
cout<<" of "<<File.tellg()/sizeof(C)<<endl;
File.close();
}
SECTION B
[Only for candidates, who opted for Python]
1. (a) Which of the following can be used as valid variable identifier(s) in
Python ? 2
(i) 4thSum
(ii) Total
(iii) Number#
(iv) _Data
91 11 P.T.O.