Unit Test 2 - PP - WS - 2021-QP1
Unit Test 2 - PP - WS - 2021-QP1
Unit Test 2 - PP - WS - 2021-QP1
VTUDEC03
Vel Tech Rangarajan Dr. Sagunthala R&D Institute of Science and
Technology (Deemed to be University Estd. u/s 3 of UGC Act, 1956)
School of Computing
Department of Computer Science and Engineering
VTU R 15
UNIT TEST – II
B.Tech. - CSE
Course
Answer all the Questions. Marks Level
Outcome
1. a Predict the output of following Python programs? 1 CO3 K2
class X(object):
def __init__(self, a):
self.num = a
def doubleup(self):
self.num *= 2
class Y(X):
def __init__(self, a):
X.__init__(self, a)
def tripleup(self):
self.num *= 3
obj = Y(4)
print(obj.num)
obj.doubleup()
print(obj.num)
obj.tripleup()
print(obj.num)
b Give a suitable example using Python code to illustrate single level 2 CO3 K2
inheritance considering COUNTRY to be BASE class and STATE to
be derived class.