gs gs108 Object Oriented Concepts - Method Overriding - Quiz No.1
gs gs108 CSharp Quiz
This quiz belongs to book/course code gs gs108 CSharp of gs organization. We have 110 quizzes available related to the book/course CSharp. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Object Oriented Concepts. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
Question 1: Which keyword is used to declare a base class method while performing overriding of base class methods?
this
virtual
override
extend
Question 2: The process of defining a method in a subclass having same name & type signature as a method in its superclass is known as?
Method overloading
Method overriding
Method hiding
None of the mentioned
Question 3: Which of the given modifiers can be used to prevent Method overriding?
Static
Constant
Sealed
final
Question 4: Select the correct statement from the following?
Static methods can be a virtual method
Abstract methods can be a virtual method
When overriding a method, the names and type signatures of the override method must be the same as the virtual method that is being overridden
We can override virtual as well as nonvirtual methods
Question 5: Which of the following cannot be used to declare a class as a virtual?
Methods
Properties
Events
Fields
Question 8: The modifier used to hide the base class methods is?
Virtual
New
Override
Sealed
Question 9: To override a method in the subclass, the base class method should be defined as?
Virtual
Abstract
Override
All of the mentioned
Question 10: What will be the output of the following C# code?
class a { public void fun() { Console.WriteLine("base method"); } } class b: a { public new void fun() { Console.WriteLine(" derived method "); } } class Program { static void Main(string[] args) { b k = new b(); k.fun(); Console.ReadLine(); } }
Base method
Derived method
Code runs successfully prints nothing
Compile time error