You are on page 1of 2

Section: Name: ID:

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

I am the student of Object oriented Programming class

Akbar

I am the student of Object oriented Programming class section X

You might also like