1. Home
  2. Data Science
  3. Python
  4. What is the output of the following Python code snippet?

Added 25 Nov 2026

What is the output of the following Python code snippet?

class A:
def __init__(self): print('A init')
class B(A):
def __init__(self): print('B init')
B()
  1. A init
  2. Error
  3. B init Correct answer
  4. None

Correct answer

C. B init

MCQSEXAM

Explanation

A subclass __init__ without super().__init__() does not run the parent's __init__.

Reference

Asked in: Python Interview OOP

https://docs.python.org/3/tutorial/classes.html

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs