Dưới đây là 9 câu hỏi được chọn ngẫu nhiên từ bài kiểm tra kiến thức C4 Blockchain: Basics and Applications >> Fundamentals of Node.js. Là người dùng chưa được xác thực, bạn có quyền truy cập vào một nhóm giới hạn gồm 9 trong số 198 câu hỏi và bạn sẽ không thể xem câu trả lời chính xác cho những câu hỏi đó.
1/198: What is the difference between the append (a) and w options in fs.writeFile?
- There is no difference between the two options.
- The append option appends data to the file, while the w option overwrites the file with new data.
- The append option overwrites the file with new data, while the w option appends data to the file.
2/198: How do modules and namespaces work together in Node.js?
- Neither modules nor namespaces are used in Node.js.
- Modules provide organization and naming conflict prevention, while namespaces provide encapsulation and reusability.
- Modules provide encapsulation and reusability, while namespaces provide organization and naming conflict prevention.
- Modules and namespaces are the same thing and are used interchangeably.
3/198: How can you create a namespace in Node.js?
- By using a special keyword
- By creating a new object and adding properties and methods to it
- By declaring a function with a special name
4/198: What should you do if you see the error message "'node' is not recognized as an internal or external command, operable program or batch file"?
- Restart the computer and try again.
- Ignore the error message and proceed with the next step.
- Install Node.js on the computer.
- Check the version of Node.js installed on the computer.
5/198: What is the purpose of the exports parameter in the function wrapper?
- To load other modules required by the current module
- To store the absolute path of the current module file
- To define variables and functions that can be accessed from outside the module
6/198: What is the difference between synchronous and asynchronous operations in Node.js?
- Synchronous operations always return a value, while asynchronous operations do not.
- Synchronous operations block the event loop, while asynchronous operations do not.
- Synchronous operations are written with callbacks, while asynchronous operations are written inside try-catch blocks.
7/198: How can you export a module in NodeJS?
- Using the module.exports object
- Using the import keyword
- Using the exports object
- Using the export keyword
8/198: What happens when a function is called in a program?
- The function is removed from the execution/call stack
- The program crashes due to a stack overflow error
- The function is immediately executed and its result is returned to the calling code
- The function is added to the end of the execution/call stack
9/198: What is the command to install a package as a dev dependency in NPM?
- npm install package --save
- npm install package --save-dev
- npm install package