Upwork NODE.JS TEST 2016

Hello Freelancer, Welcome to allupworktestanswers.com Here to get the NODE.JS TEST of Latest version 2016. We are ready here to provide your desire upwork test answer. We already tested all exam test information Available include on here. So Dear, Why Late? Read the below full exam test and get more information from our website.



1. Which Node.js module can be used to get the IP address of the server the program is running on?
Answers:
  1. util
  2. os
  3. dns
  4. net
2. What does the following code do?
var http = require(‘http’);
var fs = require(‘fs’);
var file = fs.createWriteStream(“file.png”);
var request = http.get(“http://path/to/file.png”, function(response) {
response.pipe(file);
});
Answers:
  1. It creates an HTTP GET request and pipes its response into a writeable file stream.
  2. It creates an HTTP GET request, and synchronously pipes its response into a writeable file stream.
  3. It creates an HTTP POST request and pipes its response into a readable file stream.
  4. It creates an HTTP POST request and pipes its response into a writeable file stream.
3. Which of the following methods can be used to write a file in Node.js?
Answers:
  1. fs.write()
  2. fs.writeFile()
  3. fs.createWriteStream()
  4. fs.writeStream()
4. Which of the following methods will print to the console without a trailing new line?
Answers:
  1. process.stdout.print()
  2. console.error()
  3. console.log()
  4. process.stdout.write()
5. Which of the following statements is true about the process object in Node.js?
Answers:
  1. It is a local object.
  2. It is an instance of the events.EventEmitter class.
  3. The process.exit(1) method ends the process with a “success” code.
  4. “process.stderr” and “process.stdout” are non-blocking if they refer to regular files or TTY file descriptors.
6. Which of the following will synchronously check if a file/directory exists?
Answers:
  1. fs.exists()
  2. fs.existsSync()
  3. fs.checkFileSync()
  4. fs.checkDirSync()
7. Which of the following methods can be used to read the contents of a directory?
Answers:
  1. fs.readdir()
  2. fs.readdirSync()
  3. fs.readDirectory()
  4. fs.readdirAsync()
8. Which of the following console commands will update all installed global packages to the latest available versions?
Answers:
  1. npm upgrade -g
  2. npm install -uga
  3. npm update -g
  4. npm version –install-latest
9. Which of the following statements are true about the child_process module in Node.js?
Answers:
  1. It is not possible to stream data through a child process’ stdin, stdout, and stderr in a fully non-blocking way.
  2. Child processes always have two streams associated with them.
  3. “require(‘child_process’).spawn()” can be used to create a child process.
  4. “require(‘child_process’).fork()” can be used to create a child process.
10. Which array contains the command line arguments in Node.js?
Answers:
  1. process.argv
  2. args.argv
  3. arguments.argv
  4. env.argv
11. Which of the following will copy a file in Node.js?
Answers:
  1. var fs = require(‘fs’); fs.createReadStream(‘test.file’).pipe(fs.createWriteStream(‘newFile.file’));
  2. var fs = require(‘fs’); fs.createReadBuffer(‘test.file’).pipe(fs.createWriteBuffer(‘newFile.file’));
  3. var fs = require(‘file’); fs.createFileReader(‘test.file’).pipe(fs.createFileWriter(‘newFile.file’));
  4. var fs = require(‘fs’); fs.createReadBuffer(‘test.file’).stream(fs.createWriteBuffer(‘newFile.file’));
12. Which of the following statements are true about the module.exports object in Node.js?
Answers:
  1. It is the object that gets returned from a require() call.
  2. It can be assigned in a callback.
  3. Assigning an export object to module.exports will rebind the local exports variable.
  4. None of these.
13. Which of the following will open a file, then read its contents one line at a time?
Answers:
  1. fs.readFileStream()
  2. fs.readFile()
  3. fs.createReadStream()
  4. fs.createFileStream()
14. Which of the following NPM commands will install both dependencies and devDependencies of a given project?
Answers:
  1. npm install
  2. npm install –dev
  3. npm install –production
  4. None of these
15. Which of the following statements is true about the console Object in Node.js?
Answers:
  1. “console.log” can take only a single argument.
  2. “console.log” prints to stdout without a newline.
  3. Its functions are synchronous when the destination is a terminal or a file, and and asynchronous when it’s a pipe.
  4. Its functions are asynchronous when the destination is a terminal or a file, and and synchronous when it’s a pipe.
16. What does the following command do?
npm view <package-name> version
Answers:
  1. It shows the version of the package installed globally.
  2. It shows the version of the package installed locally.
  3. It shows the version of the package that is cached.
  4. It shows the latest version of the package that is available.
17. Which of the following can be used to get the currently running script’s path in Node.js?
Answers:
  1. __filename
  2. os.tmpdir()
  3. path.dirname()
  4. path.basename()
18. Which of the following can be used to access the environment variable, “ENV_VARIABLE” in Node.js?
Answers:
  1. process.env.ENV_VARIABLE
  2. process.argv.ENV_VARIABLE
  3. process.env.var.ENV_VARIABLE
  4. process.environment.ENV_VARIABLE
19. What does process.argv[1] contain?
Answers:
  1. node
  2. The file path of the JavaScript file.
  3. The first command line argument.
  4. The second command line argument.
20. Which of the following command-line arguments to “npm install” will allow an NPM package’s binaries to be run outside the project folder?
Answers:
  1. -g
  2. –global
  3. -l
  4. –link
Finally no more words require about the NODE.JS TEST  information in this session of this content. If you are require knowing more, Please ask to us via our contact us form or comment box. Please make sure that, you don’t send Personal information via the Comment box.  Thank you very mutch for being with us.

0 comments: