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 syntax to define a constructor for a class named Car that takes parameters make and model?

  1. A. Car(string make, string model) { }
  2. B. Car = (string make, string model) => { }
  3. C. void Car(string make, string model) { }
  4. D. public Car(string make, string model) { }
Report Error

Which keyword is used to access members of a class from within the class itself in C#?

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

What is the purpose of a constructor in C#?

  1. A. To define properties of a class
  2. B. To initialize the object's state
  3. C. To destroy the object
  4. D. None of the above
Report Error

What is the access specifier that allows members of a class to be accessed from any other class in the same assembly in C#?

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

What is an object in C#?

  1. A. A method in C#
  2. B. A variable in C#
  3. C. An instance of a class
  4. D. A data type in C#
Report Error

Which keyword is used to create an object of a class in C#?

  1. A. create
  2. B. instance
  3. C. object
  4. D. new
Report Error

What is a class in C#?

  1. A. A blueprint for creating objects
  2. B. A method in C#
  3. C. A variable in C#
  4. D. A data type in C#
Report Error