1. Find the output :
class Glove:
def __init__(self,color):
self.__color = color
def get_color(self):
return self.__color
def set_color(self,color):
self.__color= color
class Minion:
def __init__(self,glove):
self.__glove=glove
self.__color="Yellow"
def get_glove(self):
return self.__glove
black_glove = Glove("Black")
red_glove = Glove("Red")
bob = Minion(black_glove)
black_glove.set_color(red_glove.get_color())
print(#line)
What should be placed in the place of #line to get the color of bob Minion’s glove ?
a. bob.__glove.__color
b. red_glove.get_color()
c. bob.get_glove().get_color()
d. bob.get_glove().__color
View Answer
Ans. c
Explanation : Option C is correct as bob is the object of Minion class
2. Find the output :
a = 8.3
b = 2
print(a//b)
a. 4.15
b. 4
c. 4.1
d. 4.0
View Answer
Ans. d
Explanation : ‘/’ would have given 4.15 as the answer. However, ‘//’ operator performs floor division.
3. Find the output :
s1={3, 4}
s2={1, 2}
s3=set()
i=0
j=0
for i in s1:
for j in s2:
s3.add((i,j))
i+=1
j+=1
print(s3)
a. {(3, 4), (1, 2)}
b. Error
c. {(4, 2), (3, 1), (4, 1), (5, 2)}
d. {(3, 1), (4, 2)}
View Answer
Ans. c
Explanation : Above code runs for
i = 3 j = 1
i = 4 j = 2
i = 4 j = 1
i = 5 j = 2
{(3, 1), (4, 1), (4, 2), (5, 2)}
4. Find the output :
class A():
def disp(self):
print("A disp()")
class B(A):
pass
obj = B()
obj.disp()
a. Invalid syntax for inheritance
b. Error because when object is created, argument must be passed
c. Nothing is printed
d. A disp()
View Answer
Ans. d
Explanation : We created an object of class B that inherits class A and so disp() method (of class A) becomes visible with reference to object obj. Option d is correct
5. Consider the following code :
class Customer:
def __init__(self,cust_id, cust_name):
self.__cust_id = cust_id
self.__cust_name = cust_name
self.__bill_amount = 0.0
class RegularCustomer(Customer):
def __init__(self,cust_id, cust_name):
self.__cust_id = cust_id
self.__cust_name = cust_name
self.__bill_amount = 0.0
self.__discount = 5
Identify the OOP principle(s) that has/have been implemented in the above code :
a. Only Encapsulation
b. Only Inheritance
c. Both Encapsulation and Inheritance
d. Only Polymorphism
View Answer
Ans. b
Explanation : Clearly, RegularCustomer class inherits Customer class, perfect example of Inheritance.

Question No.38 ….I don’t find any reason to tell option “C” is correct can you verify…
because there will be 3 arguments given instead of 2
Question no 45 ….I think the 3rd line “global int” has missed proper indentation some how….
Question 61 . I was just wondering why the answer is “d” that is error…