PrepIQ OpenJS Node js Application Developer ATLAS Ultimate Exam, Exams of Technology

Offered under the OpenJS Foundation, this certification validates skills in Node.js application development. Domains include asynchronous programming, event-driven design, Node.js APIs, security, testing, debugging, Express framework usage, containerization, and deployment. Passing demonstrates competence in building production-ready Node.js applications.

Typology: Exams

2025/2026

Available from 04/14/2026

shilpi-jain-3
shilpi-jain-3 🇮🇳

2.5

(11)

80K documents

1 / 78

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PrepIQ OpenJS Node js Application
Developer ATLAS Ultimate Exam
**Question 1. Which Buffer method creates a new Buffer containing the UTF-8
bytes of the string “Hello”?**
A) Buffer.alloc(5)
B) Buffer.from('Hello')
C) Buffer.concat(['Hello'])
D) new Buffer('Hello')
Answer: B
Explanation: Buffer.from(string) converts a string to a Buffer using UTF-8 by
default.
**Question 2. What does Buffer.allocUnsafe(size) do?**
A) Allocates a zero-filled Buffer of the given size
B) Allocates a Buffer without initializing memory (may contain old data)
C) Throws an error if size is larger than 1 GB
D) Returns a read-only Buffer
Answer: B
Explanation: allocUnsafe creates a Buffer whose memory is not cleared, offering
better performance but potentially exposing old data.
**Question 3. Which function combines an array of Buffers into a single Buffer?**
A) Buffer.concat(buffers)
B) Buffer.join(buffers)
C) Buffer.merge(buffers)
D) Buffer.combine(buffers)
Answer: A
Explanation: Buffer.concat takes an iterable of Buffer objects and returns a new
Buffer containing their concatenated contents.
**Question 4. When processing a large file that cannot fit into memory, which
stream type should you use to read it piece-by-piece?**
A) Readable stream
B) Writable stream
C) Duplex stream
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e

Partial preview of the text

Download PrepIQ OpenJS Node js Application Developer ATLAS Ultimate Exam and more Exams Technology in PDF only on Docsity!

Developer ATLAS Ultimate Exam

Question 1. Which Buffer method creates a new Buffer containing the UTF- 8 bytes of the string “Hello”? A) Buffer.alloc(5) B) Buffer.from('Hello') C) Buffer.concat(['Hello']) D) new Buffer('Hello') Answer: B Explanation: Buffer.from(string) converts a string to a Buffer using UTF-8 by default. Question 2. What does Buffer.allocUnsafe(size) do? A) Allocates a zero-filled Buffer of the given size B) Allocates a Buffer without initializing memory (may contain old data) C) Throws an error if size is larger than 1 GB D) Returns a read-only Buffer Answer: B Explanation: allocUnsafe creates a Buffer whose memory is not cleared, offering better performance but potentially exposing old data. Question 3. Which function combines an array of Buffers into a single Buffer? A) Buffer.concat(buffers) B) Buffer.join(buffers) C) Buffer.merge(buffers) D) Buffer.combine(buffers) Answer: A Explanation: Buffer.concat takes an iterable of Buffer objects and returns a new Buffer containing their concatenated contents. Question 4. When processing a large file that cannot fit into memory, which stream type should you use to read it piece-by-piece? A) Readable stream B) Writable stream C) Duplex stream

Developer ATLAS Ultimate Exam

D) Transform stream Answer: A Explanation: A Readable stream emits data chunks sequentially, allowing incremental processing without loading the entire file. Question 5. In a Transform stream, which method must be implemented to modify incoming data? A) _read() B) _write() C) _transform(chunk, encoding, callback) D) _flush(callback) Answer: C Explanation: _transform is called for each chunk; you can modify the chunk and push the result downstream. Question 6. What does the .pipe() method return? A) The source stream B) The destination stream C) An array of all piped streams D) Undefined Answer: B Explanation: .pipe() returns the destination (writable) stream, enabling chaining of multiple pipe calls. Question 7. Which utility function from the ‘stream’ module provides automatic error propagation through a pipeline? A) stream.compose() B) stream.pipeline() C) stream.chain() D) stream.connect() Answer: B Explanation: stream.pipeline sets up a pipeline of streams and forwards any errors to a final callback.

Developer ATLAS Ultimate Exam

B) To ensure the first argument is always a boolean indicating success C) To pass an Error object as the first argument, followed by result data D) To enforce synchronous execution of callbacks Answer: C Explanation: The convention is (err, result) where err is null on success; it simplifies error propagation. Question 12. Which phase of the Node.js event loop handles callbacks scheduled by setImmediate()? A) Timers B) I/O callbacks C) Check D) Close callbacks Answer: C Explanation: The “check” phase processes callbacks queued by setImmediate after I/O callbacks. Question 13. In which event loop phase are microtasks (process.nextTick and Promise callbacks) executed? A) Timers B) Poll C) After each phase, before the next phase begins D) Close callbacks Answer: C Explanation: Microtasks run immediately after the current phase completes, before the event loop proceeds to the next phase. Question 14. Which method registers a listener that is invoked only the first time an event occurs? A) emitter.on(event, listener) B) emitter.once(event, listener) C) emitter.addListener(event, listener) D) emitter.onceOnly(event, listener)

Developer ATLAS Ultimate Exam

Answer: B Explanation: once registers a listener that automatically removes itself after the first invocation. Question 15. How do you remove a specific listener from an EventEmitter? A) emitter.deleteListener(event, listener) B) emitter.off(event, listener) C) emitter.remove(event, listener) D) emitter.unlisten(event, listener) Answer: B Explanation: off (or removeListener) detaches a previously added listener for the given event. Question 16. What is a common cause of memory leaks when using EventEmitters? A) Emitting events too frequently B) Registering listeners without ever removing them when they are no longer needed C) Using arrow functions as listeners D) Listening to the ‘error’ event Answer: B Explanation: Listeners that persist after their purpose is finished keep references alive, preventing garbage collection. Question 17. Which fs method returns a Promise when using the “fs/promises” API? A) fs.readFileSync() B) fs.readFile() C) fs.promises.readFile() D) fs.readFileAsync() Answer: C Explanation: fs.promises provides Promise-based versions of the standard fs functions.

Developer ATLAS Ultimate Exam

Answer: B Explanation: 0o400 sets read permission for the owner only; write and execute bits are cleared. Question 22. Which child_process method spawns a new process with a streaming interface for stdin/stdout/stderr? A) exec() B) execFile() C) spawn() D) fork() Answer: C Explanation: spawn returns a ChildProcess with streams for I/O, suitable for large data. Question 23. What is the main difference between exec() and spawn()? A) exec buffers the entire output; spawn streams it B) exec only works on Windows; spawn only on Unix C) exec runs a command as a shell; spawn runs a binary directly D) Both A and C are correct Answer: D Explanation: exec runs the command in a shell and buffers output, while spawn provides streaming I/O and does not invoke a shell unless explicitly requested. Question 24. Which option correctly sets an environment variable “MODE=production” for a spawned child process? A) spawn('node', ['app.js'], { env: { MODE: 'production' } }) B) spawn('node', ['app.js'], { env: { ...process.env, MODE: 'production' } }) C) spawn('node', ['app.js'], { env: process.env.MODE = 'production' }) D) spawn('node', ['app.js'], { env: ['MODE=production'] }) Answer: B Explanation: You must merge the existing environment with the new variable; otherwise the child would inherit an empty env.

Developer ATLAS Ultimate Exam

Question 25. Which method creates a new Node.js process that runs a module as a separate V8 instance and sets up an IPC channel? A) spawn() B) fork() C) execFile() D) exec() Answer: B Explanation: child_process.fork is a shortcut for spawn with the “ipc” channel enabled and automatically runs a Node module. Question 26. How can a parent process send a message to a forked child process? A) child.send({ cmd: 'start' }) B) process.send('start') C) child.emit('message', 'start') D) child.postMessage('start') Answer: A Explanation: The ChildProcess object has a .send() method for IPC messaging when the child was created with fork. **Question 27. Which assertion method checks that two values are deeply equal? ** A) assert.strictEqual(a, b) B) assert.deepStrictEqual(a, b) C) assert.equal(a, b) D) assert.isDeepEqual(a, b) Answer: B Explanation: deepStrictEqual performs a deep comparison using === for primitive values and recursively checks object properties. Question 28. In a Mocha test, how do you indicate that a test contains asynchronous code using callbacks? A) Return a Promise B) Use async function

Developer ATLAS Ultimate Exam

Explanation: console.debug prints messages that can be suppressed when the NODE_DEBUG environment variable is not set. Question 32. How can you start a Node.js process with the built-in inspector listening on port 9229? A) node --inspect=9229 app.js B) node --debug=9229 app.js C) node --inspect-brk=9229 app.js D) node --inspect-port=9229 app.js Answer: A Explanation: --inspect=port enables the V8 inspector; --inspect-brk also pauses at the first line. Question 33. Which statement correctly catches synchronous errors thrown inside an async function? A) Use try/catch around the async function call B) Use .catch() on the returned Promise C) Both A and B are valid D) Errors cannot be caught; they bubble to the process Answer: C Explanation: Inside an async function, try/catch works; outside, you must handle the rejected Promise with .catch(). Question 34. In a stream pipeline, how should you handle errors to avoid uncaught exceptions? A) Attach an 'error' listener to each stream B) Use stream.pipeline(source, transform, dest, callback) and handle the callback error C) Wrap the pipeline in a try/catch block D) Both A and B are recommended Answer: D Explanation: Both attaching listeners and using pipeline’s callback ensure errors are captured and propagated.

Developer ATLAS Ultimate Exam

Question 35. Which of the following is a valid way to export multiple functions from a CommonJS module? A) export { foo, bar } B) module.exports = { foo, bar } C) exports = { foo, bar } D) module.export = { foo, bar } Answer: B Explanation: module.exports is the object that gets returned by require; assigning an object with properties exports the functions. Question 36. How can you import a CommonJS module using ES6 import syntax in Node.js (with type: "module")? A) import utils from './utils' B) import * as utils from './utils.cjs' C) const utils = require('./utils') D) import utils = require('./utils') Answer: B Explanation: When using ES modules, you must import a .cjs file (or use dynamic import) and use * as namespace. Question 37. Which syntax correctly uses destructuring to extract the “port” property from an object named config? A) const { port } = config; B) const port = config['port']; C) const [port] = config; D) const port = config.port(); Answer: A Explanation: Object destructuring pulls out the named property into a variable of the same name. **Question 38. What will the following code output?

let a = 1; ## Developer ATLAS Ultimate Exam **Question 41. Which semantic versioning range allows any minor or patch update but locks the major version?** A) ^1.2. B) ~1.2. C) >=1.2.3 <2.0. D) 1.x Answer: A Explanation: Caret (^) permits updates that do not change the left-most non-zero digit (major version). **Question 42. What does the npm command `npm ci` do?** A) Installs dependencies and updates package-lock.json B) Cleans the node_modules folder and installs exactly what is in package- lock.json C) Runs continuous integration tests D) Installs only devDependencies Answer: B Explanation: npm ci performs a clean install based on package-lock.json, ensuring reproducible builds. **Question 43. Which property of the process object contains command-line arguments passed to the script?** A) process.argv B) process.args C) process.env D) process.execArgv Answer: A Explanation: process.argv is an array where the first two elements are node executable and script path, followed by user arguments. **Question 44. How can you retrieve the number of CPU cores available on the host machine?** A) os.cpus().length b) process.cpus ## Developer ATLAS Ultimate Exam c) os.cpuCount() d) process.cpuCount() Answer: A Explanation: os.cpus() returns an array of CPU objects; its length equals the core count. **Question 45. Which of the following is NOT a valid stream state?** A) readable B) writable C) closed D) paused Answer: C Explanation: Streams have readable/writable flags and can be paused/resumed; “closed” is not a state flag (the stream emits 'close'). **Question 46. What does the highWaterMark option control in a Readable stream?** A) Maximum number of listeners B) Buffer size threshold that triggers a 'readable' event C) Maximum concurrent connections D) Size of the internal buffer before backpressure is applied Answer: D Explanation: highWaterMark sets the number of bytes (or objects) that can be stored in the internal buffer before the stream signals backpressure. **Question 47. Which method should you call on a Writable stream to indicate that no more data will be written?** A) end() B) close() C) finish() D) destroy() Answer: A ## Developer ATLAS Ultimate Exam **Question 51. Which method from the fs module checks if a file is accessible for reading?** A) fs.access(path, fs.constants.R_OK, callback) B) fs.check(path, callback) C) fs.isReadable(path) D) fs.stat(path, callback) Answer: A Explanation: fs.access with the R_OK flag tests read permission. **Question 52. What does the “once” option in the options object of fs.watch do? ** A) Emits only the first change event, then stops watching B) Calls the listener only once per file change C) Limits the number of listeners to one D) It is not a valid option Answer: A Explanation: Setting { once: true } makes the watcher automatically close after the first event. **Question 53. Which of the following statements about the Node.js “process.nextTick” queue is true?** A) It runs after I/O callbacks but before timers B) It runs before any other microtasks C) It runs after the current call stack, before the event loop proceeds to the next phase D) It runs only when there are no pending timers Answer: C Explanation: process.nextTick callbacks are executed after the current operation completes, before the event loop continues. **Question 54. Which of these is a correct way to read a file line-by-line without loading the whole file into memory?** A) fs.readFileSync and split('\n') B) Create a Readable stream and pipe it through readline.createInterface() ## Developer ATLAS Ultimate Exam C) Use fs.watch and accumulate chunks D) Use fs.promises.readFile with { encoding: 'utf8' } Answer: B Explanation: readline Interface works with a stream to emit ‘line’ events for each line. **Question 55. What does the “--trace-warnings” flag do when starting a Node process?** A) Enables V8 profiling B) Prints stack traces for process warnings C) Shows detailed garbage collection logs D) Disables all warnings Answer: B Explanation: --trace-warnings adds stack traces to warning messages, aiding debugging. **Question 56. Which statement about the “fs.promises” API is correct?** A) It returns callbacks instead of Promises B) Methods are named the same as the callback-based ones but return Promises C) It only works on Windows D) It replaces the need for the “util.promisify” function Answer: B Explanation: fs.promises provides Promise-based equivalents of the standard fs functions. **Question 57. Which of the following is the correct way to spawn a child process that runs the command “ls -l /tmp” without using a shell?** A) spawn('ls -l /tmp') B) spawn('ls', ['-l', '/tmp']) C) exec('ls -l /tmp') D) execFile('ls', ['-l', '/tmp']) Answer: B ## Developer ATLAS Ultimate Exam A) fs.readFile('data.json').then(JSON.parse) B) fs.promises.readFile('data.json', 'utf8').then(JSON.parse) C) fs.readFileSync('data.json', 'utf8').then(JSON.parse) D) fs.promises.readJSON('data.json') Answer: B Explanation: readFile returns a Buffer; specifying 'utf8' returns a string that can be parsed with JSON.parse. **Question 62. In a Node.js module, what does the value of __dirname represent? ** A) The directory of the currently executing script (process cwd) B) The absolute path of the directory containing the current module file C) The relative path from the project root D) The name of the package.json directory Answer: B Explanation: __dirname is a module-level variable providing the directory of that file. **Question 63. Which of the following is a correct way to handle uncaught exceptions globally?** A) process.on('uncaughtException', (err) => { … }) B) process.on('unhandledRejection', (reason) => { … }) C) Both A and B are useful for different error types D) It is not possible; you must catch every error manually Answer: C Explanation: uncaughtException handles synchronous errors that bubble out; unhandledRejection catches rejected Promises without a catch. **Question 64. What does the “--experimental-modules” flag do in older Node versions?** A) Enables ES6 module support (`import`/`export`) B) Turns on experimental V8 features unrelated to modules C) Allows loading of .json files as modules ## Developer ATLAS Ultimate Exam D) Disables CommonJS module loading Answer: A Explanation: The flag was required to enable native ES module syntax before it became stable. **Question 65. Which of the following statements about the “pipeline” utility is correct?** A) It returns a Promise when no callback is supplied (Node v15+) B) It only works with Transform streams C) It automatically retries failed streams D) It cannot be used with async functions Answer: A Explanation: When the callback argument is omitted, pipeline returns a Promise that resolves/rejects based on the pipeline outcome. **Question 66. Which method can be used to clone a Buffer without sharing memory?** A) Buffer.clone(buf) B) Buffer.from(buf) C) buf.slice() D) buf.copy() Answer: B Explanation: Buffer.from creates a new Buffer with a copy of the data; slice returns a view sharing the same memory. **Question 67. What will the following code output? ```js const stream = require('stream'); const readable = new stream.Readable({ read() {} }); readable.push('A'); readable.push(null);