Python: In Python, which comparison about weakref and Object Lifetime is accurate?

Difficulty:

Easy

Questions:

1

Time Limit:

2 minutes

Passing Score:

100%

Question

In Python, which comparison about weakref and Object Lifetime is accurate?

  1. There is no practical difference in behavior, performance, or maintainability when weakref and Object Lifetime is involved.
  2. The oldest option related to weakref and Object Lifetime is always the right production choice regardless of workload or context.
  3. Differences around weakref and Object Lifetime are mostly cosmetic, so correctness and debugging quality do not really change.
  4. Strong references preserve objects, while weak references allow caches or registries to observe objects without taking ownership of their lifetime.

Hint

Focus on the behavior or tradeoff, not just the keyword.

Answer and rationale

Correct answer: D. Strong references preserve objects, while weak references allow caches or registries to observe objects without taking ownership of their lifetime.

Strong references preserve objects, while weak references allow caches or registries to observe objects without taking ownership of their lifetime. This is the comparison that usually separates memorization from understanding.

Track: Python