1. Home
  2. Data Science
  3. Python
  4. What does @dataclass(frozen=True) do in Python?

Added 25 Nov 2026

What does @dataclass(frozen=True) do in Python?

  1. Freezes the class definition
  2. Disables __init__
  3. Makes instances immutable Correct answer
  4. Makes the class abstract

Correct answer

C. Makes instances immutable

7 views

MCQSEXAM

Explanation

Assigning to fields of a frozen dataclass raises FrozenInstanceError.

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