Home » Programming Language (coding) » Python MCQ » Study the following program: class book: def __init__(a, b): a.o1 = b class child(book): def __init__(a, b): a.o2 = b obj = page(32) print “%d %d” % (obj.o1, obj.o2)

Study the following program: class book: def __init__(a, b): a.o1 = b class child(book): def __init__(a, b): a.o2 = b obj = page(32) print “%d %d” % (obj.o1, obj.o2)

Study the following program:

class book:  
    def __init__(a, b):  
        a.o1 = b  
   
class child(book):  
    def __init__(a, b):  
        a.o2 = b  
   
obj = page(32)  
print "%d %d" % (obj.o1, obj.o2)  

Which of the following is the correct output of this program?

A. 32
B. 32 32
C. 32 None
D. Error is generated

Correct Answer: Option D. Error is generated 

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
28 − 2 =