Discussion Forum : C Fundamentals
Question - What will be printed after execution of the following program code?
main()
{
printf("\\nab");
printf("\\bsi");
printf("\\rha");
}
Options:
A .  absiha
B .  asiha
C .  haasi
D .  hai
E .  None of these
Answer: Option D
\\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' .

Was this answer helpful ?
Next Question
Submit Your Solution hear:

Your email address will not be published. Required fields are marked *