C# - Classes and Objects Questions and Answers

Practice Mode
Showing 10 of 37 questions
Q31
Which keyword restricts a method from being overridden?
  • A virtual
  • B sealed
  • C override
  • D static
Answer: Option B
Explanation: Sealed methods block overriding in derived classes.
Q32
What is a blueprint for an object?
  • A Namespace
  • B Class
  • C Method
  • D Field
Answer: Option B
Explanation: Classes define the structure of objects.
Q33
What is a property in C# mainly used for?
  • A To store constants
  • B To control access to class fields
  • C To handle exceptions
  • D To create loops
Answer: Option B
Explanation: Properties encapsulate getters and setters.
Q34
When is a destructor called in C#?
  • A During object creation
  • B During object deletion
  • C During object copying
  • D During compilation
Answer: Option B
Explanation: Destructors clean up resources when an object is destroyed.
Q35
What is the function of a constructor overloading?
  • A To change class behavior
  • B To initialize objects differently
  • C To create multiple objects
  • D To copy data
Answer: Option B
Explanation: Constructors with different parameters serve different initialization needs.
Q36
Which keyword is used to inherit from a base class constructor?
  • A this()
  • B base()
  • C init()
  • D super()
Answer: Option B
Explanation: base() calls parent class constructors.
Q37
Which statement about objects is true?
  • A Objects consume no memory
  • B Each object occupies separate memory space
  • C All objects share one memory block
  • D Objects cannot be copied
Answer: Option B
Explanation: Every object is stored in its own heap memory allocation.
Questions and Answers for Competitive Exams Various Entrance Test