Which three code fragments will display "Hello" followed by a new line?

You want to insert a new line on the console. Which three code fragments will display “Hello”
followed by a new line? (Each correct answer presents a complete solution. Choose three.)

You want to insert a new line on the console. Which three code fragments will display “Hello”
followed by a new line? (Each correct answer presents a complete solution. Choose three.)

A.
Console.Write(“Hello\t”) ;

B.
Console.Write(“Hello\n”);

C.
Console.Error.Write(“Hello\t”);

D.
Console.Error.WriteLine (“Hello”) ;

E.
Console.WriteLine(“Hello”);

Explanation:
B: \n adds a newline.
D: Console.Error.WriteLine writes a newline.
E: Console.WriteLine writes a newline.
Incorrect:
A, C: \t is just a space



Leave a Reply 1

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