Topic / 95 questions

C# MCQs

Page 4 of C# multiple-choice questions with answers. Tap an option to check yourself.

Page 4 of 5

Question 62 C#

What rule applies to an out parameter in C#?

Correct answer B. The method must assign it before returning; the caller need not initialise it

Open question
Question 63 C#

What does the in modifier on a C# method parameter mean?

Correct answer B. The argument is passed by reference but cannot be modified by the method

Open question
Advertisement
Question 65 C#

Which rule applies to optional parameters in C#?

Correct answer D. They must come after all required parameters and have compile-time constant defaults

Open question
Question 68 C#

What is the key difference between const and readonly fields in C#?

Correct answer B. const is fixed at compile time; readonly can be assigned at declaration or in a constructor

Open question
Advertisement
Question 72 C#

In C#, what is boxing?

Correct answer B. Converting a value type to object or an interface type, which copies it into a heap object

Open question
Question 75 C#

Which statement about the var keyword in C# is true?

Correct answer B. The type is inferred at compile time and the variable stays strongly typed

Open question
Advertisement
Question 76 C#

How does dynamic differ from var in C#?

Correct answer B. dynamic defers member binding and type checking to run time, while var is resolved at compile time

Open question