12 original questions: recall (25%) + application (50%) + arbitration (25%) on Data structures & OOP.
Answer everything, then click Check: your score and explanations will appear.
2.1 · Recall
1. Which structure should you choose to map a customer code to its info?
The dict is the directory: access by key, .get() with no KeyError, iteration with .items().
2.1 · Application
2. Nabil writes "copie = ventes" then modifies "copie". What happens?
= shares, it does not copy: .copy() flat, deepcopy() for nested data.
2.1 · Arbitration
3. A colleague looks up each customer by scanning a 50,000-row list every time. Nabil's verdict?
Looking up by identifier = indexed dict; the list stays for order and iteration.
2.2 · Recall
4. Why prefer f-strings over concatenation with +?
f"Total : {total:.2f} €": variable, computation and format in one readable line.
2.2 · Application
5. Nabil reads an export with broken accents and a sometimes locked file. What does he fix?
with closes by itself even on error; utf-8 encoding keeps accents; "w" overwrites, it does not read.
2.2 · Application
6. Nabil's summary must survive a restart and stay exchangeable. Which format?
JSON = persistent lists and dicts, readable by other tools; the csv module for spreadsheets.
2.3 · Recall
7. What does "self" mean in a method?
self is written in the definition, never at the call: each object keeps its own state.
2.3 · Application
8. Nabil creates VenteRemise(Vente) with a rate and super().__init__(). What did he do?
Inheritance for is-a, kept shallow; composition (has) otherwise.
2.3 · Arbitration
9. A colleague proposes 6 inheritance levels and dicts + global functions "to go fast". Verdict?
Data + behaviors in a class, measured inheritance, __str__/__eq__ and @dataclass where suitable.
2.4 · Application
10. Nabil converts input with float(). How to make it reliable?
Precise risky part framed, targeted type, real handling — never a bare except.
2.4 · Application
11. A negative amount arrives in Vente(...). Where to reject it?
raise signals the violated invariant at the source; finally cleans up, else continues if OK.
2.4 · Arbitration
12. A colleague wants a general "except: pass" to "no longer see errors". Nabil's verdict?
Silencing buries live bugs: only catch what you know how to handle.
What's next?
Score ≥ 80%: move to Level 3 — modules, pip/venv and advanced functions, on your solid data and object foundations.
Score 60-79%: review the missed sections (2.1 containers/copies, 2.2 f-strings/with/JSON, 2.3 classes/inheritance/dunders, 2.4 targeted try/raise) and redo the 48h challenges.
Score < 60%: rebuild Nabil's project step by step (sales as a list of dicts, report in f-strings + JSON, Vente classes, hardened import), then retake the test.
In all cases: keep the reflexes — right container for the right use, f-strings + with/encoding, first-class objects, targeted excepts with no silencing.