@palerock/exam-qa 1.0.6-patch2 → 1.0.6-patch21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.html +1 -1
- package/dist/static/css/app.4293d3540537974d843eca825dcda382.css +2 -0
- package/dist/static/css/app.4293d3540537974d843eca825dcda382.css.map +1 -0
- package/dist/static/js/app.e278f9557d317b4606b0.js +2 -0
- package/dist/static/js/app.e278f9557d317b4606b0.js.map +1 -0
- package/dist/static/js/manifest.3ad1d5771e9b13dbdad2.js.map +1 -1
- package/lib-json/Dev1/345/237/272/347/241/200/351/242/230.json +1407 -0
- package/lib-json/Dev1/346/250/241/346/213/237/345/215/267A.json +1538 -0
- package/lib-json/Dev1/346/250/241/346/213/237/345/215/267B.json +1534 -0
- package/lib-json/Dev1/346/265/201/347/250/213/350/207/252/345/212/250/345/214/226/344/270/216/351/200/273/350/276/2211.json +1587 -0
- package/lib-json/Dev1/346/265/201/347/250/213/350/207/252/345/212/250/345/214/226/344/270/216/351/200/273/350/276/2212.json +1042 -0
- package/lib-json/Dev1/346/265/213/350/257/225_/350/260/203/350/257/225_/351/203/250/347/275/262.json +928 -0
- package/lib-json/Dev1/347/224/250/346/210/267/347/225/214/351/235/242.json +1243 -0
- package/lib-json/[DEV2]Salesforce/345/237/272/347/241/200.json +375 -0
- package/lib-json/[DEV2]/346/200/247/350/203/275.json +728 -0
- package/lib-json/[DEV2]/346/250/241/346/213/237/345/215/267A.json +1403 -0
- package/lib-json/[DEV2]/346/250/241/346/213/237/345/215/267B.json +1387 -0
- package/lib-json/[DEV2]/346/265/213/350/257/225/344/270/216/351/203/250/347/275/262.json +828 -0
- package/lib-json/[DEV2]/347/224/250/346/210/267/347/225/214/351/235/2421.json +977 -0
- package/lib-json/[DEV2]/347/224/250/346/210/267/347/225/214/351/235/2422.json +667 -0
- package/lib-json/[DEV2]/351/200/273/350/276/221/343/200/201/346/265/201/347/250/213/350/207/252/345/212/250/345/214/226/345/222/214/351/233/206/346/210/2201.json +1387 -0
- package/lib-json/[DEV2]/351/200/273/350/276/221/343/200/201/346/265/201/347/250/213/350/207/252/345/212/250/345/214/226/345/222/214/351/233/206/346/210/2202.json +260 -0
- package/lib-json/[JS]/347/254/254/344/270/200/347/253/240 /345/217/230/351/207/217-/347/261/273/345/236/213-/351/233/206/345/220/210.json" +1048 -0
- package/lib-json/[JS]/347/254/254/344/270/203/347/253/240 /346/265/213/350/257/225.json" +356 -0
- package/lib-json/[JS]/347/254/254/344/270/211/347/253/240 /346/265/217/350/247/210/345/231/250/345/222/214/344/272/213/344/273/266.json" +851 -0
- package/lib-json/[JS]/347/254/254/344/272/214/347/253/240 /345/257/271/350/261/241-/345/207/275/346/225/260-/347/261/273.json" +1787 -0
- package/lib-json/[JS]/347/254/254/344/272/224/347/253/240 /345/274/202/346/255/245/347/274/226/347/250/213.json" +547 -0
- package/lib-json/[JS]/347/254/254/345/205/255/347/253/240 /346/234/215/345/212/241/345/231/250/347/253/257JavaScript.json" +613 -0
- package/lib-json/[JS]/347/254/254/345/233/233/347/253/240 /350/260/203/350/257/225/345/222/214/351/224/231/350/257/257/345/244/204/347/220/206.json" +525 -0
- package/lib-json/[/345/222/270/351/261/274]AppBuilder-1.json +977 -0
- package/lib-json/[/345/222/270/351/261/274]AppBuilder-2.json +941 -0
- package/lib-json/[/345/222/270/351/261/274]AppBuilder-3.json +973 -0
- package/lib-json/[/345/222/270/351/261/274]AppBuilder-4.json +981 -0
- package/lib-json/[/345/222/270/351/261/274]AppBuilder-5.json +771 -0
- package/lib-json/map.json +28 -43
- package/package.json +4 -2
- package/dist/static/css/app.d3e969a579969be885a3462a1e12e37f.css +0 -2
- package/dist/static/css/app.d3e969a579969be885a3462a1e12e37f.css.map +0 -1
- package/dist/static/js/app.53370ddfe5eba6a10565.js +0 -2
- package/dist/static/js/app.53370ddfe5eba6a10565.js.map +0 -1
- package/lib-json/Salesforce-Admin(302)-[Set-10].json +0 -321
- package/lib-json/Salesforce-Admin(302)-[Set-1].json +0 -301
- package/lib-json/Salesforce-Admin(302)-[Set-2].json +0 -325
- package/lib-json/Salesforce-Admin(302)-[Set-3].json +0 -305
- package/lib-json/Salesforce-Admin(302)-[Set-4].json +0 -325
- package/lib-json/Salesforce-Admin(302)-[Set-5].json +0 -329
- package/lib-json/Salesforce-Admin(302)-[Set-6].json +0 -322
- package/lib-json/Salesforce-Admin(302)-[Set-7].json +0 -321
- package/lib-json/Salesforce-Admin(302)-[Set-8].json +0 -321
- package/lib-json/Salesforce-Admin(302)-[Set-9].json +0 -325
- package/lib-json/Salesforce-Admin-201-[Set-10].json +0 -158
- package/lib-json/Salesforce-Admin-201-[Set-1].json +0 -604
- package/lib-json/Salesforce-Admin-201-[Set-2].json +0 -621
- package/lib-json/Salesforce-Admin-201-[Set-3].json +0 -650
- package/lib-json/Salesforce-Admin-201-[Set-4].json +0 -636
- package/lib-json/Salesforce-Admin-201-[Set-5].json +0 -640
- package/lib-json/Salesforce-Admin-201-[Set-6].json +0 -126
- package/lib-json/Salesforce-Admin-201-[Set-7].json +0 -126
- package/lib-json/Salesforce-Admin-201-[Set-8].json +0 -126
- package/lib-json/Salesforce-Admin-201-[Set-9].json +0 -126
- package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-1].json +0 -321
- package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-2].json +0 -325
- package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-3].json +0 -321
- package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-4].json +0 -337
- package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-5].json +0 -329
- package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-6].json +0 -325
- package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-7].json +0 -480
- package/lib-json/Salesforce-Sales-Cloud-Certification(81)-[Set-1].json +0 -305
- package/lib-json/Salesforce-Sales-Cloud-Certification(81)-[Set-2].json +0 -297
- package/lib-json/Salesforce-Sales-Cloud-Certification(81)-[Set-3].json +0 -269
- package/lib-json/Salesforce-Sales-Cloud-Certification(81)-[Set-4].json +0 -309
- package/lib-json/Salesforce-Sales-Cloud-Certification(81)-[Set-5].json +0 -515
- package/lib-json/app-builder-01.json +0 -1
- package/lib-json/app-builder-02.json +0 -1
- package/lib-json/app-builder-03.json +0 -1
- package/lib-json/app-builder-04.json +0 -1
- package/lib-json/app-builder-05.json +0 -1
- package/lib-json/app-builder-06.json +0 -1
- package/lib-json/app-builder-07.json +0 -1
- package/lib-json/app-builder-08.json +0 -1
- package/lib-json/app-builder-09.json +0 -1
- package/lib-json/app-builder-10.json +0 -1
- package/lib-json/app-builder-11.json +0 -311
@@ -0,0 +1,613 @@
|
|
1
|
+
{
|
2
|
+
"title": "[JS]第六章 服务器端JavaScript",
|
3
|
+
"category": "JS-1",
|
4
|
+
"questions": [
|
5
|
+
{
|
6
|
+
"describe": "<p>A developer sets up a Node.js server and creates a script at the root of the source code, index.js, that starts the server when executed. The developer declares a variable that needs the location and name of the file that the code executes from.</p><p>Which global variable should be used in the script?</p>",
|
7
|
+
"answerOptions": [
|
8
|
+
{
|
9
|
+
"describe": "<p>__dirname</p>",
|
10
|
+
"isRight": false
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"describe": "<p>this.path</p>",
|
14
|
+
"isRight": false
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"describe": "<p>window.location</p>",
|
18
|
+
"isRight": false
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"describe": "<p>__filename</p>",
|
22
|
+
"isRight": true
|
23
|
+
}
|
24
|
+
],
|
25
|
+
"analysis": "<p>nodejs global object: https://nodejs.org/api/globals.html</p><p>__dirname, the directory name of the current module</p><p>use path module without require this keyword</p><p>The Window.location read-only property returns a Location object with information about the current location of the document.</p><p>__filename, the file name of the current module.</p>",
|
26
|
+
"hashCode": 662079527
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"describe": "<p>A developer is leading the creation of a new web server for their team that will fulfill API requests from an existing client.</p><p>The team wants a web server that runs on Node.js, and they want to use the new web framework Minimalist.js. The lead developer wants to advocate for a more seasoned back-end framework that already has a community around it.</p><p>Which two frameworks could the lead developer advocate for?</p><p>Choose 2 answers</p>",
|
30
|
+
"answerOptions": [
|
31
|
+
{
|
32
|
+
"describe": "<p>Angular</p>",
|
33
|
+
"isRight": false
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"describe": "<p>Gatsby</p>",
|
37
|
+
"isRight": false
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"describe": "<p>Express</p>",
|
41
|
+
"isRight": true
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"describe": "<p>Koa</p>",
|
45
|
+
"isRight": true
|
46
|
+
}
|
47
|
+
],
|
48
|
+
"analysis": "<p>Angular is a front end framework</p><p>Gatsby, is a framework for building websites with React</p><p>Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications</p><p>A Koa Request object is an abstraction on top of node's vanilla request object, providing additional functionality that is useful for every day HTTP server</p>",
|
49
|
+
"hashCode": 2097314672
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"describe": "<p>A developer needs to debug a Node.js web server because a runtime error keeps occurring at one of the endpoints.</p><p>The developer wants to test the endpoint on a local machine and make the request against a local server to look at the behavior. In the source code, the server.js file will start the server. The developer wants to debug the Node.js server only using the terminal. Which command can the developer use to open the CLI debugger in their current terminal window?</p>",
|
53
|
+
"answerOptions": [
|
54
|
+
{
|
55
|
+
"describe": "<p>node start inspect server.js</p>",
|
56
|
+
"isRight": false
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"describe": "<p>node -i server.js</p>",
|
60
|
+
"isRight": false
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"describe": "<p>node inspect server.js</p>",
|
64
|
+
"isRight": false
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"describe": "<p>node server.js --inspect</p>",
|
68
|
+
"isRight": true
|
69
|
+
}
|
70
|
+
],
|
71
|
+
"analysis": "<p>node.js debugging guide: https://nodejs.org/en/docs/guides/debugging-getting-started/</p><p>--inspect: Enable inspector agent, and listen on default address and port (127.0.0.1:9229)</p>",
|
72
|
+
"hashCode": 2057600892
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"describe": "<p>Which option is a core Node.js module?</p>",
|
76
|
+
"answerOptions": [
|
77
|
+
{
|
78
|
+
"describe": "<p>filestream</p>",
|
79
|
+
"isRight": false
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"describe": "<p>fs</p>",
|
83
|
+
"isRight": true
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"describe": "<p>iosfwd</p>",
|
87
|
+
"isRight": false
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"describe": "<p>fstream</p>",
|
91
|
+
"isRight": false
|
92
|
+
}
|
93
|
+
],
|
94
|
+
"analysis": "<p>some common used core node modules: fs, http, https, path, url</p>",
|
95
|
+
"hashCode": -1521682380
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"describe": "<p>In the browser, the window object is often used to assign variables that require the broadest scope in an application. Node.js applications do not have access to the window object by default.</p><p>Which two methods are used to address this? Choose 2 answers</p>",
|
99
|
+
"answerOptions": [
|
100
|
+
{
|
101
|
+
"describe": "<p>Use the document object instead of the window object.</p>",
|
102
|
+
"isRight": false
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"describe": "<p>Assign variables to module.exports and require them as needed.</p>",
|
106
|
+
"isRight": false
|
107
|
+
},
|
108
|
+
{
|
109
|
+
"describe": "<p>Assign variables to the global object.</p>",
|
110
|
+
"isRight": true
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"describe": "<p>Create a new window object in the root file.</p>",
|
114
|
+
"isRight": true
|
115
|
+
}
|
116
|
+
],
|
117
|
+
"analysis": "<p>In browsers, the top-level scope is the global scope. That means that in browsers if you're in the global scope var something will define a global variable. In Node.js this is different. The top-level scope is not the global scope; var something inside an Node.js module will be local to that module.</p><p>We can access the global object in node using the global keyword:</p><p>console.log(global);</p><p>The global object exposes a variety of useful properties about the environment. Also this is the place where functions as setImmediate and clearTimeout are located.</p>",
|
118
|
+
"hashCode": 2020446662
|
119
|
+
},
|
120
|
+
{
|
121
|
+
"describe": "<p>Refer to the code below:</p><p>01 const resolveAfterMilliseconds = (ms) => Promise.resolve(</p><p>02 setTimeout(( ) => console.log(ms), ms));</p><p>03 const aPromise = await resolveAfterMilliseconds(500) ;</p><p>04 const bPromise = await resolveAfterMilliseconds(500) ;</p><p>05 await aPromise, await bPromise ;</p><p>What is the result of running line 05?</p>",
|
122
|
+
"answerOptions": [
|
123
|
+
{
|
124
|
+
"describe": "<p>Only aPromise runs.</p>",
|
125
|
+
"isRight": false
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"describe": "<p>aPromise and bPromise run sequentially.</p>",
|
129
|
+
"isRight": true
|
130
|
+
},
|
131
|
+
{
|
132
|
+
"describe": "<p>aPromise and bPromise run in parallel.</p>",
|
133
|
+
"isRight": false
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"describe": "<p>Neither aPromise or bPromise runs.</p>",
|
137
|
+
"isRight": false
|
138
|
+
}
|
139
|
+
],
|
140
|
+
"analysis": "<p>check await keyword:</p><p>https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await</p>",
|
141
|
+
"hashCode": 2019967301
|
142
|
+
},
|
143
|
+
{
|
144
|
+
"describe": "<p>A developer is setting up a new Node.js server with a client library that is built using events and callbacks.</p><p>The library:</p><p>• Will establish a web socket connection and handle receipt of messages to the server</p><p>• Will be imported with require, and made available with a variable called ws.</p><p>The developer also wants to add error logging if a connection fails.</p><p>Given this information, which code segment shows the correct way to setup a client with two events that listen at execution time?</p>",
|
145
|
+
"answerOptions": [
|
146
|
+
{
|
147
|
+
"describe": "<p>04 ws.on('connect', ( ) => {</p><p>05 console.log ('Connected to client') ;</p><p>06</p><p>07 ws.on('error', (error) => {</p><p>08 console.log('ERROR', error) ;</p><p>09 });</p><p>10 });</p>",
|
148
|
+
"isRight": false
|
149
|
+
},
|
150
|
+
{
|
151
|
+
"describe": "<p>04 ws.on('connect', ( ) => {</p><p>05 console. log( 'Connected to client') ;</p><p>06 });</p><p>07</p><p>08 ws.on('error', (error) => {</p><p>09 console. log('ERROR', error) ;</p><p>10 });</p>",
|
152
|
+
"isRight": true
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"describe": "<p>04 try {</p><p>05 ws.connect ( ( ) => {</p><p>06 console.log('Connected to client') ;</p><p>07 }) ;</p><p>08 } catch(error) {</p><p>09 console.log('ERRoR', error);</p><p>10 }</p>",
|
156
|
+
"isRight": false
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"describe": "<p>04 ws.connect(( ) => {</p><p>05 conole.log('Conneted to ellent');06 }).catch((error) => {</p><p>07 console. log('ERROR',error) ;</p><p>08 });</p>",
|
160
|
+
"isRight": false
|
161
|
+
}
|
162
|
+
],
|
163
|
+
"analysis": "<p>if use try…catch… block, need to use async/await with promise so that the try…catch... Block can work</p><p>Callbacks are the most basic way of delivering an error asynchronously. The user passes you a function (the callback), and you invoke it sometime later when the asynchronous operation completes. The usual pattern is that the callback is invoked as callback(err, result), where only one of err and result is non-null, depending on whether the operation succeeded or failed.</p>",
|
164
|
+
"hashCode": 1243459067
|
165
|
+
},
|
166
|
+
{
|
167
|
+
"describe": "<p>A developer is debugging a web server that uses Node.js. The server hits a runtime error every third request to an important endpoint on the web server.</p><p>The developer added a break point to the start script, that is at index.js at the root of the server's source code. The developer wants to make use of Chrome DevTools to debug.Which command can be run to access DevTools and make sure the breakpoint is hit?</p>",
|
168
|
+
"answerOptions": [
|
169
|
+
{
|
170
|
+
"describe": "<p>node inspect index.js</p>",
|
171
|
+
"isRight": false
|
172
|
+
},
|
173
|
+
{
|
174
|
+
"describe": "<p>node -- inspect index.js</p>",
|
175
|
+
"isRight": false
|
176
|
+
},
|
177
|
+
{
|
178
|
+
"describe": "<p>node -- inspect-brk index.js</p>",
|
179
|
+
"isRight": true
|
180
|
+
},
|
181
|
+
{
|
182
|
+
"describe": "<p>node - i index.js</p>",
|
183
|
+
"isRight": false
|
184
|
+
}
|
185
|
+
],
|
186
|
+
"analysis": "<p>--inspect':</p><p>Enable inspector agent</p><p>Listen on default address and port (127.0.0.1:9229)</p><p>'--inspect-brk':</p><p>Enable inspector agent</p><p>Listen on default address and port (127.0.0.1:9229)</p><p>Break before user code starts</p><p>check node doc:</p><p>https://nodejs.org/en/docs/guides/debugging-getting-started/</p>",
|
187
|
+
"hashCode": 212405043
|
188
|
+
},
|
189
|
+
{
|
190
|
+
"describe": "<p>What are the most important items in your npm package.json file if you plan to publish a package? Choose 2 answers.</p>",
|
191
|
+
"answerOptions": [
|
192
|
+
{
|
193
|
+
"describe": "<p>Author</p>",
|
194
|
+
"isRight": false
|
195
|
+
},
|
196
|
+
{
|
197
|
+
"describe": "<p>Version</p>",
|
198
|
+
"isRight": true
|
199
|
+
},
|
200
|
+
{
|
201
|
+
"describe": "<p>Name</p>",
|
202
|
+
"isRight": true
|
203
|
+
},
|
204
|
+
{
|
205
|
+
"describe": "<p>Description</p>",
|
206
|
+
"isRight": false
|
207
|
+
}
|
208
|
+
],
|
209
|
+
"analysis": "<p>The name and version are required if you plan to publish your package. These two together will form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version.</p><p>If you don’t plan to publish your package, the name and version fields are optional.</p>",
|
210
|
+
"hashCode": 1719156876
|
211
|
+
},
|
212
|
+
{
|
213
|
+
"describe": "<p>Refer to this code below:</p><p>const https = require('https');</p><p>const server = https.createServer((req, res) => {</p><p>req.on('get', (chunk) => {</p><p>let reqData = JSON.parse(chunk);</p><p>console.log(reqData);</p><p>});</p><p>res.end('OK');</p><p>});</p><p>server.listen(8000);</p><p>However, the code is running as intended. As a developer, how can you fix the code to receive incoming request data?</p><p></p>",
|
214
|
+
"answerOptions": [
|
215
|
+
{
|
216
|
+
"describe": "<p>Replace</p><p>req.on('get', (chunk) => {</p><p>from line 3 with</p><p>req.on('data', (chunk) => {</p><p>.</p>",
|
217
|
+
"isRight": true
|
218
|
+
},
|
219
|
+
{
|
220
|
+
"describe": "<p>Replace</p><p>req.on('get', (chunk) => {</p><p>from line 3 with</p><p>req.get((chunk) => {</p><p>.</p>",
|
221
|
+
"isRight": false
|
222
|
+
},
|
223
|
+
{
|
224
|
+
"describe": "<p>There is nothing wrong with the code.</p>",
|
225
|
+
"isRight": false
|
226
|
+
},
|
227
|
+
{
|
228
|
+
"describe": "<p>Replace</p><p>req.on('get', (chunk) => {</p><p>from line 3 with</p><p>req.data((chunk) => {</p><p>.</p>",
|
229
|
+
"isRight": false
|
230
|
+
}
|
231
|
+
],
|
232
|
+
"analysis": "<p>The following code snippet shows the correct way of setting up server and receive incoming request data:</p><p>const https = require('https');</p><p>const server = https.createServer((req, res) => {</p><p>req.on('data', (chunk) => {</p><p>let reqData = JSON.parse(chunk);</p><p>console.log(reqData);</p><p>});</p><p>res.end('OK');</p><p>});</p><p>server.listen(8000);</p>",
|
233
|
+
"hashCode": 1528369872
|
234
|
+
},
|
235
|
+
{
|
236
|
+
"describe": "<p>What is the advantage of using Node.js? Choose 3 answers.</p>",
|
237
|
+
"answerOptions": [
|
238
|
+
{
|
239
|
+
"describe": "<p>Open Source</p>",
|
240
|
+
"isRight": true
|
241
|
+
},
|
242
|
+
{
|
243
|
+
"describe": "<p>Maintained by big companies like Facebook, Google, etc.</p>",
|
244
|
+
"isRight": false
|
245
|
+
},
|
246
|
+
{
|
247
|
+
"describe": "<p>Non-blocking</p>",
|
248
|
+
"isRight": true
|
249
|
+
},
|
250
|
+
{
|
251
|
+
"describe": "<p>Multi-threaded</p>",
|
252
|
+
"isRight": false
|
253
|
+
},
|
254
|
+
{
|
255
|
+
"describe": "<p>Asynchronous</p>",
|
256
|
+
"isRight": true
|
257
|
+
}
|
258
|
+
],
|
259
|
+
"analysis": "<p>Node.js is an open-source, cross-platform, JavaScript runtime environment (Framework) that executes JavaScript code outside a web browser.</p><p>Node.js has an event-driven architecture capable of asynchronous I/O.</p><p>Non-blocking I/O operations allow a single process to serve multiple requests at the same time and provide a callback function that is called when the operation is completed.</p><p>Node.js is not a multi-threaded JavaScript runtime environment. By nature, JavaScript is single-threaded. The event loop is what allows Node.js to perform non-blocking I/O operations.</p><p>Unlike Angular or React, Node.js is not maintained by big companies like Google or Facebook.</p>",
|
260
|
+
"hashCode": 1736283776
|
261
|
+
},
|
262
|
+
{
|
263
|
+
"describe": "<p>What are the two main properties of an error object that’s passed as an argument to catch in a try…catch construct?</p><p></p>",
|
264
|
+
"answerOptions": [
|
265
|
+
{
|
266
|
+
"describe": "<p>name and message</p>",
|
267
|
+
"isRight": true
|
268
|
+
},
|
269
|
+
{
|
270
|
+
"describe": "<p>title and stack</p>",
|
271
|
+
"isRight": false
|
272
|
+
},
|
273
|
+
{
|
274
|
+
"describe": "<p>title and message</p>",
|
275
|
+
"isRight": false
|
276
|
+
},
|
277
|
+
{
|
278
|
+
"describe": "<p>name and stacktrace</p>",
|
279
|
+
"isRight": false
|
280
|
+
}
|
281
|
+
],
|
282
|
+
"analysis": "<p>The main properties of an error object are:</p><p>message</p><p>name</p><p>The error object does not have a title property or stacktrace property. Stack is a non-standard Mozilla property for a stack trace.</p>",
|
283
|
+
"hashCode": -1005089821
|
284
|
+
},
|
285
|
+
{
|
286
|
+
"describe": "<p>Here is the package.json for the bar.awesome module:</p><p>{</p><p>\"name\": \"bar.awesome\",</p><p>\"version\": \"1.3.5\",</p><p>\"peerDependencies\": {</p><p>\"baz\": \"5.x\"</p><p>}</p><p>}</p><p>A particular project has the package.json definition below.</p><p>{</p><p>\"name\": \"UC Project Extra\",</p><p>\"version\": \"0.0.5\",</p><p>\"dependencies\": {</p><p>\"bar.awesome\": \"1.3.5\",</p><p>\"baz\": \"6.0.0\"</p><p>}</p><p>}</p><p>What happens when a developer executes npm install? Choose 1 answer.</p><p></p>",
|
287
|
+
"answerOptions": [
|
288
|
+
{
|
289
|
+
"describe": "<p>The command fails because bar versions are not compatible.</p>",
|
290
|
+
"isRight": false
|
291
|
+
},
|
292
|
+
{
|
293
|
+
"describe": "<p>The command fails because bar.awesome does not have any dependency.</p>",
|
294
|
+
"isRight": false
|
295
|
+
},
|
296
|
+
{
|
297
|
+
"describe": "<p>The command succeeds with no errors or warnings.</p>",
|
298
|
+
"isRight": false
|
299
|
+
},
|
300
|
+
{
|
301
|
+
"describe": "<p>The command succeeds but displays a warning about a version mismatch.</p>",
|
302
|
+
"isRight": true
|
303
|
+
}
|
304
|
+
],
|
305
|
+
"analysis": "<p>The correct answer is that the command will succeed but will display a warning about a version mismatch (5.x does not match with 6.0.0).</p><p>bar.awesome has a dependency on baz, hence the statement saying bar.awesome does not have any dependency is wrong.</p><p>The bar versions are compatible, but the baz versions are not.</p><p>The command does succeed, however, there is a warning for the mismatched baz dependency.</p>",
|
306
|
+
"hashCode": 1976764585
|
307
|
+
},
|
308
|
+
{
|
309
|
+
"describe": "<p>A developer has a web server running with Node.js. The command to start the web server is node server. js. The web server started having latency issues. Instead of a one second turnaround for web requests, the developer now sees a five second turnaround.Which command can the web developer run to see what the module is doing during the latency period?</p><p></p>",
|
310
|
+
"answerOptions": [
|
311
|
+
{
|
312
|
+
"describe": "<p>NODE_DEBUG=true node server.js</p>",
|
313
|
+
"isRight": false
|
314
|
+
},
|
315
|
+
{
|
316
|
+
"describe": "<p>NODE_DBBUG=http, https node server.js</p>",
|
317
|
+
"isRight": true
|
318
|
+
},
|
319
|
+
{
|
320
|
+
"describe": "<p>DEBUG=http, https node server. js</p>",
|
321
|
+
"isRight": false
|
322
|
+
},
|
323
|
+
{
|
324
|
+
"describe": "<p>DEBUG=true node server. js</p>",
|
325
|
+
"isRight": false
|
326
|
+
}
|
327
|
+
],
|
328
|
+
"analysis": "<p>NODE_DEBUG enables debugging messages using the Node.js util.debuglog</p>",
|
329
|
+
"hashCode": -1341637357
|
330
|
+
},
|
331
|
+
{
|
332
|
+
"describe": "<p>Which option is true about the strict mode in imported modules?</p><p></p>",
|
333
|
+
"answerOptions": [
|
334
|
+
{
|
335
|
+
"describe": "<p>You can only reference notStrict ( ) functions from the imported module.</p>",
|
336
|
+
"isRight": false
|
337
|
+
},
|
338
|
+
{
|
339
|
+
"describe": "<p>Imported modules are in strict mode whether you declare them as such or not.</p>",
|
340
|
+
"isRight": true
|
341
|
+
},
|
342
|
+
{
|
343
|
+
"describe": "<p>Add the statement use non-strict; before any other statements in the module to enable not-strict mode.</p>",
|
344
|
+
"isRight": false
|
345
|
+
},
|
346
|
+
{
|
347
|
+
"describe": "<p>Add the statement use strict-false; before any other statements in the module to enable not- strict mode.</p>",
|
348
|
+
"isRight": false
|
349
|
+
}
|
350
|
+
],
|
351
|
+
"analysis": "<p>Imported modules are in strict mode whether you declare them as such or not. The import statement cannot be used in embedded scripts unless a script has a type=”module”.</p><p>ECMAScript 2015 introduced JavaScript modules and therefore a 3rd way to enter strict mode. The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.</p><p>https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode</p>",
|
352
|
+
"hashCode": -807688859
|
353
|
+
},
|
354
|
+
{
|
355
|
+
"describe": "<p>A developer creates a new web server that uses Node.js. It imports a server library that uses events and callbacks for handling server functionality.</p><p>The server library is imported with require and is made available to the code by a variable named server. The developer wants to log any issues that the server has while booting up.</p><p>Given the code and the information the developer has, which code logs an error at boot time with an event?</p><p></p>",
|
356
|
+
"answerOptions": [
|
357
|
+
{
|
358
|
+
"describe": "<p>01 server.catch((error) => {</p><p>02 console.log('ERROR', error) ;</p><p>03 });</p>",
|
359
|
+
"isRight": false
|
360
|
+
},
|
361
|
+
{
|
362
|
+
"describe": "<p>01 server.on('error', (error) => {</p><p>02 console.log('ERROR', error);</p><p>03 }) ;</p>",
|
363
|
+
"isRight": true
|
364
|
+
},
|
365
|
+
{
|
366
|
+
"describe": "<p>01 try {</p><p>02 server.start( );</p><p>03 } catch(error) {</p><p>04 console.log('ERROR', error);</p><p>05 }</p>",
|
367
|
+
"isRight": false
|
368
|
+
},
|
369
|
+
{
|
370
|
+
"describe": "<p>01 server.error(error) => {</p><p>02 console.log('ERROR', error);</p><p>03 });</p>",
|
371
|
+
"isRight": false
|
372
|
+
}
|
373
|
+
],
|
374
|
+
"analysis": "<p>https://nodejs.org/api/errors.html</p>",
|
375
|
+
"hashCode": 530949409
|
376
|
+
},
|
377
|
+
{
|
378
|
+
"describe": "<p>Refer to the following code that imports a module named Utils:</p><p>01 import {foo,bar} from '/path/Utils.js';</p><p>02 foo( ) ;</p><p>03 bar( ) ;</p><p>Which two implementations of Utils.js export foo and bar such that the code above runs without error? Choose 2 answers</p><p></p>",
|
379
|
+
"answerOptions": [
|
380
|
+
{
|
381
|
+
"describe": "<p>const foo = ( ) => { return 'foo'; }</p><p>const bar = ( ) => { return 'bar'; }</p><p>export {foo, bar}</p>",
|
382
|
+
"isRight": true
|
383
|
+
},
|
384
|
+
{
|
385
|
+
"describe": "<p>// FooUtils.js and BarUtils.js exist</p><p>import {foo} from '/path/FoUtils.js';</p><p>import {bar} from '/path/BarUtils.js';</p><p>export {foo, bar}</p>",
|
386
|
+
"isRight": true
|
387
|
+
},
|
388
|
+
{
|
389
|
+
"describe": "<p>const foo = ( ) => { return 'foo'; }</p><p>const bar = ( ) => { return 'bar'; }</p><p>export default foo, bar;</p>",
|
390
|
+
"isRight": false
|
391
|
+
},
|
392
|
+
{
|
393
|
+
"describe": "<p>export default class {</p><p>foo( ) { return 'foo'; }</p><p>bar( ) { return 'bar'; }</p><p>}</p>",
|
394
|
+
"isRight": false
|
395
|
+
}
|
396
|
+
],
|
397
|
+
"analysis": "",
|
398
|
+
"hashCode": 108470164
|
399
|
+
},
|
400
|
+
{
|
401
|
+
"describe": "<p>Teams at Universal Containers (UC) work on multiple JavaScript projects at the same time. UC is thinking about reusability and how each team can benefit from the work of others.</p><p>Going open-source or public is not an option at this time.</p><p>Which option is available to UC with npm?</p><p></p>",
|
402
|
+
"answerOptions": [
|
403
|
+
{
|
404
|
+
"describe": "<p>Private registries are not supported by npm, but packages can be installed via git.</p>",
|
405
|
+
"isRight": true
|
406
|
+
},
|
407
|
+
{
|
408
|
+
"describe": "<p>Private packages are not supported, but they can use another package manager like yarn.</p>",
|
409
|
+
"isRight": false
|
410
|
+
},
|
411
|
+
{
|
412
|
+
"describe": "<p>Private packages can be scoped, and scopes can be assciated to a private registries.</p>",
|
413
|
+
"isRight": false
|
414
|
+
},
|
415
|
+
{
|
416
|
+
"describe": "<p>Pritate registries are not supported by npm, but packages can be installed via URL.</p>",
|
417
|
+
"isRight": false
|
418
|
+
}
|
419
|
+
],
|
420
|
+
"analysis": "<p>With npm private packages, you can use the npm registry to host code that is only visible to you and chosen collaborators, allowing you to manage and use private code alongside public code in your projects.</p><p>Private packages always have a scope, and scoped packages are private by default.</p>",
|
421
|
+
"hashCode": -1696735636
|
422
|
+
},
|
423
|
+
{
|
424
|
+
"describe": "<p>A developer is trying to convince management that their team will benefit from using Node.js for a backend server that they are going to create. The server will be a web server that handles API requests from a website that the team has already built using HTML, CSS, and JavaScript. Which three benefits of Node.js can the developer use to persuade their manager? Choose 3 answers</p>",
|
425
|
+
"answerOptions": [
|
426
|
+
{
|
427
|
+
"describe": "<p>Ensures stability with one major release every few years.</p>",
|
428
|
+
"isRight": false
|
429
|
+
},
|
430
|
+
{
|
431
|
+
"describe": "<p>Performs a static analysis on code before execution to look for runtime errors.</p>",
|
432
|
+
"isRight": false
|
433
|
+
},
|
434
|
+
{
|
435
|
+
"describe": "<p>Executes server-side JavaScript code to avoid learning a new language.</p>",
|
436
|
+
"isRight": true
|
437
|
+
},
|
438
|
+
{
|
439
|
+
"describe": "<p>Uses non-blocking functionality for performant request handling.</p>",
|
440
|
+
"isRight": true
|
441
|
+
},
|
442
|
+
{
|
443
|
+
"describe": "<p>Installs with its own package manager to install and manage third-party libraries.</p>",
|
444
|
+
"isRight": true
|
445
|
+
}
|
446
|
+
],
|
447
|
+
"analysis": "<p>Static code analysis is a method of debugging by examining source code before a program is run. It's done by analyzing a set of code against a set (or multiple sets) of coding rules.</p>",
|
448
|
+
"hashCode": -1722592550
|
449
|
+
},
|
450
|
+
{
|
451
|
+
"describe": "<p>Which option is a core Node.js module?</p><p></p>",
|
452
|
+
"answerOptions": [
|
453
|
+
{
|
454
|
+
"describe": "<p>ios</p>",
|
455
|
+
"isRight": false
|
456
|
+
},
|
457
|
+
{
|
458
|
+
"describe": "<p>path</p>",
|
459
|
+
"isRight": true
|
460
|
+
},
|
461
|
+
{
|
462
|
+
"describe": "<p>locale</p>",
|
463
|
+
"isRight": false
|
464
|
+
},
|
465
|
+
{
|
466
|
+
"describe": "<p>memory</p>",
|
467
|
+
"isRight": false
|
468
|
+
}
|
469
|
+
],
|
470
|
+
"analysis": "<p>some common used core node modules: fs, http, https, path, url</p>",
|
471
|
+
"hashCode": 72486486
|
472
|
+
},
|
473
|
+
{
|
474
|
+
"describe": "<p>A developer publishes a new version of a package with bug fixes but no breaking changes. The old version number was 2.1.1. What should the new package version number be based on semantic versioning?</p><p></p>",
|
475
|
+
"answerOptions": [
|
476
|
+
{
|
477
|
+
"describe": "<p>2.1.2</p>",
|
478
|
+
"isRight": true
|
479
|
+
},
|
480
|
+
{
|
481
|
+
"describe": "<p>2.2.0</p>",
|
482
|
+
"isRight": false
|
483
|
+
},
|
484
|
+
{
|
485
|
+
"describe": "<p>2.2.1</p>",
|
486
|
+
"isRight": false
|
487
|
+
},
|
488
|
+
{
|
489
|
+
"describe": "<p>3.1.1</p>",
|
490
|
+
"isRight": false
|
491
|
+
}
|
492
|
+
],
|
493
|
+
"analysis": "<p>Patch release</p>",
|
494
|
+
"hashCode": -177784441
|
495
|
+
},
|
496
|
+
{
|
497
|
+
"describe": "<p>A developer wants to set up a web server that handles HTTP/2 with Node.js. The developer created a directory locally called app-server, and the first file added is index.js (at app-server/index.js). Without using any third-party libraries, what should the developer add to line 1 of index.js?</p><p></p>",
|
498
|
+
"answerOptions": [
|
499
|
+
{
|
500
|
+
"describe": "<p>const https = require('http2');</p>",
|
501
|
+
"isRight": true
|
502
|
+
},
|
503
|
+
{
|
504
|
+
"describe": "<p>const server = require('http-2');</p>",
|
505
|
+
"isRight": false
|
506
|
+
},
|
507
|
+
{
|
508
|
+
"describe": "<p>const tls = require('tls');</p>",
|
509
|
+
"isRight": false
|
510
|
+
},
|
511
|
+
{
|
512
|
+
"describe": "<p>const https = require('https');</p>",
|
513
|
+
"isRight": false
|
514
|
+
}
|
515
|
+
],
|
516
|
+
"analysis": "",
|
517
|
+
"hashCode": 1223870664
|
518
|
+
},
|
519
|
+
{
|
520
|
+
"describe": "<p>A developer has an ErrorHandler module that contains multiple functions. What kind of export should be leveraged so that multiple functions can be used?</p><p></p>",
|
521
|
+
"answerOptions": [
|
522
|
+
{
|
523
|
+
"describe": "<p>default</p>",
|
524
|
+
"isRight": false
|
525
|
+
},
|
526
|
+
{
|
527
|
+
"describe": "<p>named</p>",
|
528
|
+
"isRight": true
|
529
|
+
},
|
530
|
+
{
|
531
|
+
"describe": "<p>all</p>",
|
532
|
+
"isRight": false
|
533
|
+
},
|
534
|
+
{
|
535
|
+
"describe": "<p>multi</p>",
|
536
|
+
"isRight": false
|
537
|
+
}
|
538
|
+
],
|
539
|
+
"analysis": "",
|
540
|
+
"hashCode": -431566820
|
541
|
+
},
|
542
|
+
{
|
543
|
+
"describe": "<p>A team that works on a big project uses npm to deal with the project's dependencies.</p>",
|
544
|
+
"answerOptions": [
|
545
|
+
{
|
546
|
+
"describe": "<p>developer added a dependency to manipulate dates and pushed the updates to the remote repository. The rest of the team complains that the dependency does not get downloaded when they execute npm install. Which two reasons could be possible explanations for this? Choose 2 answers</p><p>A The developer missed the option --add when adding the dependency.</p>",
|
547
|
+
"isRight": false
|
548
|
+
},
|
549
|
+
{
|
550
|
+
"describe": "<p>The developer missed the option --save when adding the dependency.</p>",
|
551
|
+
"isRight": true
|
552
|
+
},
|
553
|
+
{
|
554
|
+
"describe": "<p>The developer added the dependency as a dev dependency, and NPM_ENV is set to production.</p>",
|
555
|
+
"isRight": false
|
556
|
+
},
|
557
|
+
{
|
558
|
+
"describe": "<p>The developer added the dependency as a dev dependency, and NODE_ENV is set to production.</p>",
|
559
|
+
"isRight": true
|
560
|
+
}
|
561
|
+
],
|
562
|
+
"analysis": "",
|
563
|
+
"hashCode": -1275574661
|
564
|
+
},
|
565
|
+
{
|
566
|
+
"describe": "<p>Refer to the code below:</p><p>01 const server = require('server');</p><p>02</p><p>03 //Insert code here</p><p>A developer imports a library that creates a web server. The imported library uses events and callbacks to start the server.</p><p>Which code should be inserted at line 03 to set up an event and start the web server?</p><p></p>",
|
567
|
+
"answerOptions": [
|
568
|
+
{
|
569
|
+
"describe": "<p>server( );</p>",
|
570
|
+
"isRight": false
|
571
|
+
},
|
572
|
+
{
|
573
|
+
"describe": "<p>server.start( );</p>",
|
574
|
+
"isRight": false
|
575
|
+
},
|
576
|
+
{
|
577
|
+
"describe": "<p>server.on('connect', (port) => {</p><p>console.log('Listening on', port);</p><p>});</p>",
|
578
|
+
"isRight": true
|
579
|
+
},
|
580
|
+
{
|
581
|
+
"describe": "<p>server(port) => {</p><p>console.log('Listening on', port);</p><p>});</p>",
|
582
|
+
"isRight": false
|
583
|
+
}
|
584
|
+
],
|
585
|
+
"analysis": "",
|
586
|
+
"hashCode": 1106298462
|
587
|
+
},
|
588
|
+
{
|
589
|
+
"describe": "<p>Which two options are core Node.js modules?</p><p></p>",
|
590
|
+
"answerOptions": [
|
591
|
+
{
|
592
|
+
"describe": "<p>iostream</p>",
|
593
|
+
"isRight": false
|
594
|
+
},
|
595
|
+
{
|
596
|
+
"describe": "<p>worker</p>",
|
597
|
+
"isRight": true
|
598
|
+
},
|
599
|
+
{
|
600
|
+
"describe": "<p>http</p>",
|
601
|
+
"isRight": true
|
602
|
+
},
|
603
|
+
{
|
604
|
+
"describe": "<p>exception</p>",
|
605
|
+
"isRight": false
|
606
|
+
}
|
607
|
+
],
|
608
|
+
"analysis": "",
|
609
|
+
"hashCode": 1498065227
|
610
|
+
}
|
611
|
+
],
|
612
|
+
"hashCode": -87576049
|
613
|
+
}
|