Which four code segments should you use in sequence?

You are developing an application by using C#. The application will output the text string “First Line”
followed by the text string “Second Line”.
You need to ensure that an empty line separates thetext strings.
Which four code segments should you use in sequence? (To answer, move the appropriate code segments
to the answer area and arrange them in the correct order.)

You are developing an application by using C#. The application will output the text string “First Line”
followed by the text string “Second Line”.
You need to ensure that an empty line separates thetext strings.
Which four code segments should you use in sequence? (To answer, move the appropriate code segments
to the answer area and arrange them in the correct order.)

Answer:

Explanation:
var sb = new StringBuilder();
sb.Append(“First Line”);
sb.AppendLine();
sb.Append(“Second Line”);



Leave a Reply 2

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


MarcoJacob

MarcoJacob

Code Segments:
2
3
5 (Code Segment 5 should be used 2x to have a empty line between)
7

var sb = new StringBuilder();

sb.Append(“FirstLine”);
sb.AppendLine();
sb.AppendLine();
sb.Append(“SecondLine”);

+ Console.WriteLine(sb.ToString());
Console.Read();

John

John

var sb = new StringBuilder();

sb.AppendLine(“FirstLine”);
sb.AppendLine();
sb.AppendLine(“SecondLine”);

Console.WriteLine(sb);

Console.Read();