Commerce

Classes And Objects In C Sharp MCQs

Practice Classes And Objects In C Sharp MCQs for competitive exams.

Classes And Objects In C Sharp MCQs

Practice questions from this topic.

In C#, what is the keyword used to create a reference to the current instance of a class?

  1. A. self
  2. B. current
  3. C. instance
  4. D. this
Report Error

What is the access modifier used to declare a class member that is accessible only within its own class in C#?

  1. A. internal
  2. B. protected
  3. C. private
  4. D. public
Report Error

In C#, what is the process of defining a new class within another class called?

  1. A. Inner Class
  2. B. Subclass
  3. C. Parent Class
  4. D. Nested Class
Report Error

What is the keyword used to create an alias for a data type in C#?

  1. A. using
  2. B. typedef
  3. C. alias
  4. D. class
Report Error

In C#, which method is automatically called when an object is created to initialize the object's state?

  1. A. Instantiate
  2. B. Initialize
  3. C. Constructor
  4. D. Destructor
Report Error

What is the concept in OOP that allows a class to have more than one method with the same name but different parameters in C#?

  1. A. Inheritance
  2. B. Method Overloading
  3. C. Encapsulation
  4. D. None of the above
Report Error

In C#, what is the keyword used to explicitly call a base class constructor from a derived class constructor?

  1. A. parent
  2. B. this.base
  3. C. base
  4. D. super
Report Error

What is the process of creating a new class based on an existing class in C# called?

  1. A. Abstraction
  2. B. Polymorphism
  3. C. Encapsulation
  4. D. Inheritance
Report Error

In C#, what is the method called automatically when an object is no longer in use and is being destroyed?

  1. A. Destructor
  2. B. Finalizer
  3. C. Dispose
  4. D. Garbage Collector
Report Error

What is the purpose of the readonly keyword when applied to a field in a class in C#?

  1. A. To indicate that the field's value can only be set once
  2. B. To indicate that the field's value cannot be changed
  3. C. To indicate that the field's value is constant
  4. D. To indicate that the field's value is null
Report Error

What is the default access modifier for class members in C# if no access modifier is specified?

  1. A. public
  2. B. protected
  3. C. internal
  4. D. private
Report Error

In C#, which keyword is used to declare a class member that can only be accessed within its own class and derived classes?

  1. A. internal
  2. B. protected
  3. C. protected internal
  4. D. private internal
Report Error