Question 105Asked in BPSC TRE 1.0 (2023) Computer Science Class 11-12

What is the use of ios::trunc mode?

  1. ATo open a file in input mode
  2. BTo open a file in output mode
  3. CTo truncate an existing file to zero
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (C) To truncate an existing file to zero

Explanation

ios::trunc discards the contents of an existing file when it is opened, cutting its length to zero.

From BPSC TRE 1.0 (2023) Computer Science Class 11-12 — Previous Year Paper

This is question 105 of BPSC TRE 1.0 (2023) Computer Science Class 11-12 — Previous Year Paper. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.