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', end=' ')
class B(A):
def __init__(self):
print('B', end=' ')
super().__init__()
B()
  1. A B
  2. B A Correct answer
  3. B
  4. Error

Correct answer

B. B A

11 views

MCQSEXAM

Explanation

The child's __init__ calls the parent's via super().

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 B? 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