Python for JavaScript Developers — Final Exam

14 questions · pass mark 80% · 20 minute limit. The timer auto-submits at zero.

Time remaining: 20:00
  1. Question 1easy

    In Python, how do you read the value for key 'name' from a dict `user`?

  2. Question 2easy

    Which Python expression is equivalent to JS `words.map(w => w.toUpperCase())`?

  3. Question 3easy

    What is Python's equivalent of JavaScript's `null`?

  4. Question 4medium

    Which is the idiomatic way to test that a variable equals None?

  5. Question 5medium

    Which values are FALSY in Python? (Select all that apply)

    Select all that apply.

  6. Question 6medium

    What does `nums[-1]` return for `nums = [10, 20, 30]`?

  7. Question 7medium

    What is the effect of `temperature` in `def call(prompt, model='gpt-4o-mini', temperature=0.7)`?

  8. Question 8hard

    Why is `def add_tag(tag, tags=[])` a classic Python bug?

  9. Question 9medium

    In `def find(id: str) -> Optional[Chunk]:`, what does the return type mean?

  10. Question 10medium

    What does the `@dataclass` decorator give you?

  11. Question 11hard

    What do `5 / 2` and `5 // 2` evaluate to in Python 3?

  12. Question 12medium

    What is the purpose of a Python virtual environment (venv)?

  13. Question 13medium

    What one-word Python literal syntax `{...}` builds a collection of unique, unordered items (JS Set)?

  14. Question 14hard

    Name the guard line (paraphrase ok) that makes code run only when a file is executed directly, not imported.

0 / 14 answered