Multiple choice technology programming languages

main() { printf(“\nab”); printf(“\bsi”); printf(“\rha”); }

  1. asiha

  2. hai

  3. aha

  4. siha

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

This tests escape sequences: \n (newline), \b (backspace), \r (carriage return). First printf: outputs 'ab' plus newline. Second: \b moves cursor back one position (over 'b'), then 'si' overwrites, giving 'asi'. Third: \r moves cursor to line start, then 'ha' overwrites first two positions, giving 'hai'. The final output visible is 'hai'. The carriage return only affects horizontal position, not vertical.