15 real App Structure & Lifecycle questions from the FastAPI bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.
1. What is Lifespan handler?
Mid
A.an async context manager passed to the app that runs setup before serving and teardown after the last request
B.the older event hooks for running code when the application boots and when it stops, now superseded by the lifespan approach
C.the central object created from the FastAPI class that holds routes, configuration, and exposes the ASGI callable
D.the companion library that loads configuration from environment variables and dotenv files into a typed settings model
A.Startup and shutdown events — the older event hooks for running code when the application boots and when it stops, now superseded by the lifespan approach
B.Startup and shutdown events — the companion library that loads configuration from environment variables and dotenv files into a typed settings model
C.Startup and shutdown events — an async context manager passed to the app that runs setup before serving and teardown after the last request
D.Startup and shutdown events — the central object created from the FastAPI class that holds routes, configuration, and exposes the ASGI callable
A.FastAPI application instance — the older event hooks for running code when the application boots and when it stops, now superseded by the lifespan approach
B.FastAPI application instance — the application method that mounts a router's endpoints, optionally adding a shared prefix, tags, and dependencies
C.FastAPI application instance — the central object created from the FastAPI class that holds routes, configuration, and exposes the ASGI callable
D.FastAPI application instance — the companion library that loads configuration from environment variables and dotenv files into a typed settings model
Answers, AI explanations, and a scored voice mock interview
Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.