CPP File Handling MCQCpp MCQ
- File Handling
- Multiple Choice Question
(1) In C++ which file mode is used to empty the file ?
ios::trunc file mode isused to delete all data from file. Means to empty the file.
(2) Which file mode goto eof each time before writing data in C++ ?
app append file opening mode move cursor to the end of file before every write operation.
(3) Which file writing mode write data at the end of file in C++ ?
ios::app file mode is used to open file in append mode. It append data in file at after end of file.
(4) How many parameters of open() method in file handling using C++ ?
There are two parameters accepts by fstream open method. First is file path and second one is file mode.
(5) Which of the following class is used to create file writing operation?
ofstream (output stream) class is used to create file writing object. It belongs to fstream class.
(6) How many modes can be specified in opening file?
We can specify multiple modes/operations while opening files in C++.
(7) Which of the following mode is used to write at the end of file.
Append mode is used for appending data into the files. Appending mode is specified using ios::app in file opening statement.
(8) Which of the following types of file can be used for read/write operations in C++ ?
We can write and read data from any type of file using cpp fstream functions.
(9) Which of the following mode is used for writing data to files?
ios::out is file output mode that is used to write data/output to the files on secondary storage.
(10) Which of the following file reading mode in C++ ?
ios::in is file input mode. This is used to read data from files.
(11) Which of following header file is used for file IO operations in C++ ?
fstream means file stream header file is used for input and output operations in file handling.