AlgoMaster Logo

Web Development Basics - Quiz

Last Updated: December 6, 2025

Web Development Basics Exercises

29 quizzes

1
Code Completion

Complete the code to send a GET request to the given URL using the requests library.

python
1
response = requests.('https://api.example.com/status')

Click an option to fill the blank:

2
Code Completion

Complete the code so the Flask route responds to requests sent to the root URL.

python
1
@app.route('')

Click an option to fill the blank:

3
Code Completion

Complete the code to create a FastAPI instance that will be used to define routes.

python
1
app = FastAPI

Click an option to fill the blank:

4
Multiple Choice

Which protocol is typically used by web browsers to securely communicate with web servers?

5
Multiple Choice

In a URL like https://example.com/books?id=10, what is id=10?

6
Multiple Choice

Which HTTP method should be used to delete an existing resource in a REST API?

7
Multiple Choice

In the requests library, which parameter is commonly used to send JSON data in a POST request?

8
Multiple Choice

In Flask, what does the @app.route('/items') decorator do?

9
Multiple Choice

Which component of Django is responsible for defining database tables using Python classes?

10
Multiple Choice

FastAPI automatically generates interactive API documentation at which default path?

11
Multiple Choice

Which statement best describes a REST API?

12
Multiple Choice

Which HTTP status code usually indicates that a resource was created successfully?

13
Multiple Choice

In the requests library, which attribute gives you the HTTP status code of the response?

14
Multiple Choice

Which HTTP method should be used to partially update a resource in a REST API?

15
Sequencing

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.

16
Sequencing

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.

17
Output Prediction

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)
18
Output Prediction

What is the output of this FastAPI-related code?

1from fastapi import FastAPI
2app = FastAPI()
3print(isinstance(app, FastAPI))
19
Output Prediction

What is printed by this simple Flask configuration check?

1from flask import Flask
2service = Flask(__name__)
3print(service.debug)
20
Output Prediction

Consider this REST-style URL builder. What is the output?

1base = 'https://api.example.com'
2resource = 'books'
3identifier = 5
4print(f"{base}/{resource}/{identifier}")
21
Output Prediction

What is the output of this HTTP method check?

1methods = ['GET', 'POST', 'DELETE']
2print('PUT' in methods)
22
Bug Spotting

This Flask code intends to return JSON, but something is wrong. Identify the buggy line.

Click on the line(s) that contain the bug.

python
1
from flask import Flask
2
app = Flask(__name__)
3
 
4
@app.route('/status')
5
def status():
6
    return {'status': 'ok'}, 200, 'application/json'
23
Bug Spotting

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.

python
1
from fastapi import FastAPI
2
app = FastAPI()
3
 
4
@app.get('/items/{item_id}')
5
async def read_item():
6
    return {'item_id': item_id}
24
Matching

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.

25
Matching

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.

26
Fill in the Blanks

Complete the code to send a JSON POST request with the requests library and print the JSON response.

python
1
import requests
2
payload = {'title': 'Web Dev Basics'}
3
reply = requests.post('https://api.example.com/posts', =payload)
4
(reply.json())

Click an option to fill blank 1:

27
Fill in the Blanks

Complete the FastAPI code so that the endpoint returns the list of books when /books is requested.

python
1
from fastapi import FastAPI
2
app = FastAPI()
3
4
books = ['A', 'B']
5
6
@app.('/books')
7
async def get_books():
8
books

Click an option to fill blank 1:

28
Hotspot Selection

Click the line that specifies the path for this Django view in urls.py.

Click on the line to select.

python
1
from django.urls import path
2
from . import views
3
 
4
urlpatterns = [
5
    path('books/', views.book_list),
6
]
29
Hotspot Selection

Click the line that returns the HTTP response in this simple Flask view.

Click on the line to select.

python
1
from flask import Flask
2
app = Flask(__name__)
3
 
4
@app.route('/')
5
def index():
6
    return 'Hello from Flask!'

Premium Content

Subscribe to unlock full access to this content and more premium articles.