How many characters does an escape sequence (\On, \Hn, \n, \f) in C++ consume?

2013

How many characters does an escape sequence (\On, \Hn, \n, \f) in C++ consume?

  1. A.

    1

  2. B.

    3

  3. C.

    2

  4. D.

    None of these

Attempted by 256 students.

Show answer & explanation

Correct answer: A

Key point: An escape sequence written in source code (starting with a backslash) is interpreted by the compiler as a single character in a character or string literal. Example: '\n' is two characters in the source (a backslash and 'n') but represents one newline character.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs