Back to Python Backend, APIs & Databases
Final Assessment

Python Backend, APIs & Databases Final Assessment

Test your backend engineering skills across REST API design, httpx retries & pagination, parameterized SQLite queries, transactions, FastAPI routes & Pydantic schemas, password hashing, Bearer/JWT auth, TestClient dependency overrides, BackgroundTasks, and Alembic/Docker. Score 70% or higher to earn your certificate.

Answered 0 of 15 questionsPass mark: 70%
Question 1

Question 1 of 15

Which HTTP status code is most appropriate when a POST /tasks endpoint creates a new task successfully?

Question 2

Question 2 of 15

Why should httpx or requests API calls always specify an explicit timeout=?

Question 3

Question 3 of 15

What happens if you pass ('maya@example.com') without a trailing comma to conn.execute('SELECT * FROM users WHERE email = ?', ('maya@example.com'))?

Question 4

Question 4 of 15

How does with conn: behave in Python's sqlite3 when an exception is raised inside the block?

Question 5

Question 5 of 15

In FastAPI, if you declare @app.get('/courses/{course_id}') def read(course_id: int, level: str | None = None):, how is level supplied?

Question 6

Question 6 of 15

What HTTP status code does FastAPI return automatically when incoming JSON violates a Pydantic BaseModel constraint?

Question 7

Question 7 of 15

Why should you use payload.model_dump(exclude_unset=True) inside a PATCH endpoint?

Question 8

Question 8 of 15

In def get_db(): try: yield conn finally: conn.close(), when does conn.close() run during a FastAPI request?

Question 9

Question 9 of 15

Why is allow_origins=['*'] with allow_credentials=True unsafe and rejected by browsers?

Question 10

Question 10 of 15

Why must user passwords be hashed with a per-user random salt and slow KDF (pbkdf2_hmac / bcrypt / argon2) instead of hashlib.sha256(password)?

Question 11

Question 11 of 15

What is the key difference between 401 Unauthorized and 403 Forbidden?

Question 12

Question 12 of 15

How do you inject an isolated test database into FastAPI routes when testing with TestClient?

Question 13

Question 13 of 15

What happens if you call blocking time.sleep(2) or synchronous requests.get() inside a FastAPI async def route?

Question 14

Question 14 of 15

Why are versioned migration tools like Alembic needed instead of relying solely on CREATE TABLE IF NOT EXISTS?

Question 15

Question 15 of 15

Why should a FastAPI Dockerfile bind --host 0.0.0.0 in its CMD?

Answer 15 more questions to submit.