Async & APIs with FastAPI — Practice quiz

Untimed. Answers are graded when you submit, with explanations and spaced-repetition scheduling.

  1. Question 1easy

    What does an `async def` function return when called?

  2. Question 2easy

    Which asyncio call is the equivalent of JavaScript's `Promise.all([...])`?

  3. Question 3medium

    What happens if you call an async function but forget to await it?

  4. Question 4medium

    For which kind of work does async/await actually help?

  5. Question 5medium

    Why use httpx's AsyncClient instead of the requests library inside async code?

  6. Question 6easy

    In FastAPI, what does `@app.get('/health')` do?

  7. Question 7medium

    In `async def get_topic(topic_id: str, verbose: bool = False)` on route `/topics/{topic_id}`, where does `verbose` come from?

  8. Question 8medium

    What role does a pydantic BaseModel play in a FastAPI endpoint?

  9. Question 9medium

    A client POSTs `{ "top_k": "four" }` to an endpoint expecting `top_k: int`. What does FastAPI do?

  10. Question 10hard

    What is the main benefit of injecting a resource via `Depends(get_settings)` instead of importing it directly?

  11. Question 11hard

    Which statements about `asyncio.run(main())` are true? (Select all that apply)

    Select all that apply.

  12. Question 12medium

    What does `async with httpx.AsyncClient() as client:` provide?

  13. Question 13medium

    Name the ASGI server command commonly used to run a FastAPI app in development (the program name is enough).

  14. Question 14hard

    One word: async gives you ______ (overlapping I/O waits), not true parallelism of CPU work.

0 / 14 answered