Last Updated: December 6, 2025
29 quizzes
Complete the code to send a GET request to the given URL using the requests library.
response = requests.('https://api.example.com/status')Click an option to fill the blank:
Complete the code so the Flask route responds to requests sent to the root URL.
@app.route('')Click an option to fill the blank:
Complete the code to create a FastAPI instance that will be used to define routes.
app = FastAPIClick an option to fill the blank:
Which protocol is typically used by web browsers to securely communicate with web servers?
In a URL like https://example.com/books?id=10, what is id=10?
Which HTTP method should be used to delete an existing resource in a REST API?
In the requests library, which parameter is commonly used to send JSON data in a POST request?
In Flask, what does the @app.route('/items') decorator do?
Which component of Django is responsible for defining database tables using Python classes?
FastAPI automatically generates interactive API documentation at which default path?
Which statement best describes a REST API?
Which HTTP status code usually indicates that a resource was created successfully?
In the requests library, which attribute gives you the HTTP status code of the response?
Which HTTP method should be used to partially update a resource in a REST API?
Order the steps to handle a JSON GET request with FastAPI that returns a list of items.
Drag and drop to reorder, or use the arrows.
Order the steps to create and test a basic Flask endpoint that returns 'OK' for /health.
Drag and drop to reorder, or use the arrows.
What is the output of this code using the requests library if the server returns status 200?
1import requests
2mock_response = type('R', (), {'status_code': 200})()
3print(mock_response.status_code == 200)What is the output of this FastAPI-related code?
1from fastapi import FastAPI
2app = FastAPI()
3print(isinstance(app, FastAPI))What is printed by this simple Flask configuration check?
1from flask import Flask
2service = Flask(__name__)
3print(service.debug)Consider this REST-style URL builder. What is the output?
1base = 'https://api.example.com'
2resource = 'books'
3identifier = 5
4print(f"{base}/{resource}/{identifier}")What is the output of this HTTP method check?
1methods = ['GET', 'POST', 'DELETE']
2print('PUT' in methods)This Flask code intends to return JSON, but something is wrong. Identify the buggy line.
Click on the line(s) that contain the bug.
from flask import Flaskapp = Flask(__name__) @app.route('/status')def status(): return {'status': 'ok'}, 200, 'application/json'This FastAPI endpoint should accept an item_id from the URL, but it has a bug. Find the incorrect line.
Click on the line(s) that contain the bug.
from fastapi import FastAPIapp = FastAPI() @app.get('/items/{item_id}')async def read_item(): return {'item_id': item_id}Match each HTTP method with its typical REST action.
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Match each Python web framework with its main characteristic.
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Complete the code to send a JSON POST request with the requests library and print the JSON response.
import requestspayload = {'title': 'Web Dev Basics'}reply = requests.post('https://api.example.com/posts', =payload)(reply.json())Click an option to fill blank 1:
Complete the FastAPI code so that the endpoint returns the list of books when /books is requested.
from fastapi import FastAPIapp = FastAPI()books = ['A', 'B']@app.('/books')async def get_books(): booksClick an option to fill blank 1:
Click the line that specifies the path for this Django view in urls.py.
Click on the line to select.
from django.urls import pathfrom . import views urlpatterns = [ path('books/', views.book_list),]Click the line that returns the HTTP response in this simple Flask view.
Click on the line to select.
from flask import Flaskapp = Flask(__name__) @app.route('/')def index(): return 'Hello from Flask!'