wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

REST API Design Best Practice Quiz

Total questions: 10

Worksheet time: 2mins

Name
Class
Date
1.

Which HTTP method is used to update partial data from a REST API?

a)

POST

b)

PUT

c)

GET

d)

PATCH

2.

Which HTTP status code indicates success?

a)

404

b)

500

c)

200

d)

403

3.

What should a well-designed RESTful URL be based on?

a)

Actions

b)

Resources

c)

Procedures

d)

Functions

4.

Which of the following is a best practice for API versioning?

a)

Place version in the header

b)

Place version in the URI

c)

Place version in the body

d)

Avoid versioning altogether

5.

What is a common practice for paginating large datasets in a REST API?

a)

Return all data in one response.

b)

Use headers to indicate pagination.

c)

Break the dataset into multiple files.

d)

Use query parameters like ?page=2&size=10.

6.

Why is statelessness a key principle of REST?

a)

It allows the API to remember the client's state.

b)

It enhances scalability by not storing client data between requests.

c)

It enables API versioning.

d)

It reduces the need for caching.

7.

What is the main benefit of including a requestId in the response headers?

a)

To increase the response size.

b)

To help track and trace logs related to a specific request.

c)

To cache the request.

d)

To handle rate limiting.

8.

What is a primary security advantage of using JWT (JSON Web Tokens) in a REST API?

a)

JWTs can be easily revoked if compromised.

b)

JWTs allow API clients to access any endpoint without authentication.

c)

JWTs ensure data integrity and authenticity using cryptographic signatures.

d)

JWTs are valid indefinitely unless manually revoked.

9.

What is a best practice for handling optional fields in REST API responses to ensure backward compatibility?

a)

Always remove unused fields.

b)

Add new optional fields without affecting existing responses.

c)

Rename old fields to indicate they are deprecated.

d)

Return 404 for missing optional fields.

10.

If an API version is updated from 2.1.4 to 2.2.0, which of the following changes most likely occurred?

a)

A backward-incompatible change was introduced.

b)

A critical bug fix was applied to an endpoint.

c)

A major architectural overhaul was implemented, breaking all previous API versions.

d)

A new feature was added in a backward-compatible manner.