adplus-dvertising

Welcome to the Classes,Objects and OOPS concepts MCQs Page

Dive deep into the fascinating world of Classes,Objects and OOPS concepts with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Classes,Objects and OOPS concepts, a crucial aspect of Python. In this section, you will encounter a diverse range of MCQs that cover various aspects of Classes,Objects and OOPS concepts, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Python.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Classes,Objects and OOPS concepts. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Python.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Classes,Objects and OOPS concepts. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Classes,Objects and OOPS concepts MCQs | Page 11 of 13

Explore more Topics under Python

Q101.
What is the output of the following piece of code?
class A:
    def __init__(self,x=3):
        self._x = x        
class B(A):
    def __init__(self):
        super().__init__(5)
    def display(self):
        print(self._x)
def main():
    obj = B()
    obj.display()
 
main()
Discuss
Answer: (a).5
Q102.
What is the output of the following piece of code?
class A:
    def test1(self):
        print(" test of A called ")
class B(A):
    def test(self):
        print(" test of B called ")
class C(A):
    def test(self):
        print(" test of C called ")
class D(B,C):
    def test2(self):
        print(" test of D called ")        
obj=D()
obj.test()
Discuss
Answer: (c).test of B called
Q103.
What is the output of the following piece of code?
class A:
    def test(self):
        print("test of A called")
class B(A):
    def test(self):
        print("test of B called")
        super().test()  
class C(A):
    def test(self):
        print("test of C called")
        super().test()
class D(B,C):
    def test2(self):
        print("test of D called")      
obj=D()
obj.test()
Discuss
Answer: (a).test of B called
test of C called
test of A called
Q104.
Overriding means changing behaviour of methods of derived class methods in the base class. Is the statement true or false?
Discuss
Answer: (b).False
Q105.
What is the output of the following piece of code?
class A:
    def __repr__(self):
        return "1"
class B(A):
    def __repr__(self):
        return "2"
class C(B):
    def __repr__(self):
        return "3"
o1 = A()
o2 = B()
o3 = C()
print(obj1, obj2, obj3)
Discuss
Answer: (b).1 2 3
Q106.
What is the output of the following piece of code?
class A:
    def __init__(self):
        self.multiply(15)
        print(self.i)
 
    def multiply(self, i):
        self.i = 4 * i;
class B(A):
    def __init__(self):
        super().__init__()
 
    def multiply(self, i):
        self.i = 2 * i;
obj = B()
Discuss
Answer: (d).30
Q107.
What is the output of the following piece of 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()
Discuss
Answer: (a).Demo’s check Derived’s check
Q108.
What is the output of the following piece of code?
class A:
    def __init__(self):
        self.multiply(15)
    def multiply(self, i):
        self.i = 4 * i;
class B(A):
    def __init__(self):
        super().__init__()
        print(self.i)
 
    def multiply(self, i):
        self.i = 2 * i;
obj = B()
Discuss
Answer: (b).30
Q109.
What is the output of the following piece of 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()
Discuss
Answer: (b).Demo’s check Demo’s check
Q110.
What is the output of the following piece of 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)
Discuss
Answer: (c).True

Suggested Topics

Are you eager to expand your knowledge beyond Python? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!