Skip to main content

Concept Of Object Oriented Programs In Python — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Concept Of Object Oriented Programs In Python — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/40 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 40
★ FPSC ★ PPSC

Which of these is a private data field? def Demo: def __init__(self): __a = 1 self.__b = 1 self.__c__ = 1 __d__= 1

Question 2 of 40
★ FPSC ★ PPSC

What will be the output of the following Python 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()

Question 3 of 40
★ FPSC ★ PPSC

Private members of a class cannot be accessed.

Question 4 of 40
★ FPSC ★ PPSC

What is the purpose of the @property decorator in object-oriented programming?

Question 5 of 40
★ FPSC ★ PPSC

What is the purpose of using encapsulation in object-oriented programming?

Question 6 of 40
★ FPSC ★ PPSC

How is polymorphism implemented in object-oriented programming?

Question 7 of 40
★ FPSC ★ PPSC

What is the primary purpose of a constructor in object-oriented programming?

Question 8 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? class A: def __init__(self, x= 1): self.x = x class der(A): def __init__(self,y = 2): super().__init__() self.y = y def main(): obj = der() print(obj.x, obj.y) main()

Question 9 of 40
★ FPSC ★ PPSC

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()

Question 10 of 40
★ FPSC ★ PPSC

Which of the following is false about protected class members?

Question 11 of 40
★ FPSC ★ PPSC

Which of these is not a fundamental features of OOP?

Question 12 of 40
★ FPSC ★ PPSC

What is the main advantage of using encapsulation in object-oriented programming?

Question 13 of 40
★ FPSC ★ PPSC

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)

Question 14 of 40
★ FPSC ★ PPSC

All subclasses are a subtype in object-oriented programming.

Question 15 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? class Test: def __init__(self): self.x = 0 class Derived_Test(Test): def __init__(self): Test.__init__(self) self.y = 1 def main(): b = Derived_Test() print(b.x,b.y) main()

Question 16 of 40
★ FPSC ★ PPSC

Which principle of OOP allows a class to provide a specific implementation of a method that is already defined in its parent class?

Question 17 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? class Demo: def __init__(self): self.a = 1 self.__b = 1 def get(self): return self.__b obj = Demo() obj.a=45 print(obj.a)

Question 18 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? class fruits: def __init__(self): self.price = 100 self.__bags = 5 def display(self): print(self.__bags) obj=fruits() obj.display()

Question 19 of 40
★ FPSC ★ PPSC

Method issubclass() checks if a class is a subclass of another class.

Question 20 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? class Demo: def __init__(self): self.a = 1 self.__b = 1 def get(self): return self.__b obj = Demo() print(obj.get())

Question 21 of 40
★ FPSC ★ PPSC

What will be the output of the following Python 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()

Question 22 of 40
★ FPSC ★ PPSC

Methods of a class that provide access to private members of the class are called as . . . . . . . . and . . . . . . . .

Question 23 of 40
★ FPSC ★ PPSC

Which principle of OOP is associated with the concept of "IS-A" relationship?

Question 24 of 40
★ FPSC ★ PPSC

What will be the output of the following Python 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()

Question 25 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? class A(): def disp(self): print("A disp()") class B(A): pass obj = B() obj.disp()

Question 26 of 40
★ FPSC ★ PPSC

Suppose B is a subclass of A, to invoke the __init__ method in A from B, what is the line of code you should write?

Question 27 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? class Test: def __init__(self): self.x = 0 class Derived_Test(Test): def __init__(self): self.y = 1 def main(): b = Derived_Test() print(b.x,b.y) main()

Question 28 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? class Demo: def __new__(self): self.__init__(self) print("Demo's __new__() invoked") def __init__(self): print("Demo's __init__() invoked") class Derived_Demo(Demo): def __new__(self): print("Derived_Demo's __new__() invoked") def __init__(self): print("Derived_Demo's __init__() invoked") def main(): obj1 = Derived_Demo() obj2 = Demo() main()

Question 29 of 40
★ FPSC ★ PPSC

When defining a subclass in Python that is meant to serve as a subtype, the subtype Python keyword is used.

Question 30 of 40
★ FPSC ★ PPSC

What is the main advantage of using polymorphism in object-oriented programming?

Question 31 of 40
★ FPSC ★ PPSC

What is the benefit of using polymorphism in object-oriented programming?

Question 32 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? class A: def one(self): return self.two() def two(self): return 'A' class B(A): def two(self): return 'B' obj2=B() print(obj2.two())

Question 33 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? class student: def __init__(self): self.marks = 97 self.__cgpa = 8.7 def display(self): print(self.marks) obj=student() print(obj._student__cgpa)

Question 34 of 40
★ FPSC ★ PPSC

What will be the output of the following Python 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()

Question 35 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? class A: def __init__(self): self.__i = 1 self.j = 5 def display(self): print(self.__i, self.j) class B(A): def __init__(self): super().__init__() self.__i = 2 self.j = 7 c = B() c.display()

Question 36 of 40
★ FPSC ★ PPSC

What will be the output of the following Python 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)

Question 37 of 40
★ FPSC ★ PPSC

Overriding means changing behaviour of methods of derived class methods in the base class.

Question 38 of 40
★ FPSC ★ PPSC

How is the concept of abstraction achieved in object-oriented programming?

Question 39 of 40
★ FPSC ★ PPSC

What type of inheritance is illustrated in the following Python code? class A(): pass class B(A): pass class C(B): pass

Question 40 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? class Demo: def __init__(self): self.a = 1 self.__b = 1 def display(self): return self.__b obj = Demo() print(obj.__b)

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 Examiner's Advisory for Programming & Software Development

In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →