Loading

Quipoin Menu

Learn • Practice • Grow

node-js / Renaming & Deleting Files
mcq
Direction: Choose the correct option

Q1.

Which method is used to rename a file or directory?
A. fs.rename()
B. fs.changeName()
C. fs.renameFile()
D. fs.move()
Direction: Choose the correct option

Q2.

How do you delete a file in Node.js?
A. fs.remove()
B. fs.rm()
C. fs.delete()
D. fs.unlink()
Direction: Choose the correct option

Q3.

What happens if you try to rename a file to an existing name?
A. Both A and B depend on the platform
B. An error occurs
C. The existing file is overwritten
D. The rename is ignored
Direction: Choose the correct option

Q4.

Which method is used to delete a non-empty directory recursively?
A. fs.rm() with recursive option
B. fs.unlink()
C. fs.rmdir() with recursive option
D. Both A and C
Direction: Choose the correct option

Q5.

What does `fs.rename()` return to its callback?
A. An error object or null
B. The file stats
C. A success message
D. The new file name