File Handling MCQs

File Handling MCQs

Answer these 10+ File Handling MCQs and assess your grip on the subject of File Handling.
Scroll below and get started!

1: __________is the return type of is_open() function.

A.   INT

B.   Float

C.   Char *

D.   Bool

2: It is not possible to combine two or more file opening modes in the open () method.

A.   True

B.   False

3: Which of the following is not a file opening mode.

A.   Ios::nocreate

B.   Ios::truncate

C.   Ios::noreplace

D.   Ios::ate

4: To create an output stream, we must declare the stream to be of class_____________.

A.   Iostream

B.   None

C.   Ofstream

D.   Ifstream

5: If we have object from fstream class, then default mode of opening the file is________

A.   Default mode depends on compiler

B.   Ios::in|ios::trunc

C.   Ios::in|ios::out

D.   Ios::in|ios::out|ios::trunc

6: To perform File I/O operations, we must use _____________ header file.

A.   < ofstream>

B.   None

C.   < ifstream>

D.   < fstream>

7: By default, all the files are opened in ___________mode.

A.   Can’t say

B.   Binary

C.   Text

D.   None

8: If we have an object from ofstream class, then the default mode of opening the file is________.

A.   Ios::out

B.   Ios::out|ios::trunk

C.   Ios::in

D.   Ios::in|ios::trunc

9: Which of the following is not used to seek a file pointer?

A.   Ios::cur

B.   Ios::set

C.   Ios::beg

D.   Ios::set

10: Streams that will be performing both input and output operations must be declared as class_________.

A.   Stdiostream

B.   Iostream

C.   Stdstream

D.   Fstream

11: Due to ios::trunc mode, the file is truncated to zero length.

A.   True

B.   False