Q1. What are the core advantages of FastAPI over Flask or Django REST Framework?
FastAPI is built on Starlette and Pydantic. Key advantages: automatic OpenAPI/Swagger documentation generated from type hints, native async/await support for high-concurrency I/O-bound workloads, Pydantic models for automatic request validation and serialisation, dependency injection system for clean code organisation, and significantly higher throughput compared to Flask in benchmarks. Django REST Framework is batteries-included and better for complex applications needing an ORM and admin interface. FastAPI is better for high-performance microservices and APIs where you want minimal overhead and modern Python typing.