Skip to content
క
kagitha
/
quiz
/
python-async
Subscribe
Index
⌘K
JAVA NOTEBOOK · QUIZ 18 · INTERMEDIATE
Python async and await for Java developers
QUESTION 01 / 04
What do you get if you call an async function without await: answer = ask("hi")?
A
The answer
B
None
C
A coroutine object, and a never-awaited warning
D
A Future that completes later
SCORE SO FAR · 0 / 0
Share this quiz ↗
What do you get if you call an async function without await: answer = ask("hi")?
— A coroutine object, and a never-awaited warning. Calling an async def function creates a coroutine but doesn't run it. You must await it (or schedule it as a task) to get the result.
Which call is closest to CompletableFuture.allOf for three coroutines?
— await asyncio.gather(a, b, c). gather runs the coroutines concurrently and returns their results in order. Awaiting them one by one runs them sequentially.
What happens if you call time.sleep(5) inside an async def function?
— The whole event loop freezes, so every task waits. Async runs on one thread. A blocking call stops the event loop for everyone. Use await asyncio.sleep(5) and async clients instead.
You need to send 200 LLM requests but stay under a rate limit. What helps?
— asyncio.Semaphore to cap how many run at once. Wrap each call in async with semaphore, so only N requests are in flight at a time, like java.util.concurrent.Semaphore.
kagitha
Close
✕
Search everything — articles, videos, chapters, agents, books
01
AI
02
Java
03
System Design
04
Series
05
Manga
06
The Lab
07
Videos
08
Quizzes
09
Books
10
Resume