Question
class father:
def __init__(self, param):
self.o1 = param
class child(father):
def __init__(self, param):
self.o2 = param
>>>obj = child(22)
>>>print "%d %d" % (obj.o1, obj.o2)
a.
None None
b.
None 22
c.
22 None
d.
Error is generated
Posted under Python
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of the following code ?
Similar Questions
Discover Related MCQs
Q. Given a string example=”hello” what is the output of example.count(l)
View solution
Q. To concatenate two strings to a third what statements are applicable ?
View solution
Q. Which of the following statement prints hello\example\test.txt ?
View solution
Q. Suppose s is “\t\tWorld\n”, what is s.strip() ?
View solution
Q. The format function, when applied on a string returns :
View solution
Q. What is the output of “hello”+1+2+3 ?
View solution
Q. What will be displayed by print(ord(‘b’) – ord(‘a’)) ?
View solution
Q. Say s=”hello” what will be the return value of type(s) ?
View solution
Q. What is “Hello”.replace(“l”, “e”)
View solution
Q. To retrieve the character at index 3 from string s=”Hello” , what command do we execute ?
View solution
Q. To return the length of string s what command do we execute ?
View solution
Q. If a class defines the __str__(self) method, for an object obj for the class, you can use which command to invoke the __str__ method.
View solution
Q. To check whether string s1 contains another string s2, use
View solution
Q. Suppose i is 5 and j is 4, i + j is same as
View solution
Q. What function do you use to read a string?
View solution
Q. Suppose x is 345.3546, what is format(x, “10.3f”) (_ indicates space)
View solution
Q. What is the default value of encoding in encode()?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Python? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!