C# - Classes and Objects Questions and Answers
Practice ModeShowing 10 of 37 questions
Q21
Which keyword refers to the current instance of a class?
Answer: Option B
Explanation: The this keyword points to the current object.
Q22
A class that cannot be instantiated directly is called a?
Answer: Option B
Explanation: Abstract classes require inheritance to be used.
Q23
Which of the following is used to prevent inheritance of a class?
Answer: Option B
Explanation: sealed keyword disallows further inheritance.
Q24
What is the process of combining data and methods into a class called?
Answer: Option D
Explanation: Encapsulation bundles data and methods together.
Q25
How can a class inherit another class in C#?
Answer: Option C
Explanation: Syntax is class B : A.
Q26
Which type of class cannot have instance members or constructors?
Answer: Option B
Explanation: Static classes hold only static members.
Q27
Which keyword is used to define a class inside another class?
Answer: Option C
Explanation: Nested classes are declared like normal classes inside others.
Q28
Which of the following can a class contain?
Answer: Option D
Explanation: Classes can include all these elements.
Q29
What is used to access a member of an object?
Answer: Option B
Explanation: The dot operator accesses members.
Q30
Which of these cannot be accessed using an object of a class?
Answer: Option A
Explanation: Static members are accessed using the class name.