CPP File Handling MCQ

Cpp MCQ
  1. Home
  2. Tutorials
  3. Cpp
  4. File Handling
  5. Multiple Choice Question

(1) In C++ which file mode is used to empty the file ?

A) trunc
B) truncate
C) empty
D) delete

(2) Which file mode goto eof each time before writing data in C++ ?

A) ate
B) app
C) out
D) in

(3) Which file writing mode write data at the end of file in C++ ?

A) out
B) in
C) app
D) append

(4) How many parameters of open() method in file handling using C++ ?

A) 1
B) 2
C) 4
D) 6

(5) Which of the following class is used to create file writing operation?

A) ofstream
B) ifstream
C) writestream
D) outstream

(6) How many modes can be specified in opening file?

A) One
B) Two
C) Four
D) Multiple

(7) Which of the following mode is used to write at the end of file.

A) ios::in
B) ios::out
C) ios::ate
D) ios::app

(8) Which of the following types of file can be used for read/write operations in C++ ?

A) .dat
B) .doc
C) .txt
D) All

(9) Which of the following mode is used for writing data to files?

A) ios::write
B) ios::in
C) ios::out
D) ios::beg

(10) Which of the following file reading mode in C++ ?

A) ios::out
B) ios::in
C) ios::read
D) ios::ate

(11) Which of following header file is used for file IO operations in C++ ?

A) iostream
B) stlib
C) conio
D) fstream
Comments
Login to TRACK of Comments.