gs gs109 Python OOPs - Python Polymorphism - 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 5 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 2: What will be the output of the following Python code?
class Demo: def __check(self): return " Demo's check " def display(self): print(self.check()) class Demo_Derived(Demo): def __check(self): return " Derived's check " Demo().display() Demo_Derived().display()
Demo’s check Derived’s check
Demo’s check Demo’s check
Derived’s check Demo’s check
Syntax error
Question 3: What will be the output of the following Python code?
class A: def __init__(self, x, y): self.x = x self.y = y def __str__(self): return 1 def __eq__(self, other): return self.x * self.y == other.x * other.y obj1 = A(5, 2) obj2 = A(2, 5) print(obj1 == obj2)
False
1
True
An exception is thrown
Question 5: Which of the following statements is true?
A non-private method in a superclass can be overridden
A subclass method can be overridden by the superclass
A private method in a superclass can be overridden
Overriding isn’t possible in Python