Topic / 95 questions

C# MCQs

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

Page 2 of 5

Question 22 C#

Where is a member marked protected internal accessible in C#?

Correct answer D. Anywhere in the same assembly, or in derived classes in any assembly

Open question
Advertisement
Question 25 C#

What does the sealed modifier do when applied to a C# class?

Correct answer A. It prevents other classes from inheriting from it

Open question
Question 26 C#

Which statement about an abstract class in C# is true?

Correct answer A. It cannot be instantiated directly and may contain abstract members without bodies

Open question
Advertisement
Question 31 C#

What is the purpose of implementing IDisposable in a C# class?

Correct answer B. To give callers a Dispose method that releases unmanaged or expensive resources deterministically

Open question
Question 34 C#

What does default(T) produce in a C# generic method?

Correct answer B. null for reference types and the zero value for value types

Open question
Advertisement
Question 36 C#

What does the event keyword add when applied to a delegate field in a C# class?

Correct answer C. Outside code can only subscribe with += and unsubscribe with -=, not invoke or replace it

Open question