Search⌘ K
AI Features

Quiz Yourself: C# Basics

Check your understanding of C# case sensitivity, syntax rules, type casting, and control flow structures.

We'll cover the following...

C# Basics Quiz

1.

Review the following code snippet:

int score = 85;
if (score > 80)
{
    Console.Write("Excellent");
}
else if (score > 50)
{
    Console.Write("Good");
}

Why is the output “Excellent” and not “ExcellentGood”?

A.

The else if block is only evaluated if the initial if condition is false.

B.

The variable score cannot be compared twice in the same structure.

C.

The compiler automatically adds a break statement after the first print.

D.

C# executes all true blocks but overwrites the output buffer.


1 / 14