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

20212021

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

image.png

  1. A.

    1 – i, 2 – ii, 3 – iv, 4 – iii

  2. B.

    1 – iv, 2 – iii, 3 – i, 4 – ii

  3. C.

    1 – i, 2 – iii, 3 – iv, 4 – ii

  4. D.

    1 – iii, 2 – iv, 3 – ii, 4 – i

Attempted by 78 students.

Show answer & explanation

Correct answer: D

Matching of C++ stream classes:

  1. fstream → Provides common operations for file streams.
    Therefore → iii

  2. ifstream → Provides input operations.
    Therefore → iv

  3. ofstream → Provides output operations.
    Therefore → ii

  4. iostream → Supports both input and output operations together.
    Therefore → i

Hence, the correct matching is:

1 – iii, 2 – iv, 3 – ii, 4 – i

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs