App Structure & Lifecycle interview questions

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
  1. A.an async context manager passed to the app that runs setup before serving and teardown after the last request
  2. B.the older event hooks for running code when the application boots and when it stops, now superseded by the lifespan approach
  3. C.the central object created from the FastAPI class that holds routes, configuration, and exposes the ASGI callable
  4. D.the companion library that loads configuration from environment variables and dotenv files into a typed settings model
Reveal the answer + AI explanation — free account

2. Which term means: "an async context manager passed to the app that runs setup before serving and teardown after the last request"?

Mid
  1. A.Startup and shutdown events
  2. B.pydantic-settings
  3. C.FastAPI application instance
  4. D.Lifespan handler
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Mid
  1. A.Lifespan handler — an async context manager passed to the app that runs setup before serving and teardown after the last request
  2. B.Lifespan handler — the application method that mounts a router's endpoints, optionally adding a shared prefix, tags, and dependencies
  3. C.Lifespan handler — the older event hooks for running code when the application boots and when it stops, now superseded by the lifespan approach
  4. D.Lifespan handler — the companion library that loads configuration from environment variables and dotenv files into a typed settings model
Reveal the answer + AI explanation — free account

4. What is Startup and shutdown events?

Mid
  1. A.an async context manager passed to the app that runs setup before serving and teardown after the last request
  2. B.the older event hooks for running code when the application boots and when it stops, now superseded by the lifespan approach
  3. C.the companion library that loads configuration from environment variables and dotenv files into a typed settings model
  4. D.the central object created from the FastAPI class that holds routes, configuration, and exposes the ASGI callable
Reveal the answer + AI explanation — free account

5. Which term means: "the older event hooks for running code when the application boots and when it stops, now superseded by the lifespan approach"?

Mid
  1. A.FastAPI application instance
  2. B.Lifespan handler
  3. C.include_router
  4. D.Startup and shutdown events
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Mid
  1. 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
  2. B.Startup and shutdown events — the companion library that loads configuration from environment variables and dotenv files into a typed settings model
  3. C.Startup and shutdown events — an async context manager passed to the app that runs setup before serving and teardown after the last request
  4. D.Startup and shutdown events — the central object created from the FastAPI class that holds routes, configuration, and exposes the ASGI callable
Reveal the answer + AI explanation — free account

7. What is pydantic-settings?

Mid
  1. A.an async context manager passed to the app that runs setup before serving and teardown after the last request
  2. B.the companion library that loads configuration from environment variables and dotenv files into a typed settings model
  3. C.the application method that mounts a router's endpoints, optionally adding a shared prefix, tags, and dependencies
  4. D.the older event hooks for running code when the application boots and when it stops, now superseded by the lifespan approach
Reveal the answer + AI explanation — free account

8. Which term means: "the companion library that loads configuration from environment variables and dotenv files into a typed settings model"?

Mid
  1. A.Startup and shutdown events
  2. B.include_router
  3. C.Lifespan handler
  4. D.pydantic-settings
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Mid
  1. A.pydantic-settings — an async context manager passed to the app that runs setup before serving and teardown after the last request
  2. B.pydantic-settings — the application method that mounts a router's endpoints, optionally adding a shared prefix, tags, and dependencies
  3. C.pydantic-settings — the companion library that loads configuration from environment variables and dotenv files into a typed settings model
  4. D.pydantic-settings — the older event hooks for running code when the application boots and when it stops, now superseded by the lifespan approach
Reveal the answer + AI explanation — free account

10. What is include_router?

Mid
  1. A.the application method that mounts a router's endpoints, optionally adding a shared prefix, tags, and dependencies
  2. B.an async context manager passed to the app that runs setup before serving and teardown after the last request
  3. C.the older event hooks for running code when the application boots and when it stops, now superseded by the lifespan approach
  4. D.the companion library that loads configuration from environment variables and dotenv files into a typed settings model
Reveal the answer + AI explanation — free account

11. Which term means: "the application method that mounts a router's endpoints, optionally adding a shared prefix, tags, and dependencies"?

Mid
  1. A.Startup and shutdown events
  2. B.pydantic-settings
  3. C.FastAPI application instance
  4. D.include_router
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Mid
  1. A.include_router — the older event hooks for running code when the application boots and when it stops, now superseded by the lifespan approach
  2. B.include_router — the companion library that loads configuration from environment variables and dotenv files into a typed settings model
  3. C.include_router — an async context manager passed to the app that runs setup before serving and teardown after the last request
  4. D.include_router — the application method that mounts a router's endpoints, optionally adding a shared prefix, tags, and dependencies
Reveal the answer + AI explanation — free account

13. What is FastAPI application instance?

Junior
  1. A.the application method that mounts a router's endpoints, optionally adding a shared prefix, tags, and dependencies
  2. B.the central object created from the FastAPI class that holds routes, configuration, and exposes the ASGI callable
  3. C.the companion library that loads configuration from environment variables and dotenv files into a typed settings model
  4. D.the older event hooks for running code when the application boots and when it stops, now superseded by the lifespan approach
Reveal the answer + AI explanation — free account

14. Which term means: "the central object created from the FastAPI class that holds routes, configuration, and exposes the ASGI callable"?

Junior
  1. A.include_router
  2. B.pydantic-settings
  3. C.Startup and shutdown events
  4. D.FastAPI application instance
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Junior
  1. 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
  2. B.FastAPI application instance — the application method that mounts a router's endpoints, optionally adding a shared prefix, tags, and dependencies
  3. C.FastAPI application instance — the central object created from the FastAPI class that holds routes, configuration, and exposes the ASGI callable
  4. D.FastAPI application instance — the companion library that loads configuration from environment variables and dotenv files into a typed settings model
Reveal the answer + AI explanation — free account

Free to start

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.

Practice App Structure & Lifecycle free