Inheritance

38 MCQs

MCQs

38 questions · 30 min · 38 marks

Want to try first? Take the free Computer Science test: Networks Basics

Sample questions

The first 5 of 38. Try each one, then tap to see the answer.

  1. Question 1

    Inheritance in OOP means:

    • AReusing and extending functionality from a parent class to a child class
    • BHiding data in a class
    • CCreating multiple instances of the same class
    • DManaging behaviour of classes
    Show answer

    Answer: A

    Inheritance lets a child class reuse and extend what a parent class provides.

  2. Question 2

    An example of inheritance in Python is:

    • ACreating two classes with similar attributes
    • BA child class inheriting attributes and methods from a parent class
    • CUsing private variables within a class
    • DModifying a method inside the same class
    Show answer

    Answer: B

    Inheritance means a child class takes attributes and methods from a parent class.

  3. Question 3

    Inheritance allows a class to:

    • AHide its data only
    • BInherit attributes and methods from another class
    • CDefine multiple functions only
    • DCreate objects without a class
    Show answer

    Answer: B

    A class can inherit attributes and methods from another class.

  4. Question 4

    The class that inherits from another class is called a:

    • ASuperclass
    • BBase class
    • CSubclass
    • DModule
    Show answer

    Answer: C

    The inheriting class is called a subclass.

  5. Question 5

    The parent class is also known as the:

    • ASubclass
    • BBase class
    • CDerived class
    • DChild class
    Show answer

    Answer: B

    The parent class is the base class or superclass.

More tests in Object Oriented Programming Using Python

Practise with a free account

Save your scores, see which chapters need work, and keep a notebook of every question you got wrong.

Create free account