OpenJS Node.js Application Developer China (JSNADCN) Exam, Exams of Technology

The JSNADCN Exam is a region-specific version of the Node.js Application Developer exam, targeted for China. It validates practical, hands-on knowledge in developing server-side applications using Node.js. The exam covers core APIs, asynchronous programming, event loops, error handling, debugging, package management with npm, and working with file systems and streams. Localization ensures candidates in China can test under familiar conditions while aligning with international Node.js development standards.

Typology: Exams

2024/2025

Available from 09/11/2025

BookVenture
BookVenture šŸ‡®šŸ‡³

3.2

(20)

26K documents

1 / 72

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
OpenJS Node.js Application Developer China (JSNADCN)
Exam
Question 1. Which of the following is NOT a primitive data type in JavaScript?
A) String
B) Number
C) Object
D) Boolean
Answer: C
Explanation: Object is not a primitive data type; it is a reference type. Primitives include string, number,
boolean, null, undefined, symbol, and bigint.
Question 2. What does the let keyword provide in JavaScript that var does not?
A) Hoisting
B) Block scope
C) Global scope
D) Automatic type conversion
Answer: B
Explanation: let provides block scope, meaning the variable is only accessible within the block it was
defined, unlike var which is function-scoped.
Question 3. Which of the following is a correct way to declare a constant in ES6?
A) constant PI = 3.14
B) const PI = 3.14
C) var PI = 3.14
D) let PI = 3.14
Answer: B
Explanation: const is used to declare constants whose values cannot be reassigned.
Question 4. Which operator is used to check both value and type in JavaScript?
A) ==
B) =
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

Partial preview of the text

Download OpenJS Node.js Application Developer China (JSNADCN) Exam and more Exams Technology in PDF only on Docsity!

Exam

Question 1. Which of the following is NOT a primitive data type in JavaScript? A) String B) Number C) Object D) Boolean Answer: C Explanation: Object is not a primitive data type; it is a reference type. Primitives include string, number, boolean, null, undefined, symbol, and bigint. Question 2. What does the let keyword provide in JavaScript that var does not? A) Hoisting B) Block scope C) Global scope D) Automatic type conversion Answer: B Explanation: let provides block scope, meaning the variable is only accessible within the block it was defined, unlike var which is function-scoped. Question 3. Which of the following is a correct way to declare a constant in ES6? A) constant PI = 3. B) const PI = 3. C) var PI = 3. D) let PI = 3. Answer: B Explanation: const is used to declare constants whose values cannot be reassigned. Question 4. Which operator is used to check both value and type in JavaScript? A) == B) =

Exam

C) ===

D) !=

Answer: C Explanation: The strict equality operator (===) checks both value and type. Question 5. What is the output of: console.log(typeof null)? A) 'null' B) 'object' C) 'undefined' D) 'number' Answer: B Explanation: typeof null returns 'object' due to a historical bug in JavaScript. Question 6. What will happen if you try to reassign a value to a const variable? A) It will silently fail B) It will throw a TypeError C) It will assign the value D) It will ignore the assignment Answer: B Explanation: Reassigning a const variable will throw a TypeError. Question 7. Which statement about arrow functions is true? A) They have their own 'this' context B) They inherit 'this' from the enclosing scope C) They are only available in ES D) They cannot be used as callback functions Answer: B Explanation: Arrow functions do not have their own 'this'; they inherit it from the enclosing lexical context.

Exam

C) await() D) catch() Answer: B Explanation: The then() method is used to handle the fulfillment of a Promise. Question 12. What does the async keyword do when used with a function? A) Makes the function asynchronous and always returns a Promise B) Makes the function synchronous C) Waits for a Promise to resolve D) Blocks all other code Answer: A Explanation: async makes the function return a Promise and allows the use of await within. Question 13. Which of the following is NOT a valid variable name in JavaScript? A) $var B) _var C) 2var D) var Answer: C Explanation: Variable names cannot start with a digit. Question 14. What is the result of: console.log('5' + 3)? A) 8 B) '53' C) '8' D) NaN Answer: B Explanation: The + operator concatenates when one operand is a string.

Exam

Question 15. Which of the following is used to import a module in CommonJS? A) import B) require C) include D) fetch Answer: B Explanation: CommonJS uses require() to import modules. Question 16. How do you export a function in a CommonJS module? A) export function myFunc() {} B) module.exports = myFunc; C) exports: myFunc D) require.myFunc = function() {} Answer: B Explanation: module.exports is used to export functions or objects in CommonJS. Question 17. What will happen if you require the same module twice in Node.js? A) It loads a new instance every time B) It caches the module after the first require C) It throws an error D) It overrides the previous one Answer: B Explanation: Node.js caches modules after the first load. Question 18. What is the default value of module.exports in Node.js? A) {} B) []

Exam

Question 22. Which command installs a module and adds it to dependencies in package.json? A) npm install B) npm install --save-dev C) npm install - g D) npm add --dev Answer: A Explanation: npm install adds it to dependencies by default. Question 23. What is the purpose of the devDependencies field in package.json? A) To list dependencies only needed in production B) To list dependencies only needed for development C) To list optional dependencies D) To list peer dependencies Answer: B Explanation: devDependencies are for modules needed only during development. Question 24. Which npm command updates all dependencies to their latest versions? A) npm update B) npm upgrade C) npm upgrade-all D) npm refresh Answer: A Explanation: npm update updates all dependencies as specified by the version ranges in package.json. Question 25. How do you remove a dependency from a Node.js project? A) npm remove B) npm uninstall

Exam

C) npm delete D) Both A and B Answer: D Explanation: Both npm remove and npm uninstall can be used. Question 26. Which field in package.json specifies scripts to run using npm? A) "run" B) "scripts" C) "start" D) "npm" Answer: B Explanation: The "scripts" field is used for npm scripts. Question 27. What does the ^ symbol in a version in package.json mean? A) Install only this exact version B) Allow patch-level changes only C) Allow minor and patch-level updates D) Allow major updates Answer: C Explanation: ^ allows updates that do not modify the left-most non-zero digit in the version. Question 28. What is the default entry point filename for a Node.js module if not specified in package.json? A) main.js B) app.js C) index.js D) entry.js Answer: C Explanation: index.js is the default entry point.

Exam

C) CustomEmitter D) Emitter Answer: A Explanation: EventEmitter is the core class for events. Question 33. What module must be required to use EventEmitter? A) 'events' B) 'event' C) 'emitter' D) 'core' Answer: A Explanation: The 'events' module provides EventEmitter. Question 34. Which method removes a specific event listener? A) removeListener() B) remove() C) off() D) detach() Answer: A Explanation: removeListener() removes a listener for a given event. Question 35. What is the effect of calling removeAllListeners() on an EventEmitter? A) Removes all EventEmitters B) Removes all listeners for all events C) Removes only one listener D) Does nothing Answer: B Explanation: removeAllListeners() removes every listener for every event.

Exam

Question 36. Which event is emitted when an error occurs in EventEmitter? A) 'error' B) 'fail' C) 'exception' D) 'catch' Answer: A Explanation: The 'error' event is standard for errors. Question 37. What happens if an 'error' event is emitted with no listeners attached? A) It is ignored B) It throws an exception C) It logs a warning D) It stops the process Answer: B Explanation: If 'error' is emitted without a listener, Node.js throws and crashes. Question 38. How do you add a one-time event listener in EventEmitter? A) once() B) onetime() C) listenOnce() D) addOnce() Answer: A Explanation: once() attaches a listener that is invoked only once. Question 39. Which class is used for handling binary data in Node.js? A) Buffer B) Binary

Exam

Question 43. Which encoding is default for Buffer.toString()? A) hex B) base C) utf D) ascii Answer: C Explanation: utf8 is the default encoding for Buffer.toString(). Question 44. How do you concatenate two Buffer objects? A) Buffer.concat([buf1, buf2]) B) buf1 + buf C) buf1.concat(buf2) D) Buffer.join(buf1, buf2) Answer: A Explanation: Buffer.concat takes an array of Buffer objects. Question 45. Which stream type is used for writing data? A) Readable B) Writable C) Duplex D) Transform Answer: B Explanation: Writable streams are used to write data. Question 46. Which stream type can both read and write? A) Readable B) Writable

Exam

C) Duplex D) Object Answer: C Explanation: Duplex streams support both reading and writing. Question 47. Which method is used to pipe a readable stream to a writable stream? A) pipe() B) connect() C) stream() D) join() Answer: A Explanation: The pipe() method is used for connecting streams. Question 48. Which event signals that no more data will be provided on a readable stream? A) 'end' B) 'finish' C) 'close' D) 'done' Answer: A Explanation: The 'end' event indicates the readable stream is finished. Question 49. What is the main advantage of streams for processing large files? A) All data is loaded at once B) Data is processed in chunks, reducing memory usage C) Files are compressed automatically D) They are faster for small data Answer: B Explanation: Streams process data in chunks, making them memory efficient.

Exam

C) Reads, transforms, and writes data D) Closes data Answer: C Explanation: Transform streams can read and write, transforming data between. Question 54. Which method ends a writable stream? A) end() B) finish() C) close() D) done() Answer: A Explanation: end() finishes writing and closes the stream. Question 55. How do you listen for data events on a readable stream? A) readable.on('data', callback) B) readable.emit('data', callback) C) readable.write('data', callback) D) readable.pipe('data', callback) Answer: A Explanation: The 'data' event is emitted for chunks of data. Question 56. In package.json, which field specifies the package version? A) "ver" B) "version" C) "release" D) "pkgVersion" Answer: B Explanation: "version" specifies the package version.

Exam

Question 57. What command initializes a new package.json interactively? A) npm start B) npm init C) npm install D) npm create Answer: B Explanation: npm init creates package.json interactively. Question 58. Which of the following is NOT a valid script in package.json? A) "start" B) "test" C) "build" D) "main" Answer: D Explanation: "main" is not a script; it's for specifying entry point. Question 59. What is required to successfully run npm scripts? A) Node.js must be installed B) package.json must have a "scripts" field C) Both A and B D) Only package.json Answer: C Explanation: Both Node.js and scripts in package.json are required. Question 60. Which command runs the "test" script in package.json? A) npm run test B) npm test

Exam

Question 64. Which method reads a file as a stream in Node.js? A) fs.createReadStream() B) fs.readFile() C) fs.read() D) fs.openStream() Answer: A Explanation: fs.createReadStream() creates a readable stream. Question 65. What is the default encoding for fs.createReadStream? A) utf B) none (Buffer) C) ascii D) base Answer: B Explanation: No encoding by default; data is Buffer. Question 66. Which event is fired when a writable stream finishes writing all data? A) 'finish' B) 'end' C) 'close' D) 'done' Answer: A Explanation: 'finish' means all data is written. Question 67. Which command installs a package globally? A) npm install - g B) npm install

Exam

C) npm install --save D) npm add - g Answer: A Explanation: - g flag installs packages globally. Question 68. How do you install all dependencies listed in package.json? A) npm install B) npm all C) npm update D) npm fetch Answer: A Explanation: npm install installs all listed dependencies. Question 69. What is the purpose of the "peerDependencies" field in package.json? A) To specify dependencies required by the host project B) To specify optional dependencies C) To specify development dependencies D) To specify dependencies for testing Answer: A Explanation: peerDependencies specify dependencies required by the consuming project. Question 70. Which core module provides utilities for working with binary data? A) buffer B) binary C) util D) stream Answer: A Explanation: The 'buffer' module provides Buffer class and utilities.