Bird
0
0

Which of the following best illustrates the Is-a relationship in C#?

easy🧠 Conceptual Q1 of 15
C Sharp (C#) - Inheritance
Which of the following best illustrates the Is-a relationship in C#?
AA method returns a string value
BA class Car contains an Engine object
CA class Dog inherits from class Animal
DA variable stores an integer value
Step-by-Step Solution
Solution:
  1. Step 1: Understand Is-a relationship

    The Is-a relationship means one class is a subtype of another, typically via inheritance.
  2. Step 2: Analyze options

    A class Dog inherits from class Animal shows inheritance (Dog is an Animal), which is an Is-a relationship. A class Car contains an Engine object shows composition (has-a), not Is-a. Options C and D are unrelated to class relationships.
  3. Final Answer:

    A -> Option C
  4. Quick Check:

    Inheritance means Is-a [OK]
Quick Trick: Inheritance means Is-a relationship [OK]
Common Mistakes:
MISTAKES
  • Confusing Is-a with Has-a relationship
  • Thinking method return types define Is-a
  • Assuming variables imply inheritance

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes