Professional Documents
Culture Documents
Oop Quiz 3
Oop Quiz 3
UMT BSEE Fall 2021 CS151 Object Oriented Programming Quiz # 3 Marks:10 Time: 20 minutes Date:
December 04, 2021
Q1. Apply the concepts of Polymorphism and modify the following piece of code into Polymorphism structure.
(CLO 2) (2 marks)
class India():
def capital(self):
print("New Delhi is the capital of India.")
class USA():
def capital2(self):
print("Washington, D.C. is the capital of USA.")
Q2. Apply the concepts of Polymorphism and write down the output of the following piece of code. (CLO 1) (3
marks)
class India():
def capital(self):
print("New Delhi is the capital of India.")
class USA():
def capital(self):
print("Washington, D.C. is the capital of USA.")
def func(obj):
obj.capital()
obj_ind = India()
obj_usa = USA()
func(obj_usa)
func(obj_ind)
Q3. Apply Polymorphism concept and write down a program to show the following output. (CLO 2) (5 marks)
Usama
Akbar