gs gs109 Python OOPs - Python Inheritance - Quiz No.2
gs gs109 Python Quiz
This quiz belongs to book/course code gs gs109 Python of gs organization. We have 134 quizzes available related to the book/course Python. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Python OOPs. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
Question 1: What does built-in function type do in context of classes?
Determines the object name of any value
Determines the class name of any value
Determines class description of any value
Determines the file name of any value
Question 2: Which of the following is not a type of inheritance?
Double-level
Multi-level
Single-level
Multiple
Question 3: What does built-in function help do in context of classes?
Determines the object name of any value
Determines the class identifiers of any value
Determines class description of any built-in type
Determines class description of any user-defined built-in type
Question 5: What type of inheritance is illustrated in the following Python code?
class A(): pass class B(): pass class C(A,B): pass
Multi-level inheritance
Multiple inheritance
Hierarchical inheritance
Single-level inheritance
Question 6: What type of inheritance is illustrated in the following Python code?
class A(): pass class B(A): pass class C(B): pass
Multi-level inheritance
Multiple inheritance
Hierarchical inheritance
Single-level inheritance
Question 7: What does single-level inheritance mean?
A subclass derives from a class which in turn derives from another class
A single superclass inherits from multiple subclasses
A single subclass derives from a single superclass
Multiple base classes inherit a single derived class
Question 9: Which of the following statements isn’t true?
A non-private method in a superclass can be overridden
A derived class is a subset of superclass
The value of a private variable in the superclass can be changed in the subclass
When invoking the constructor from a subclass, the constructor of superclass is automatically invoked
Question 10: What will be the output of the following Python code?
class A: def __init__(self,x): self.x = x def count(self,x): self.x = self.x+1 class B(A): def __init__(self, y=0): A.__init__(self, 3) self.y = y def count(self): self.y += 1 def main(): obj = B() obj.count() print(obj.x, obj.y) main()
3 0
3 1
0 1
An exception in thrown