Interview Question

What is asynchronous programming?

Async code cooperatively suspends during waits so other tasks can run.

💡 Concept ✅ Quick Revision 🐍 Python

Answer

Asynchronous programming lets tasks cooperate by suspending while waiting for operations. • An event loop schedules ready callbacks and tasks. • It is especially useful for high-concurrency I/O. • Blocking code must be avoided or moved away from the event-loop thread.

💡 Simple Example

import asyncio async def main(): await asyncio.sleep(0) print('done') asyncio.run(main())

Output

done

⚡ Quick Revision

Async code cooperatively suspends during waits so other tasks can run.