wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Hackharbor 3.0 : Day 5 API and JSON Quiz

Total questions: 27

Worksheet time: 14mins

Name
Class
Date
1.

What is the role of an API in software communication?

a)

It compiles frontend code

b)

It directly connects databases

c)

It acts as a messenger between software components

d)

It generates UI elements

2.

Which real-world analogy best represents an API?

a)

Chef cooking food

b)

Menu in a restaurant

c)

Waiter taking your order

d)

Receipt after payment

3.

Which of the following is NOT a benefit of APIs?

a)

Promotes modularity

b)

Improves reusability

c)

Increases memory usage

d)

Adds a security layer

4.

You exposed your API key on GitHub. What happens next?

a)

Congratulations! Free server hosting.

b)

The API retires

c)

Hackers thank you

d)

Nothing, everything is secure (just kidding)

5.

What does the URL https://api.openweathermap.org/data/2.5/weather?q=Delhi&appid=API_KEY represent?

a)

An email request

b)

A database insertion

c)

A weather API GET request

d)

A file download from a server

6.

Which one is NOT a valid status code?

a)

204 No Content

b)

301 Moved Permanently

c)

777 Lucky Response

d)

403 Forbidden

7.

Which HTTP method is used to retrieve data from a resource?

a)

PUT

b)

POST

c)

GET

d)

DELETE

8.

What does the POST method typically do?

a)

Read data from server

b)

Create new resource

c)

Delete existing resource

d)

Authenticate the user

9.

What’s the expected output of a GET /posts/1 call to JSONPlaceholder?

a)

A JSON object with post details

b)

A string response

c)

A login prompt

d)

A file download

10.

What does HTTP status code 201 mean?

a)

Resource not found

b)

Resource successfully created

c)

Internal server error

d)

Authentication failed

11.

What’s the scariest word in web development?

a)

Callback

b)

Merge Conflict

c)

CORS

d)

API Downtime

12.

Which of these HTTP status codes indicate a client-side error?

a)

200

b)

500

c)

404

d)

301

13.

Why would you use Postman instead of writing raw fetch code?

a)

It can host websites

b)

It allows visual testing of APIs

c)

It compiles JS code

d)

It encrypts data in real-time

14.

What tab in Postman do you use to input a JSON request body?

a)

Headers

b)

Params

c)

Body

d)

Console

15.

What’s an API’s favorite position?

a)

On the frontend

b)

In the kitchen

c)

In the middle, taking orders

d)

Hiding in the backend

16.

Which of these headers must be included in a JSON POST request?

a)

Accept-Encoding

b)

Content-Type: application/json

c)

Authorization: admin

d)

Cookie: true

17.

In JSON, all string values and keys must be:

a)

Single quoted

b)

Escaped with slashes

c)

In double quotes

d)

Left unquoted

18.

Which of these is a valid JSON?

a)

{ name: 'Alice' }

b)

{ "name": "Alice" }

c)

{ name = "Alice" }

d)

["name": "Alice"]

19.

What happens if you send malformed JSON in a POST request?

a)

It silently fails

b)

Server throws a 200 OK

c)

Server returns a 400 Bad Request

d)

It still saves data

20.

Why don’t APIs use Tinder?

a)

They prefer RESTful relationships

b)

They’re always busy

c)

They already found their endpoints

d)

They only GET, never POST

21.

Which JavaScript method converts an object into JSON?

a)

parse()

b)

stringify()

c)

convert()

d)

serialize()

22.

What is the primary difference between res.send() and res.json() in Express?

a)

One sends images, the other doesn't

b)

send() can send anything; json() ensures valid JSON

c)

send() is deprecated

d)

json() only works on frontend

23.

What does req.query contain in Express?

a)

POST body

b)

JSON payload

c)

URL query parameters

d)

Auth headers

24.

What error would you get if a frontend hits an API with no CORS enabled?

a)

404 Not Found

b)

CORS Policy Error

c)

JSON Parsing Error

d)

Bad Gateway

25.

Why did the API go to therapy?

a)

It had unresolved parameters

b)

It kept getting rate-limited

c)

It was always POSTing too much

d)

It had trust issues with headers

26.

What should you use to hide your API keys in real projects?

a)

Postman

b)

.env files

c)

HTML comments

d)

JSON config in frontend

27.

Why did JSON get dumped?

a)

Too many nested issues

b)

Too verbose

c)

Didn’t quote things properly

d)

It wasn’t REST-ful enough