Search Header Logo

Server and APIs

Authored by Daniel Adesoji

Professional Development

Professional Development

Used 21+ times

Server and APIs
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When we use http.createServer(callback). The callback function takes in two objects, what are these?

request, response

handler,response

response,handler

request,process

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

We want the content type of the response to be 'text/html'. Which of the following is the correct way to do it?

res.setHeader('content-type', 'text/html')
res.setHeader('content-type', 'application/json')
res.writeHeader('content-type', 'text/html')
res.writeHead('content-type', 'text/html')

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To set the status code of response, what would be the correct syntax?

res.writeHeader(200)
res.writeHead(200)
res.writeStatus(200)
res.writeCode(200)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When we query for data from an api, what code do we return when that data is not found

400

422

404

419

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When we build an API server, what content type do we set?

text/html

application/json

application/api

application/html

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To read the url from the request, what property of req do we use?

url

path

link

none of the options

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A request is creating a resource in your API server, the method is "req.method === ?"

PUT

PATCH

GET

POST

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?