Match the following file stream classes in C++ with its functions.
20212021
Match the following file stream classes in C++ with its functions.

- A.
1 – i, 2 – ii, 3 – iv, 4 – iii
- B.
1 – iv, 2 – iii, 3 – i, 4 – ii
- C.
1 – i, 2 – iii, 3 – iv, 4 – ii
- D.
1 – iii, 2 – iv, 3 – ii, 4 – i
Attempted by 78 students.
Show answer & explanation
Correct answer: D
Matching of C++ stream classes:
fstream → Provides common operations for file streams.
Therefore → iiiifstream → Provides input operations.
Therefore → ivofstream → Provides output operations.
Therefore → iiiostream → Supports both input and output operations together.
Therefore → i
Hence, the correct matching is:
1 – iii, 2 – iv, 3 – ii, 4 – i