Loading

Quipoin Menu

Learn • Practice • Grow

node-js / Serving Static Files
mcq
Direction: Choose the correct option

Q1.

What does serving static files mean?
A. Serving files like HTML, CSS, images as-is
B. Serving dynamic content
C. Serving only HTML
D. Serving files from memory
Direction: Choose the correct option

Q2.

In raw Node.js, how would you serve a CSS file?
A. It's not possible
B. Use a special module
C. Read the file and set `Content-Type` to `text/css`
D. Just send the file content
Direction: Choose the correct option

Q3.

What is a potential security risk when serving static files?
A. Directory traversal attacks
B. File not found
C. Large files
D. Slow loading
Direction: Choose the correct option

Q4.

What MIME type should be used for JavaScript files?
A. text/javascript
B. application/javascript
C. Both A and B
D. application/js
Direction: Choose the correct option

Q5.

How can you implement a simple static file server?
A. All of the above
B. Handle errors
C. Use `fs.readFile`
D. Parse `req.url` and serve file from a base directory