CRT-600 practice question 11 of 30
A developer needs to debug a Node.js web server because a runtime error keeps occurring at one of the endpoints. The developer wants to test the…
Full set: 223 questionsThe node inspect command is the correct way to start the Node.js command-line interface (CLI) debugger. When node inspect server.js is executed, it launches the V8 Inspector, which is Node.js's built-in debugging utility. This command specifically starts the script (server.js) and immediately pauses execution on the first line, providing a debug prompt directly within the same terminal window. This allows the developer to step through the code, inspect variables, and analyze the application's behavior as requested in the scenario.
A. node -i server.js: The -i or --interactive flag starts the REPL (Read-Eval-Print Loop) after the script runs, which is for interactive scripting, not for debugging a server process.
C. node server.js inspect: This is incorrect syntax. inspect is an option for the node executable and must precede the script name, not follow it as a script argument.
D. node start inspect server.js: This is invalid syntax. start is not a native command for the node executable; it is typically used with package managers like npm (e.g., npm start).
1. Node.js Official Documentation
Debugging Guide: The documentation explicitly states the command to start the CLI debugger. It details that node inspect <script.js> starts the Node.js debugger and breaks on the first line of the script.
Source: Node.js v18.18.0 Documentation
Debugging — Getting Started
Command-line options. Section: "Inspector".
Reference: "Start the Node.js debugger CLI by passing the inspect argument when starting a script: $ node inspect myscript.js"
2. Node.js Official Documentation
Command-line options: This document lists all available command-line flags for the node executable. The inspect keyword is documented as the method to activate the V8 inspector and launch the CLI debugger.
Source: Node.js v18.18.0 Documentation
Command-line options.
Reference: The entry for inspect and --inspect describes their function in activating the debugger. inspect is specifically noted for its integration with the CLI debugger.
Keep practicing
Take the free CRT-600 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CRT-600 practice questions
- Question 2A developer has the function, shown below, that is called when a page loads. function onl…
- Question 3A developer needs to test this function: 01 const sum3 = (arr) => ( 02 if (!arr.length) r…
- Question 4Refer to the code below: Const resolveAfterMilliseconds = (ms) => Promise.resolve ( setTi…
- Question 10Refer to the following code block: class Animal{ constructor(name){ this.name = name; } m…
- Question 12Refer to the string below: const str = 'Salesforce'; Which two statements result in the w…
- Question 14Given the code below: Which three code segments result in a correct conversion from numbe…
