Node.js Quiz | Set-3
Question 1 |
Which below module is used to get end-of-line character as specified by the operating system ?
os.EOL | |
os.endianness() | |
os.cpus() | |
os.arch() |
Discuss it
Question 1 Explanation:
The os.EOL comes with an os module which is used to get an end-of-line character or marker as specified by the operating system. It returns the end of the line marker.
Question 2 |
Which method in Node.js are used to get system uptime in seconds ?
os.freemem() | |
os.uptime() | |
os.getPriority() | |
os.homedir() |
Discuss it
Question 2 Explanation:
The os.uptime() is the method in Node.js that is used to get system uptime in seconds. This method does not accept any parameters.
Question 3 |
How do we get the filename portion of a path to the file in Node.js ?
path.extname() | |
path.basename() | |
path.dirname() | |
path.delimiter |
Discuss it
Question 3 Explanation:
The path.basename() method in node.js is used to get the filename portion of a path to the file. This directory was ignored when using this method. It takes a two-parameter as path and extension.
Question 4 |
Which below in Node.js are used to join a number of path segments ?
path.argv() | |
path.join() | |
path.chdir() | |
path.argv() |
Discuss it
Question 4 Explanation:
The path.join() is used to join a number of path segments using the platform-specific delimiter to form a single path. The final path joining takes place. It takes comma-separated values.
Question 5 |
Which below method is responsible for parsing and formatting URL query strings ?
Query | |
String decoder | |
steam | |
VM |
Discuss it
Question 5 Explanation:
The Query String is used as utilities for parsing and formatting URL query strings.
Question 6 |
Which data-handling method and is used to read or write input into output sequentially ?
Utility | |
Timer | |
Decoder | |
Stream |
Discuss it
Question 6 Explanation:
Streams are the data-handling method and it is used to read or write input into output as sequence manner. The main advantage of Streams is used to handle reading or writing the files.
Question 7 |
Which method is used to return all the remaining input stored in the internal buffer as a string ?
stringDecoder.start() | |
stringDecoder.end() | |
stringEncoder.start() | |
stringEncoder.end() |
Discuss it
Question 7 Explanation:
The stringDecoder.end() is a method that is used to return the input stored into the buffer as string format.
Question 8 |
Which method finds the maximum number of sockets that will be left open in the free state ?
agent.minFreeSockets | |
agent.maxFreeSockets | |
agent.maxSockets | |
agent.minSockets |
Discuss it
Question 8 Explanation:
The agent.maxFreeSockets is used to sets the maximum number of sockets that will be open in the free state. This node does not accept any parameters.
Question 9 |
Which property is used to yields an object listing Zlib-related constants ?
zlib.constants() | |
zlib.createBrotliDecompress() | |
zlib.createUnzip() | |
zlib.createBrotliCompress() |
Discuss it
Question 9 Explanation:
The zlib.constants property is used to yields an object listing Zlib-related constants. It returns all the Zlib-related constants.
Question 10 |
Which v8 method is used to serialize any type of data into a buffer using default serializer ?
v8.Serializer.writeValue() | |
v8.Serializer.writeHeader() | |
v8.serialize() | |
v8.deserialize() |
Discuss it
Question 10 Explanation:
The v8.serialize() is a method in node.js that is used to serialize any type of data into the default serializer. It takes the parameter as a value.
There are 15 questions to complete.