Bird
0
0

What is the output of this C# code?

medium📝 Predict Output Q13 of 15
C Sharp (C#) - Strings and StringBuilder
What is the output of this C# code?
string a = "Hello";
string b = "World";
string c = a + ", " + b + "!";
Console.WriteLine(c);
AHello, World!
BHello World!
CHello,World!
DHelloWorld!
Step-by-Step Solution
Solution:
  1. Step 1: Analyze string concatenation parts

    The code joins "Hello", ", ", "World", and "!" in order, so the result is "Hello, World!".
  2. Step 2: Confirm output of Console.WriteLine

    Console.WriteLine prints the combined string exactly as concatenated.
  3. Final Answer:

    Hello, World! -> Option A
  4. Quick Check:

    Strings + punctuation join as typed [OK]
Quick Trick: Watch spaces and punctuation in concatenation [OK]
Common Mistakes:
MISTAKES
  • Missing spaces or commas in output
  • Ignoring punctuation strings
  • Confusing concatenation order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes