66. Find the output :
x=12
def f1(a,b=x):
print(a,b)
x=15
f1(4)
a. Error
b. 12 4
c. 4 12
d. 4 15
View Answer
Ans. c
67. Find the output :
False==()or[]
a. None
b. False
c. True
d. [ ]
View Answer
Ans. d
68. Find the output :
class fruits:
def __init__(self):
self.price = 100
self.__bags = 5
def display(self):
print(self.__bags)
obj=fruits()
obj.display()
a. The program has an error because display() is trying to print a private class member
b. The program runs fine but nothing is printed
c. The program runs fine and 5 is printed
d. The program has an error because display() can’t be accessed
View Answer
Ans. c
69. Syntax of constructor in Python?
a. def __init__()
b. def _init_()
c. _init_()
d. All of these
View Answer
Ans. a
70. Find the output :
class A:
def one(self):
return self.two()
def two(self):
return 'A'
class B(A):
def two(self):
return 'B'
obj1=A()
obj2=B()
print(obj1.two(),obj2.two())
a. A A
b. A B
c. B B
d. An exception is thrown
View Answer
Ans. b