Node.js Authentication & JWT Quiz – 20 Questions with Answers
20 questions · 15 min · Medium
Test your knowledge of the HTTP and HTTPS modules in Node.js, including creating servers, handling requests and responses, HTTP methods, status codes, headers, HTTPS, and TLS certificates.
No sign-up needed · Last updated:
Score: 0 00:00
Create a free account to keep your scores and track your progress. It is optional.
20 questions · 15 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
A. http
The built-in http module provides APIs for creating HTTP servers and handling HTTP requests and responses.
A. const http = require('http');
The CommonJS syntax require('http') loads Node.js's built-in HTTP module.
A. http.createServer()
The http.createServer() method creates and returns an HTTP server.
B. http.request()
The http.request() method initiates an HTTP request and provides control over request options and the response.
A. http.get()
http.get() is a convenience method for making HTTP GET requests and automatically calls request.end().
B. req.method
The req.method property contains the HTTP method, such as GET, POST, PUT, or DELETE.
C. req.url
The req.url property contains the request URL string, including the path and query string.
B. res.writeHead()
The res.writeHead() method writes the status code and response headers to the response.
A. res.write()
res.write() writes a chunk of response body data. The response can later be completed with res.end().
C. res.end()
res.end() signals that the response is complete and can optionally send a final piece of data.
C. https
The built-in https module provides HTTPS functionality built on top of TLS/SSL and the HTTP module.
A. https.createServer()
The https.createServer() method creates an HTTPS server and accepts TLS options such as a certificate and private key.
B. It encrypts data exchanged between the client and server
HTTPS uses TLS to provide encrypted communication and helps protect data from interception and tampering.
A. Private key and certificate
An HTTPS server typically requires TLS credentials such as a private key and a certificate.
B. HTTPS provides HTTP functionality over TLS
Node.js's HTTPS module extends HTTP functionality by providing HTTP communication secured with TLS.