Python: Which statement about weakref and Object Lifetime is the strongest interview answer?

Difficulty:

Easy

Questions:

1

Time Limit:

2 minutes

Passing Score:

100%

Question

Which statement about weakref and Object Lifetime is the strongest interview answer?

  1. weakref and Object Lifetime is mostly a naming style choice and has little effect on runtime behavior or design tradeoffs.
  2. weakref and Object Lifetime exists mainly to reduce the number of files in a Python project.
  3. weakref lets code reference an object without keeping it alive solely because the cache or observer still knows about it.
  4. weakref and Object Lifetime matters only for frontend scripting and not for backend or automation code.

Hint

Start with the core rule behind weakref and Object Lifetime.

Answer and rationale

Correct answer: C. weakref lets code reference an object without keeping it alive solely because the cache or observer still knows about it.

weakref lets code reference an object without keeping it alive solely because the cache or observer still knows about it. This is the base concept interviewers commonly test first.

Track: Python