In C#, which keyword is used to define a class that inherits from another class?

C# Inheritance Quiz

Quiz
•
•
Medium
Dnyaneshwar Chaudhary
Used 1+ times
FREE Resource
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
A. base
B. extend
C. inherit
D. : (colon)
2.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
What is the term for a class that cannot be instantiated and is only meant to be inherited from in C#?
A. Final class
B. Base class
C. Abstract class
D. Sealed class
3.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Which keyword in C# is used to prevent a class from being inherited by other classes?
A. abstract
B. static
C. sealed
D. override
4.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
What will be the output of the following code?
class Country
{
public virtual void country()
{
Console.WriteLine("India");
}
}
class India : Country
{
public new void country()
{
Console.WriteLine("Best");
}
}
Country india=new Country();
Country India=new India();
India country=new india();
country.country();
A. "India"
"India"
"Best"
B. "India"
"Best"
"Best"
C. "Best"
"India"
"Best"
D. Compilation Error
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Suppose you have a base class Shape and two derived classes Circle and Rectangle. How would you implement method overriding in C# to calculate the area for each shape?
A. Use the base keyword in the derived class methods.
B. Use the new keyword in the derived class methods.
C. Use the virtual keyword in the base class and override keyword in the derived classes.
D. Use the override keyword in the base class and virtual keyword in the derived classes.
Similar Resources on Wayground
10 questions
physics kssm form 4 (1.1 physical quantities)

Quiz
•
10th - 11th Grade
10 questions
Power Sharing Class 10

Quiz
•
7th - 12th Grade
10 questions
Climate and Natural Vegetation of India

Quiz
•
10th Grade
9 questions
Inheritance + java

Quiz
•
University
10 questions
Base and derived quantities

Quiz
•
10th - 11th Grade
10 questions
SS7H3ab Indian Independence and Gandhi

Quiz
•
7th Grade
10 questions
Day 15 Assessment -Encapsulation & Abstraction, Exception-28June

Quiz
•
University
10 questions
Indian Independence

Quiz
•
7th Grade
Popular Resources on Wayground
25 questions
Equations of Circles

Quiz
•
10th - 11th Grade
30 questions
Week 5 Memory Builder 1 (Multiplication and Division Facts)

Quiz
•
9th Grade
33 questions
Unit 3 Summative - Summer School: Immune System

Quiz
•
10th Grade
10 questions
Writing and Identifying Ratios Practice

Quiz
•
5th - 6th Grade
36 questions
Prime and Composite Numbers

Quiz
•
5th Grade
14 questions
Exterior and Interior angles of Polygons

Quiz
•
8th Grade
37 questions
Camp Re-cap Week 1 (no regression)

Quiz
•
9th - 12th Grade
46 questions
Biology Semester 1 Review

Quiz
•
10th Grade
Discover more resources for
25 questions
Equations of Circles

Quiz
•
10th - 11th Grade
30 questions
Week 5 Memory Builder 1 (Multiplication and Division Facts)

Quiz
•
9th Grade
33 questions
Unit 3 Summative - Summer School: Immune System

Quiz
•
10th Grade
10 questions
Writing and Identifying Ratios Practice

Quiz
•
5th - 6th Grade
36 questions
Prime and Composite Numbers

Quiz
•
5th Grade
14 questions
Exterior and Interior angles of Polygons

Quiz
•
8th Grade
37 questions
Camp Re-cap Week 1 (no regression)

Quiz
•
9th - 12th Grade
46 questions
Biology Semester 1 Review

Quiz
•
10th Grade