Logo

Question preview

List in Function

What this preview is

About this preview

List in Function is a easy quant interview question on language knowledge in Python.

Unlock full access to getcracked

Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.

What this Python language-knowledge question tests

This is an easy Python question designed to check your understanding of mutable default arguments and how they behave across function calls. It's a classic gotcha that trips up candidates who haven't internalized Python's object model, and firms use it to quickly assess whether you've done real work in the language.

The question asks you to trace through code and predict its output, which means you need to understand how Python handles function defaults at definition time rather than call time, and what happens when you mutate a mutable object that serves as a default parameter. Getting this right requires clarity about object identity, scope, and the timing of default-argument evaluation.

  • Mutable vs. immutable types in Python
  • When default arguments are evaluated
  • Object identity and reference semantics
  • Side effects across function calls