Loading

Quipoin Menu

Learn • Practice • Grow

node-js / Working with Directories
mcq
Direction: Choose the correct option

Q1.

Which method creates a new directory?
A. fs.mkdir()
B. fs.makeDir()
C. fs.createDir()
D. fs.newDir()
Direction: Choose the correct option

Q2.

What does `fs.readdir()` return?
A. A boolean
B. An array of file names in a directory
C. A buffer of directory data
D. The contents of a file
Direction: Choose the correct option

Q3.

How do you remove an empty directory?
A. fs.deleteDir()
B. fs.rmdir()
C. fs.remove()
D. fs.unlinkDir()
Direction: Choose the correct option

Q4.

What does the `recursive` option in `fs.mkdir()` do?
A. Lists directories recursively
B. Deletes existing directories
C. Creates nested directories
D. Reads directories recursively
Direction: Choose the correct option

Q5.

Which method checks if a path is a directory or file?
A. fs.isDirectory()
B. fs.stat()
C. fs.exists()
D. fs.check()