Loading

Quipoin Menu

Learn • Practice • Grow

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

Q1.

Which method is used to watch for changes to a file or directory?
A. fs.watch()
B. fs.observe()
C. fs.monitor()
D. fs.onChange()
Direction: Choose the correct option

Q2.

What events can `fs.watch()` emit?
A. 'change'
B. 'error'
C. All of the above
D. 'rename'
Direction: Choose the correct option

Q3.

What is an alternative to `fs.watch()` that is more efficient?
A. setInterval
B. fs.watchFile()
C. fs.createReadStream()
D. fs.readFile()
Direction: Choose the correct option

Q4.

What does the `listener` function in `fs.watch()` receive?
A. Only the event type
B. The file stats
C. The event type and filename
D. The filename only
Direction: Choose the correct option

Q5.

Why might `fs.watch()` not be recommended for production?
A. It has platform inconsistencies and limitations
B. It uses too much memory
C. It is synchronous
D. It cannot watch directories