What will be printed after execution of the following program code?
main()
{
printf("\\nab");
printf("\\bsi");
printf("\\rha");
}
main()
{
printf("\\nab");
printf("\\bsi");
printf("\\rha");
}
A. absiha
B. asiha
C. haasi
D. hai
E. None of these
Answer: Option D
Solution(By Examveda Team)
\\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' .
Join The Discussion
Comments ( 14 )
Related Questions on C Fundamentals
What is the primary purpose of a function prototype in C?
A. Declare a variable
B. Declare a function
C. Define a function
D. Assign a value
What is the correct syntax for declaring a variable in C?
A. int variable_name;
B. variable_name = 5;
C. variable_name int;
D. int = variable_name;
n not for new line for new line
only single slash
Wrong answer set in option. It may option E
sir i think it is not correct ans correct ans is option-e
i think it is option e
how it is possible
This is your correct program
main()
{
printf("nab"); /* n for newLine */
printf("bsi"); /* b for backspace */
printf("rha"); /* r moves the cursor to the start of the current line*/
}
We are kindly informing you to use single backslash ( ) instead of double backslash ( )
main()
{
printf("
ab");
printf("si");
printf("
ha");
}
answer is- E because output is -
absi
ha
_________________________________________
main()
{
printf("
ab");
printf("si");
printf("
ha");
}
answer is- D because output is - hai
Sir correct answer is (e)none of these
answer is E:none of these
when cursor goes to start of line only ha should b printed but not hai
main is not a keyword bcz of its function
answer will be e)none of these
answer will be e)none of these
answer of this question should be (E) none of these
bcause on execution of this code o/p comes out to be "ha"