class Vehicle <|.. Car
interface Drivable <|-- Vehicle
medium
A. Vehicle cannot implement Car because Car is a class
B. Drivable cannot inherit Vehicle because interfaces use dashed arrows for inheritance
C. Arrow directions are reversed for both lines
D. No error, notation is correct
Solution
Step 1: Check first line meaning
Vehicle <|.. Car means Vehicle implements Car, but Car is a class, not an interface, so this is invalid.
Step 2: Check second line meaning
Drivable <|-- Vehicle means Drivable inherits Vehicle, but Drivable is an interface and Vehicle a class, so invalid.
Final Answer:
Vehicle cannot implement Car because Car is a class -> Option A
Quick Check:
Classes implement interfaces only [OK]
Hint: Classes implement interfaces, not other classes [OK]
Common Mistakes:
Allowing classes to implement classes
Reversing inheritance arrow direction
Ignoring interface vs class roles
5. You are designing a system where Smartphone inherits from Device and implements two interfaces: Camera and GPS. Which UML notation correctly represents this?
hard
A.
Smartphone <|-- Device
Smartphone <|.. Camera
Smartphone <|.. GPS
B.
Device <|-- Smartphone
Smartphone <|.. Camera
Smartphone <|.. GPS
C.
Device <|.. Smartphone
Camera <|-- Smartphone
GPS <|-- Smartphone
D.
Smartphone <|.. Device
Camera <|.. Smartphone
GPS <|.. Smartphone
Solution
Step 1: Identify inheritance direction
Smartphone inherits from Device, so arrow <|-- points from Smartphone to Device: Smartphone <|-- Device.
Step 2: Identify interface implementation
Smartphone implements Camera and GPS interfaces, so dashed arrows <|.. point from Smartphone to each interface.
Step 3: Verify all notations
Smartphone <|-- Device
Smartphone <|.. Camera
Smartphone <|.. GPS
correctly shows inheritance and interface implementation directions.
Final Answer:
Smartphone <|-- Device
Smartphone <|.. Camera
Smartphone <|.. GPS -> Option A
Quick Check:
Inheritance arrow points to parent, interface arrow dashed from class [OK]
Hint: Inheritance arrow points to parent class, interface arrow dashed from class [OK]
Common Mistakes:
Reversing inheritance arrow direction
Using solid arrow for interface implementation
Pointing interface arrows from interface to class
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.