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?
- util.types.isDate(value)
- assert.isDate(value)
- console.isDate(value)
- util.date(value)
Q7. 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
Q8. 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
Q9. Which CLI option can you use to debug a node script in Chrome DevTools?
- --dev-tools
- --inspect
- --chrome
- --debug
Q9. Which CLI option can you use to debug a node script in Chrome DevTools?
- --dev-tools
- --inspect
- --chrome
- --debug
Q10. How can you count the number of logical CPUs on the machine that is running Node?
- node -p "process.cpus"
- node -p "util.cpus().size"
- node -p "process.os.cpus"
- node -p "os.cpus().length"
Q11. Which of the following is a method on the console object?
- exit
- test
- time
Q12. Which object is used to manage the cache of required modules?
- global.cache
- module.cache
- process.cache
- require.cache
Q13. 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)
Q14. Which of the following is NOT a Node repl command?
- .break
- .history
- .editor
- .save
Q15. 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');
Q16. Which of the following objects is a stream
- process.uptime
- process.stdout
- process
- Buffer
Q17. Which module variable holds the resolved absolute path of the current module file?
-
__pathname
-
__location
-
__flder
-
__filename
Q18. Which console method can be used to print the stack trace to the point of its execution?
- stack
- trace
- debug
Q19. 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
Q20. How do you make an HTTP server object active and listen to requests on certain ports?
- server. start
- server.activate
- server.listen
- server. run
Q21. What is the purpose of the file system (fs) module?
- to provide methods to work with requests and responses
- to provide methods to work with files
- to provide methods to work with databases
- to find new file systems
Q22. 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.
Q23. Which of the following is NOT a valid stream in Node?
- process. stdinfo
- process. stdin
- process. stdout
- process. stderr
Q24. Which choice is not a valid method on event emitters?
- start
- on
- once
- off
Q25. Which special object is an instance of EventEmitter?Which special object is an instance of null?
- process
- Buffer
- root
- require
Q26. What is the command to get a list of available commands for Node.js?What is the command to get a list of available commands for Node.js?
- node index.js -x
- node -v
- node -h
- node index.js -h
Q27. When a request event is received in the HTTP module, what is the type of the first argument passed to that event, usually named req?
- http.IncomingMessage
- http.ServerRequest
- http.ClientRequest
- http.ServerResponse
Q28. What are the arguments passed to the module wrapper function?
-
exports, __filename, __dirname
-
exports, process, require, module, __filename, __dirname
-
exports, module, __filename, __dirname
-
exports, require, module, __filename, __dirname
Q29. Which core Node module has wrappers for OpenSSL methods?
- SSL
- hash
- crypto
- TLS
Q30. Which line imports a promise-based version of the readFile method?
- const { readFile } = require(fs).promises
- const { readFile } = require(fs)
- const { readFilePromises: readFile } = require(fs)
- const { readFile } = require(promises)
Q31. Which core module in Node can you use for testing?
- chai
- jest
- assert
- mocha
Q32. Which Node.js module should you use when you need to decode raw data into strings?
- buffer
- util
- string_decoder
- string_buffer
Q33. Which global object acts like a bridge between a Node script and the host operating system?
- v8
- env
- process
- child_process
Q34. Which statement is true about Node.js and threads?
- Every Node process runs in a single thread, and all the I/O work is run in that same thread.
- Every Node process gets four threads that it can share between its JavaScript VM and the event loop.
- The event loop is single-threaded, but a JavaScript VM can use multiple threads.
- JavaScript execution in Node.js is single-threaded, but I/O operations are executed using multiple threads.
Q35. 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.
Q36. Which choice is not a Node global object?
- process
- exports
- setTimeout
- Buffer
Q37. What is a process object and its role?
- a locally scoped object that provides information about the current node process
- a global object that provides information about files
- a global object that provides information about the database
- a global object that provides information about the current node process
Q38. 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
Q39. Which assert module method is usually used to test the error-first argument in callbacks?
- fail
- doesNotThrow
- deepStrictEqual
- ifError
Q40. Which choice is not a method on the util module?
- promisify
- asyncify
- types
- callbackify
Q41. What is Node built on?
- Python
- V8 JavaScript engine
- PHP
- c
Q42. How does it affect the performance of a web application when an execution path contains a CPU-heavy operation, such as calculating a long Fibonacci sequence?
- As Node.js is asynchronous, this is handled by a libuv and a threadpool. The performance will not notably degrade.
- As the application code runs asynchronously within a single thread, the execution will block, accepting no more requests until the operation is completed.
- As Node.js is asynchronous, this is handled by a threadpool and the performance will not notably degrade.
- The current thread will block until the execution is completed and the operating system will spawn new threads to handle incoming requests. This can exhaust the number of allowed threads (255) and degrade performance over time.
Q43. What is one way to check that a value is a date object in Node?
- console.isDate(value)
- util.date(value)
- assert.isDate(value)
- util.types.isDate(value)
Q44. What is the main purpose of the package-lock.json file?
- to be a system file
- to provide an exact, single representation of the dependency tree
- to serve as a module to export dependencies
- to be a log for the application
Q45. Which choice is not a Node global object?
- process
- exports
- setTimeout
- Buffer
READY TO GET STARTED?
Are you ready
Let’s Make Something Amazing Together



Need help? Contact our experts
Tell us about your project




