1. Home
  2. Computer Science MCQs
  3. C#
  4. In C#, the expression a ?? b returns:

Added 2 Nov 2026

In C#, the expression a ?? b returns:

  1. true if both a and b are null
  2. a if it is not null, otherwise b Correct answer
  3. a and b combined into one string
  4. b if it is not null, otherwise a

Correct answer

B. a if it is not null, otherwise b

12 views

MCQSEXAM

Explanation

The null-coalescing operator (??) provides a fallback value, as in name ?? "Guest". The related ??= operator assigns only when the left side is null.

Reference

Asked in: NTS, Technical Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C# MCQs

Practise all C# MCQs

Similar MCQs