Nodejs Mock Test III

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

NODE.

JS MOCK TEST
http://www.tutorialspoint.com Copyright © tutorialspoint.com

This section presents you various set of Mock Tests related to Node.js Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

NODE.JS MOCK TEST III

Q 1 - Is console a global object?

A - true

B - false

Q 2 - Which of the following is true about console global object?

A - There are built-in methods to be used for printing informational, warning and error messages
in console.

B - console is used in synchronous way when destination is file or a terminal.

C - console is used in asynchronous way when destination is a pipe.

D - All of the above.

Q 3 - Is process a global object?

A - true

B - false

Q 4 - Which of the following is true about process global object?

A - The process object is an instance of EventEmitter.

B - process emits exit event when process is about to exit.

C - process emits uncaughtException when when an exception bubbles all the way back to the
event loop.

D - All of the above.


Q 5 - Which of the following code prints current directory?

A - console.log ′ Currentdirectory: ′ + process. cwd();

B - console.log ′ Currentdirectory: ′ + console. cwd();

C - console.log ′ Currentdirectory: ′ + process. currenWorkingDirectory();

D - None of the above.

Q 6 - Which of the following code prints process version?

A - console.log ′ Currentversion: ′ + process. version();

B - console.log ′ Currentversion: ′ + process. version;

C - console.log ′ Currentversion: ′ + process. getVersion();

D - None of the above.

Q 7 - Which of the following code prints memory usage?

A - console.logprocess. memoryUsage();

B - console.log ′ Currentversion: ′ + process. memory();

C - console.log ′ Currentversion: ′ + process. getMemory();

D - None of the above.

Q 8 - Which of the following module is required for operating system specific


operations?

A - os module

B - fs module

C - net module

D - None of the above.

Q 9 - Which of the following code print the endianness of operating system?

A - console.log ′ endianness: ′ + os. endianness;

B - console.log ′ endianness: ′ + os. endianness();

C - console.log ′ endianness: ′ + os. getEndianness();

D - None of the above.

Q 10 - Which of the following code print the name of operating system?

A - console.log ′ type: ′ + os. type;

B - console.log ′ type: ′ + os. type();


C - console.log ′ type: ′ + os. getType();

D - None of the above.

Q 11 - Which of the following code print the platform of operating system?

A - console.log ′ platform: ′ + os. platform;

B - console.log ′ platform: ′ + os. platform();

C - console.log ′ platform: ′ + os. getPlatform();

D - None of the above.

Q 12 - Which of the following code print the total system memory of operating
system?

D - None of the above.

Q 13 - Which of the following code print the total free memory of operating system?

D - None of the above.

Q 14 - Which of the following module is required for path specific operations?

A - os module

B - fs module

C - path module

D - None of the above.

Q 15 - Which of the following is the correct way to get a normalized path?

A - path.normalize ′ /test/test1/ /2slashes/1slash/tab/. . ′

B - fs.normalize ′ /test/test1/ /2slashes/1slash/tab/. . ′

C - os.normalize ′ /test/test1/ /2slashes/1slash/tab/. . ′

D - None of the above.

Q 16 - Which of the following is the correct way to get a joint path?

A - path.join ′ /test ′ , ′ test1 ′ , ′ 2slashes/1slash ′ , ′ tab ′ , ′ . . ′

B - path.combine ′ /test ′ , ′ test1 ′ , ′ 2slashes/1slash ′ , ′ tab ′ , ′ . . ′

C - buffer.join ′ /test ′ , ′ test1 ′ , ′ 2slashes/1slash ′ , ′ tab ′ , ′ . . ′

D - None of the above.


Q 17 - Which of the following is the correct way to get an absolute path?

A - os.resolve ′ main. js ′

B - path.resolve ′ main. js ′

C - fs.resolve ′ main. js ′

D - None of the above.

Q 18 - Which of the following is the correct way to get an extension of a file?

A - fs.extname ′ main. js ′

B - path.extname ′ main. js ′

C - os.extname ′ main. js ′

D - None of the above.

Q 19 - Which of the following module is required for network specific operations?

A - os module

B - fs module

C - net module

D - None of the above.

Q 20 - Which of the following API creates a server?

A - net.createServer[options][, connectionListener]

B - net.connectoptions[, connectionListener]

C - net.createConnectionport[, host][, connectListener]

D - None of the above.

Q 21 - Which of the following API creates a client?

A - net.createServer[options][, connectionListener]

B - net.connectoptions[, connectionListener]

C - net.createConnectionport[, host][, connectListener]

D - None of the above.

Q 22 - net.isIPinput tests if input is an IP address or not.

A - true

B - false
Q 23 - net.isIPinput returns 0 for invalid input.

A - true

B - false

Q 24 - net.isIPinput returns 4 for IP version 4 addresses.

A - true

B - false

Q 25 - net.isIPinput returns 6 for IP version 6 addresses.

A - true

B - false

ANSWER SHEET

Question Number Answer Key

1 A

2 D

3 A

4 D

5 A

6 B

7 A

8 A

9 B

10 B

11 B

12 A

13 A

14 C

15 A

16 A

17 B

18 B

19 C

20 A
21 A

22 A

23 A

24 A

25 A

Processing math: 100%

You might also like