Node Js - Skill Assignment Quiz

Q1. When a javaScript function is invoked (called) in Node, where is a new frame placed?

  • the call stack
  • the event loop
  • the poll phase
  • the events queue

Q2. Which of the following is a core module in Node?

  • webpack
  • crypto
  • request
  • chalk

Q3. Which of the following Buffer class methods returns an uninitialized buffer?

  • allocUnsafe
  • concat
  • from
  • alloc

Q4. Which of the following modules is NOT a built-in module in Node?

  • ftp
  • events
  • dgram
  • http2

Q5. Which fs module method can be used to read the content of a file without buffering it in memory?

  • read
  • readFile
  • createReadStream
  • readFileSync

Q6. Which of the following DNS module methods uses the underlying OS facilities and does not necessarily perform any network communication?

  • lookup
  • resolve
  • resolve4
  • reverse

Q7. How do you check that a value is a date object in Node?

  • util.types.isDate(value)
  • assert.isDate(value)
  • console.isDate(value)
  • util.date(value)

Q8. Can you create an https web server with Node.js?

  • no, there are no modules supporting it yet
  • yes, with the https or http2 modules
  • yes, through the path module
  • yes, with the http module

Q9. What is the Api that is designed to insulate Addons from changes in the underlying JavaScript engine?

  • A-API
  • Z-API
  • N-API
  • X-API

Q10. Which CLI option can you use to debug a node script in Chrome DevTools?

  • --dev-tools
  • --inspect
  • --chrome
  • --debug

Q11. Which of the following is a method on the console object?

  • exit
  • test
  • time
  • print

Q12. How can you use the promise API with a callback-based function such as child_process.exec?

  • new Promise(child_process.exec())
  • util.promisify(child_process.exec())
  • util.promisify(child_process.exec)
  • new Promise(child_process.exec)

Q13. If EventEmitter is in scope, which of the following lines of code will have an event emitter emitting a change event?

  • EventEmitter.emit('change');
  • EventEmitter.new().emit('change');
  • (new EventEmitter()).emit('change');
  • new EventEmitter('change');

Q14. Which module variable holds the resolved absolute path of the current module file?

  • __pathname
  • __location
  • __flder
  • __filename

Q15. When you run JavaScript in a Node.js application, which of the following elements in a Node.js stack actually executes that JavaScript?

  • the libuv library
  • the c-ares library
  • the VM (like VS or Chakra)
  • the repl module

Q16. What is the purpose of the path module?

  • to provide utilities to play with file and directory paths
  • to provide utilities to add and remove files
  • It is a retiring module.
  • to provide utilities to test files

Q17. How do you start a Node application, if the entry file is indexjs?

  • nodemon start
  • start index.js
  • node index.js
  • node start

Q18. What is the Node LTS version?

  • It is the current unstable version and is to be avoided.
  • It is the version that will be retired soon.
  • It is the version with the latest features.
  • It is the safest version for long-term support.

Q19. Which choice is not a valid method on event emitters?

  • start
  • on
  • once
  • off

Q20. Which library provides Node.js with the event loop?

  • node index.js -x
  • node -v
  • node -h
  • node index.js -h

Q21. What can you export with module.exports?

  • only objects.
  • only functions
  • only variables and arrays
  • functions, objects, arrays, or anything you assign to the module

Q22. According to the rules of semantic versioning, what does a release incrementing the third number in an npm version string communicate to users about the release changes?

  • Changes are not backwards compatible.
  • Changes might not be backward compatible and might break existing code.
  • Changes are just bug fixes and no new features were added.
  • Changes will add new functionality but will not break any existing code.

Q23. What does REPL stand for?

  • run, examine, put, loop
  • read, eval, print, loop
  • run, edit, print, loop
  • read, extend, print, loop

Q24. Which core module in Node provides an API to register callbacks to track asynchronous resources created inside a Node.js application?

  • cluster
  • async_hooks
  • dgram
  • inspector

Q25. Which Node.js module should you use when you need to decode raw data into strings?

  • buffer
  • util
  • string_decoder
  • string_buffer

Q26. Which statement about event emitters is false?

  • Event names must be camelCase strings.
  • The emit method allows a arbitrary set of arguments to be passed to the listener functions.
  • Any values returned by the listeners for an emitted events are ignored.
  • When an event emitter object emits an event, all of the functions attached to that specific event are called synchronously.

Q27. How would you determine the number of cluster instances to start when using the cluster module?

  • const numInstances = cluster.instances().length;
  • const numInstances = cluster.instances();
  • const numInstances = require('os').cpus().length;
  • const numInstances = process.cpus().length;

Q28. How can you convert path segments into a string using the platform-specific separator as a delimiter?

  • path.concat
  • path.join
  • path.format
  • path.parse

Q29. What is a process object and its role?

  • process
  • exports
  • setTimeout
  • Buffer

Q30. Is it possible to write tests in Node.js without an external library?

  • yes, through the assert module
  • yes, through the debugger module
  • yes, through the console module
  • no

Q31. Which assert module method is usually used to test the error-first argument in callbacks?

  • fail
  • doesNotThrow
  • deepStrictEqual
  • ifError

Q32. Which choice is not a subclass of the Error class?

  • GlobalError
  • TypeError
  • RangeError
  • AssertionError

Q33. What is the importance of having good practices around status code in your response?

  • They are an indication of the stability of Nodejs modules and usage recommendations.
  • They tell if a feature is ES6 compliant.
  • They are a Node command to validate stability of your code.
  • They tell if a feature is LTS (Long Term Supported).

Q34. Which choice is not a Node global object?

  • They are an indication of the stability of Nodejs modules and usage recommendations.
  • They tell if a feature is ES6 compliant.
  • They are a Node command to validate stability of your code.
  • They tell if a feature is LTS (Long Term Supported).

READY TO GET STARTED?

Are you ready

Let’s Make Something Amazing Together

Need help? Contact our experts
Tell us about your project