Which of the following statements is/are correct about C++ file opening modes?

Asked In: BPSC TRE 1.0

Options

  • A. Statements 1 and 3
  • B. Statements 2 and 3
  • C. Statement 3 only
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. Statements 2 and 3

Detailed Explanation

Correct Answer: Option B

Explanation:
Statement 1 is false because two or more file opening modes can be combined using the bitwise OR operator (|). Statement 2 is true. Statement 3 is also true: ios::in is used for input, and ios::out is used for output.