{"title":"Hard asyncio quiz","description":"# Hard Quiz about Python asyncio","settings":{"shuffle_questions":false,"shuffle_options":false,"reveal_answers":false,"allow_review":true,"time_limit_seconds":0,"pass_percent":70},"questions":[{"kind":"single_choice","prompt":"Since Python 3.8, which class does asyncio.CancelledError inherit from?","explanation":"","points":2,"options":[{"label":"BaseException"},{"label":"Exception"},{"label":"asyncio.TimeoutError"},{"label":"RuntimeError"}]},{"kind":"single_choice","prompt":"What does asyncio.wait_for(coro, timeout) do to the wrapped task when timeout expires?","explanation":"","points":2,"options":[{"label":"It cancels the awaited task"},{"label":"It leaves the task running"},{"label":"It restarts the loop"},{"label":"It raises KeyboardInterrupt"}]},{"kind":"multiple_choice","prompt":"Which calls schedule concurrent execution? Select all that apply.","explanation":"","points":2,"options":[{"label":"asyncio.create_task"},{"label":"asyncio.gather"},{"label":"time.sleep"},{"label":"list.append"}]},{"kind":"free_text","prompt":"How do you make asyncio.gather return exceptions as results instead of raising? Give keyword argument.","explanation":"","points":3,"options":[]},{"kind":"free_text","prompt":"Why can you not call loop.run_until_complete inside a running coroutine? Explain in one sentence.","explanation":"","points":3,"options":[]},{"kind":"single_choice","prompt":"Which asyncio primitive protects an awaitable from outer cancellation?","explanation":"","points":2,"options":[{"label":"asyncio.shield"},{"label":"asyncio.sleep(0)"},{"label":"loop.stop"},{"label":"loop.close"}]},{"kind":"free_text","prompt":"How do you run blocking sync code without blocking the event loop? Name the API.","explanation":"","points":3,"options":[]}]}