CPP Escape Sequence MCQ
Cpp MCQ- Home
- Tutorials
- Cpp
- Escape Sequence
- Multiple Choice Question
(1) Which of the following escape sequence is used for carriage return?
A) \c
B) \r
C) \cr
D) All
Explanation
\r escape sequence is used as carriage return in format string
(2) How many escape sequence can be used within format string in C/C++
A) 1
B) 2
C) 4
D) Multiple
Explanation
There is no limit defined by the language about no of escape sequence use in format string. So that we can use multiple escape sequences within single format string.
(3) Which of the following escape sequence is used for beep in format string
A) \a
B) \b
C) \\
D) \beep
Explanation
\a is escape sequence that is used to generate litte sound alert from system whenever this is used in format string. This is also called alert escape sequence.
(4) Escape sequences are used in C/C++ for the following purpose.
A) Compilation
B) Linking of Code
C) Variable declaration
D) Output format
Explanation
Escape sequences are used to format the output string. These are written in format string.
(5) Which of the following is used as escape character in format string
A) /
B) \
C) =
D) %
Explanation
Back slash "\" is used as escape character in format string. It indicate starting of escape sequence