Skip to main content
C# / .NET Output Prediction Easy +10 XP

Nullable Type

What does int? mean in C#?

C# / .NETRead-only
int? score = null;
Console.WriteLine(score.HasValue);

What is the output?

Show answer and explanation

Answer: false

int? is shorthand for Nullable<int>. HasValue returns false when the value is null.

Hint: HasValue checks if the nullable has a real value.

What this challenge tests

Output Prediction in C# / .NET: nullable, types.

Related challenges