Vidyalelo
Python · Q56

Classes and Objects in Python

Programming · Python · question 56

Q56

What will be the output of the following Python code? class stud: ‘Base class for all students’ def __init__(self, roll_no, grade): self.roll_no = roll_no self.grade = grade def display (self): print("Roll no : ", self.roll_no, ", Grade: ", self.grade) print(student.__doc__)

A.
Exception is thrown
B.
__main__
C.
Nothing is displayed
D.
Base class for all students
Answer

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board