file handling

4
1. Which operator is used to insert the data into file? a) >> b) << c) < d) None of the mentioned Answer B 2. Which function is used to position back from the end of file object? a) seekg b) seekp c) Both a & b d) None of the mentioned Answer c 3. What will be the output of the following program segment? int main() { const int max=100; char line[max]; ofstream outf("ABC.txt"); outf<< "Hello World"; cout<<outf.tellp()<<"\n"; outf.seekp(-3,ios::cur); outf<< "This is File handling"; cout<<outf.tellp()<<"\n"; outf.close(); ifstream inf("ABC.txt"); inf.seekg(14,ios::beg); cout<<inf.tellg()<<"\n"; while(!inf.eof()) { inf.getline(line, max); cout<<line; } inf.close(); getch(); } a) 0, 30, 13, File handling b) 5, 16, 22, This is file handling

Upload: tribhuwan-pant

Post on 20-Nov-2015

214 views

Category:

Documents


1 download

DESCRIPTION

File Handling -- C/C++ language

TRANSCRIPT

1. Which operator is used to insert the data into file?a) >>b)