1. Home
  2. Computer Science MCQs
  3. C#
  4. Which C# keyword declares a local variable whose type is…

Added 2 Nov 2026

Which C# keyword declares a local variable whose type is inferred by the compiler at compile time?

  1. auto
  2. object
  3. var Correct answer
  4. dynamic

Correct answer

C. var

13 views

MCQSEXAM

Explanation

var is still statically typed: the compiler fixes the type from the initialiser. dynamic postpones type checking until runtime, and auto is a C++ keyword.

Reference

Asked in: NTS, Technical Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? 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