File Handling
1.

Which header file is required to use file I/O operations ?

A.  

<ifstream>

B.  

<ostream>

C.  

<fstream>

D.  

<iostream>

2.

Which of the following is used to create an output stream ?

A.  

ofstream

B.  

ifstream

C.  

iostream

D.  

fsstream

3.

Which of the following is used to create a stream that performs both input and output operations ?

A.  

ofstream

B.  

ifstream

C.  

iostream

D.  

fstream

4.

Which of the following is not used as a file opening mode ?

A.  

ios::trunc

B.  

ios::binary

C.  

ios::in

D.  

ios::ate

5.

Which of the following statements are correct ?

    1) It is not possible to combine two or more file opening mode in open() method.

    2) It is possible to combine two or more file opening mode in open() method.

    3) ios::in and ios::out are input and output file opening mode respectively.

A.  

1, 3

B.  

2, 3

C.  

3 only

D.  

1, 2

6.

By default, all the files in C++ are opened in _________ mode ?

A.  

Text

B.  

Binary

C.  

ISCII

D.  

VTC

7.

What is the use of ios::trunc mode ?

A.  

To open a file in input mode

B.  

To open a file in output mode

C.  

To truncate an existing file to half

D.  

To truncate an existing file to zero

8.

Which of the following is the default mode of the opening using the ofstream class ?

A.  

ios::in

B.  

ios::out

C.  

ios::app

D.  

ios::trunc

9.

What is the return type open() method ?

A.  

int

B.  

char

C.  

bool

D.  

float

10.

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

A.  

ios::set

B.  

ios::end

C.  

ios::cur

D.  

ios::beg