Loading

Quipoin Menu

Learn • Practice • Grow

Direction: Choose the correct option

Q1.

Which method writes data to a file, replacing the file if it exists?
A. fs.write()
B. fs.writeFile()
C. fs.appendFile()
D. fs.createWriteStream()
Direction: Choose the correct option

Q2.

How do you append data to an existing file?
A. fs.writeFile() with flag 'a'
B. fs.createWriteStream() with flag 'a'
C. All of the above
D. fs.appendFile()
Direction: Choose the correct option

Q3.

What flag should be used with `fs.open()` to open a file for writing (creating if it doesn't exist)?
A. 'w'
B. 'wx'
C. 'r'
D. 'a'
Direction: Choose the correct option

Q4.

In `fs.writeFile`, what happens if the parent directory doesn't exist?
A. The file is created
B. The operation is ignored
C. An error occurs
D. The directory is created automatically
Direction: Choose the correct option

Q5.

What is the purpose of `fs.createWriteStream()`?
A. To write large amounts of data efficiently
B. To write synchronously
C. To write a single string
D. To append data only