C# - Classes and Objects Questions and Answers

Practice Mode
Showing 10 of 37 questions
Q21
Which keyword refers to the current instance of a class?
  • A base
  • B this
  • C super
  • D self
Answer: Option B
Explanation: The this keyword points to the current object.
Q22
A class that cannot be instantiated directly is called a?
  • A Sealed class
  • B Abstract class
  • C Static class
  • D Derived class
Answer: Option B
Explanation: Abstract classes require inheritance to be used.
Q23
Which of the following is used to prevent inheritance of a class?
  • A abstract
  • B sealed
  • C static
  • D final
Answer: Option B
Explanation: sealed keyword disallows further inheritance.
Q24
What is the process of combining data and methods into a class called?
  • A Polymorphism
  • B Inheritance
  • C Abstraction
  • D Encapsulation
Answer: Option D
Explanation: Encapsulation bundles data and methods together.
Q25
How can a class inherit another class in C#?
  • A Using extends
  • B Using base
  • C Using : symbol
  • D Using inherits
Answer: Option C
Explanation: Syntax is class B : A.
Q26
Which type of class cannot have instance members or constructors?
  • A Sealed class
  • B Static class
  • C Abstract class
  • D Partial class
Answer: Option B
Explanation: Static classes hold only static members.
Q27
Which keyword is used to define a class inside another class?
  • A inner
  • B nested
  • C class
  • D sub
Answer: Option C
Explanation: Nested classes are declared like normal classes inside others.
Q28
Which of the following can a class contain?
  • A Fields and methods
  • B Constructors
  • C Properties
  • D All of the above
Answer: Option D
Explanation: Classes can include all these elements.
Q29
What is used to access a member of an object?
  • A , (comma)
  • B . (dot)
  • C -> (arrow)
  • D : (colon)
Answer: Option B
Explanation: The dot operator accesses members.
Q30
Which of these cannot be accessed using an object of a class?
  • A Static members
  • B Instance members
  • C Properties
  • D Methods
Answer: Option A
Explanation: Static members are accessed using the class name.
Questions and Answers for Competitive Exams Various Entrance Test