Q40
What will be printed after execution of the following program code? main() printf("\ "); printf("\ "); printf("\ ");
A.
absiha
B.
asiha
C.
haasi
D.
hai
AnswerE.
None of these
Answer: Option D
Solution
Answer: Option D
Solution:
\\n - newline - printf("\\nab"); - Prints 'ab'\\b - backspace - printf("\\bsi"); - firstly '\\b' removes 'b' from 'ab ' and then prints 'si'. So after execution of printf("\\bsi"); it is 'asi'.
\\r - linefeed - printf("\\rha"); - Now here '\\r' moves the cursor to the start of the current line and then override 'asi' to 'hai' .