Question
In Python QUESTION 1 In Python, all classes derive from which base class? python class object base QUESTION 2 A class can only inherit from
In Python
QUESTION 1
-
In Python, all classes derive from which base class?
python
class
object
base
QUESTION 2
-
A class can only inherit from at most one other class
True
False
QUESTION 3
-
If we don't provide an __init__ method to a derived class, then when we create an instance of that class
The object will not be created.
It's parent's __init__ method will be called, if one exists.
The parent's attributes will not be set.
An error will occur.
QUESTION 4
-
If our derived class provides its own __init__ method then when an instance of that class is made
Only the base class' __init__ method is called
An error occurs.
The derived class' __init__ method is called followed by the base class' __init__ method
Only the derived class' __init__ method is called.
10 points
QUESTION 5
-
The super() function
Makes a class an abstract base class.
Returns a reference to the instance of the next base class associated with this instance of the derived class.
Upgrades a class to become a superclass
Calls the constructor of a base class
QUESTION 6
-
A class that cannot be instantiated itself but that specifies which methods and attributes must be defined by any class that wants to derive from it is called a
Derived class
Abstract base class
Base class
Parent class
QUESTION 7
-
This characteristic of OOP allows the correct version of an overridden methods to be called when an instance of a subclass is used to call it
Composition
Specialization
Overloading
Polymorphism
8
-
You can use this to determine whether an object is an instance of a class
The in operator
The is_object_of function
The isinstance function
The is operator
QUESTION 9
-
A subclass can have a method with the same name as method in the superclass
True
False
QUESTION 10
-
What type of relationship does inheritance creates between classes?
creates-a
uses-a
has-a
is-a
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started