main()

{

printf("\nab");

printf("\bsi");

printf("\rha");

}

Answers were Sorted based on User's Feedback



main() { printf("\nab"); printf("\bsi"); printf..

Answer / susie

Answer :

hai

Explanation:

\n - newline

\b - backspace

\r - linefeed

Is This Answer Correct ?    93 Yes 13 No

main() { printf("\nab"); printf("\bsi"); printf..

Answer / jane

<new line>ab<backspace>si<carriage return>ha

First, handle the backspace. Note that even though it is "non-erase", the next character to be output would overwrite what was backspaced over:

<new line>asi<carriage return>ha

Now, a carriage return means to go back to the beginning of the line. So the "ha" overwrites the "as" in "asi:

<new line>hai

Now, the cursor is currently sitting on the i, so the next character to be output would overwrite i.

Is This Answer Correct ?    34 Yes 2 No

main() { printf("\nab"); printf("\bsi"); printf..

Answer / dhiraj s

Ans-hai

Is This Answer Correct ?    32 Yes 2 No

Post New Answer

More C Code Interview Questions

main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

2 Answers  


void main () { int x = 10; printf ("x = %d, y = %d", x,--x++); } a. 10, 10 b. 10, 9 c. 10, 11 d. none of the above

2 Answers   HCL,


Write a procedure to implement highlight as a blinking operation

2 Answers  


write a program to count the number the same (letter/character foreg: 's') in a given sentence.

2 Answers  


main() { printf("%x",-1<<4); }

3 Answers   HCL, Sokrati, Zoho,






Is the following code legal? struct a { int x; struct a b; }

1 Answers  


#include<stdio.h> main() { FILE *ptr; char i; ptr=fopen("zzz.c","r"); while((i=fgetch(ptr))!=EOF) printf("%c",i); }

1 Answers  


Program to find the largest sum of contiguous integers in the array. O(n)

11 Answers  


#define max 5 #define int arr1[max] main() { typedef char arr2[max]; arr1 list={0,1,2,3,4}; arr2 name="name"; printf("%d %s",list[0],name); }

1 Answers  


main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; printf("\n%d %d %d",a,*f1,*f2); }

6 Answers  


write a program to find out roots of quadratic equation "x=-b+-(b^2-4ac0^-1/2/2a"

2 Answers  


int i; main(){ int t; for ( t=4;scanf("%d",&i)-t;printf("%d\n",i)) printf("%d--",t--); } // If the inputs are 0,1,2,3 find the o/p

2 Answers  


Categories