1. Which framework includes an admin site and ORM by default?
- Neither
- FastAPI
- Django
- Both equally
जवाब देखें
जवाब: Django
Batteries included.
Django / FastAPI कोर्स के 26 सवाल, हर सवाल के सही जवाब और explanation के साथ। जवाब देखने से पहले ख़ुद सोचें।
जवाब: Django
Batteries included.
जवाब: Add it to INSTALLED_APPS
Apps are registered in settings.
जवाब: 422 Unprocessable Entity
Validation errors are 422 by default.
पाठ: A First FastAPI App
जवाब: Removes them from the response
Output filtering prevents leaks.
जवाब: By raising HTTPException with status 401
Dependencies can short-circuit requests.
जवाब: It blocks the event loop and stalls other requests
Use await asyncio.sleep or async libraries.
पाठ: Async Endpoints
जवाब: /docs
Swagger UI at /docs, spec at /openapi.json.
जवाब: 409 Conflict
The request conflicts with current state.
पाठ: Error Handling
जवाब: Set app.dependency_overrides[get_db] to a fake
Dependencies make testing easy.
जवाब: Alembic
Migrations are separate from FastAPI.
जवाब: DecimalField
Exact decimal arithmetic.
पाठ: Defining Models
जवाब: Writes migration files describing model changes
migrate applies; makemigrations writes.
पाठ: Creating Migrations
जवाब: Prints the SQL for a migration without running it
Inspect before applying.
जवाब: It records them in the django_migrations table
Applied migrations are tracked.
पाठ: Applying Migrations
जवाब: When it is evaluated, for example iterated, listed, counted or fetched with get
QuerySets are lazy.
जवाब: select_related
Join single-valued relations.
पाठ: Avoiding N+1 Queries
जवाब: Doubles each row's price in a single SQL statement
Computation happens in the database.
जवाब: Raises Http404, producing a 404 response
Clean not-found handling.
पाठ: Views and URLs
जवाब: In a clean_<fieldname> method
Field-level clean methods.
पाठ: Forms and Validation
जवाब: They are rolled back too
All or nothing.
जवाब: Rolls back the database changes
Isolated tests.
पाठ: Testing Django Apps
जवाब: Each hash uses a random salt
Salts defeat precomputed attacks.
पाठ: Password Hashing
जवाब: DEBUG
Debug pages leak sensitive information.
जवाब: An ASGI server such as uvicorn
FastAPI is ASGI.
जवाब: Inefficient database access
Measure the database first.
जवाब: No blocking calls inside async def endpoints
Correct, efficient, secure.