Skills101
← All practice quizzes

Quiz: Inheritance

5 questionsNo time limitPass: 60%+10 XP on first pass

Reuse code with inheritance. Single, multilevel, hierarchical and multiple inheritance as pictures, method overriding, super, the diamond problem and "composition over inheritance".

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    Which type of inheritance does Java NOT allow with classes?

  2. Question 2

    What does this print?

    class A:
        def hi(self): return "A"
    class B(A):
        pass
    class C(B):
        def hi(self): return "C"
    print(B().hi(), C().hi())
    
  3. Question 3

    Inheritance represents which relationship?

  4. Question 4

    How does Python decide which parent method to use in multiple inheritance?

  5. Question 5

    "A Car has an Engine" is modelled best with: