@palerock/exam-qa 1.0.6-patch17 → 1.0.6-patch19
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/static/js/manifest.3ad1d5771e9b13dbdad2.js.map +1 -1
- 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" +20 -20
- package/lib-json/[JS]/347/254/254/344/270/203/347/253/240 /346/265/213/350/257/225.json" +9 -9
- 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" +28 -28
- 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" +46 -46
- 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" +30 -30
- 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" +17 -17
- 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" +8 -8
- 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 +8 -3
- package/package.json +1 -1
@@ -118,7 +118,7 @@
|
|
118
118
|
"hashCode": 2020446662
|
119
119
|
},
|
120
120
|
{
|
121
|
-
"describe": "<p>Refer to the code below:</p><p>01 const resolveAfterMilliseconds = (ms)
|
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
122
|
"answerOptions": [
|
123
123
|
{
|
124
124
|
"describe": "<p>Only aPromise runs.</p>",
|
@@ -144,19 +144,19 @@
|
|
144
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
145
|
"answerOptions": [
|
146
146
|
{
|
147
|
-
"describe": "<p>04 ws.on('connect', ( )
|
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
148
|
"isRight": false
|
149
149
|
},
|
150
150
|
{
|
151
|
-
"describe": "<p>04 ws.on('connect', ( )
|
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
152
|
"isRight": true
|
153
153
|
},
|
154
154
|
{
|
155
|
-
"describe": "<p>04 try {</p><p>05 ws.connect ( ( )
|
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
156
|
"isRight": false
|
157
157
|
},
|
158
158
|
{
|
159
|
-
"describe": "<p>04 ws.connect(( )
|
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
160
|
"isRight": false
|
161
161
|
}
|
162
162
|
],
|
@@ -210,14 +210,14 @@
|
|
210
210
|
"hashCode": 1719156876
|
211
211
|
},
|
212
212
|
{
|
213
|
-
"describe": "<p>Refer to this code below:</p><p>const https = require('https');</p><p>const server = https.createServer((req, res)
|
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
214
|
"answerOptions": [
|
215
215
|
{
|
216
|
-
"describe": "<p>Replace</p><p>req.on('get', (chunk)
|
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
217
|
"isRight": true
|
218
218
|
},
|
219
219
|
{
|
220
|
-
"describe": "<p>Replace</p><p>req.on('get', (chunk)
|
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
221
|
"isRight": false
|
222
222
|
},
|
223
223
|
{
|
@@ -225,11 +225,11 @@
|
|
225
225
|
"isRight": false
|
226
226
|
},
|
227
227
|
{
|
228
|
-
"describe": "<p>Replace</p><p>req.on('get', (chunk)
|
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
229
|
"isRight": false
|
230
230
|
}
|
231
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)
|
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
233
|
"hashCode": 1528369872
|
234
234
|
},
|
235
235
|
{
|
@@ -355,11 +355,11 @@
|
|
355
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
356
|
"answerOptions": [
|
357
357
|
{
|
358
|
-
"describe": "<p>01 server.catch((error)
|
358
|
+
"describe": "<p>01 server.catch((error) => {</p><p>02 console.log('ERROR', error) ;</p><p>03 });</p>",
|
359
359
|
"isRight": false
|
360
360
|
},
|
361
361
|
{
|
362
|
-
"describe": "<p>01 server.on('error', (error)
|
362
|
+
"describe": "<p>01 server.on('error', (error) => {</p><p>02 console.log('ERROR', error);</p><p>03 }) ;</p>",
|
363
363
|
"isRight": true
|
364
364
|
},
|
365
365
|
{
|
@@ -367,7 +367,7 @@
|
|
367
367
|
"isRight": false
|
368
368
|
},
|
369
369
|
{
|
370
|
-
"describe": "<p>01 server.error(error)
|
370
|
+
"describe": "<p>01 server.error(error) => {</p><p>02 console.log('ERROR', error);</p><p>03 });</p>",
|
371
371
|
"isRight": false
|
372
372
|
}
|
373
373
|
],
|
@@ -378,7 +378,7 @@
|
|
378
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
379
|
"answerOptions": [
|
380
380
|
{
|
381
|
-
"describe": "<p>const foo = ( )
|
381
|
+
"describe": "<p>const foo = ( ) => { return 'foo'; }</p><p>const bar = ( ) => { return 'bar'; }</p><p>export {foo, bar}</p>",
|
382
382
|
"isRight": true
|
383
383
|
},
|
384
384
|
{
|
@@ -386,7 +386,7 @@
|
|
386
386
|
"isRight": true
|
387
387
|
},
|
388
388
|
{
|
389
|
-
"describe": "<p>const foo = ( )
|
389
|
+
"describe": "<p>const foo = ( ) => { return 'foo'; }</p><p>const bar = ( ) => { return 'bar'; }</p><p>export default foo, bar;</p>",
|
390
390
|
"isRight": false
|
391
391
|
},
|
392
392
|
{
|
@@ -574,11 +574,11 @@
|
|
574
574
|
"isRight": false
|
575
575
|
},
|
576
576
|
{
|
577
|
-
"describe": "<p>server.on('connect', (port)
|
577
|
+
"describe": "<p>server.on('connect', (port) => {</p><p>console.log('Listening on', port);</p><p>});</p>",
|
578
578
|
"isRight": true
|
579
579
|
},
|
580
580
|
{
|
581
|
-
"describe": "<p>server(port)
|
581
|
+
"describe": "<p>server(port) => {</p><p>console.log('Listening on', port);</p><p>});</p>",
|
582
582
|
"isRight": false
|
583
583
|
}
|
584
584
|
],
|
@@ -26,7 +26,7 @@
|
|
26
26
|
"hashCode": -54695334
|
27
27
|
},
|
28
28
|
{
|
29
|
-
"describe": "<p>A developer needs to test this function:</p><p>01 const sum3 = (arr)
|
29
|
+
"describe": "<p>A developer needs to test this function:</p><p>01 const sum3 = (arr) => {</p><p>02 if (! arr.length) return 0;</p><p>03 if( arr.length === 1) return arr[0];</p><p>04 if(arr.length ===2) return arr[0] + arr[1];</p><p>05 return arr[0] + arr[1] + arr[2];</p><p>06 };</p><p>Which two assert statements are valid tests for this function?</p><p>Choose 2 answers</p>",
|
30
30
|
"answerOptions": [
|
31
31
|
{
|
32
32
|
"describe": "<p>console.assert(sum3( [0] )===0);</p>",
|
@@ -141,7 +141,7 @@
|
|
141
141
|
"hashCode": 566394768
|
142
142
|
},
|
143
143
|
{
|
144
|
-
"describe": "<p>Refer to the code below:</p><p>for (let number = 2; number
|
144
|
+
"describe": "<p>Refer to the code below:</p><p>for (let number = 2; number <= 5; number += 1){</p><p>// Insert code statement here</p><p>}</p><p>The developer needs to insert a code statement in the location shown. The code statement has these requirements:</p><p>1 - Does not require an import</p><p>2 - Logs an error when the Boolean statement evaluates to false</p><p>3 - Works in both the browser and Node.js</p><p>Which statement meets these requirements?</p>",
|
145
145
|
"answerOptions": [
|
146
146
|
{
|
147
147
|
"describe": "<p>assert (number % 2 === 0) ;</p>",
|
@@ -337,22 +337,22 @@
|
|
337
337
|
"hashCode": 661463567
|
338
338
|
},
|
339
339
|
{
|
340
|
-
"describe": "<p>Refer to the code below:</p><p>01 let requestPromise = client.getRequest;</p><p>02</p><p>03 requestPromise( ).then((response)
|
340
|
+
"describe": "<p>Refer to the code below:</p><p>01 let requestPromise = client.getRequest;</p><p>02</p><p>03 requestPromise( ).then((response) => {</p><p>04 handleResponse(response);</p><p>05 });</p><p>A developer uses a client that makes a GET request that uses a Promise to handle the request. client.getRequest returns a Promise. Which code lines can the developer change to ensure the function nextStep gets called if an error occurs?</p><p></p>",
|
341
341
|
"answerOptions": [
|
342
342
|
{
|
343
|
-
"describe": "<p>05 }) .finally( ( )
|
343
|
+
"describe": "<p>05 }) .finally( ( ) => {</p><p>06 nextStep( );</p><p>07 });</p>",
|
344
344
|
"isRight": false
|
345
345
|
},
|
346
346
|
{
|
347
|
-
"describe": "<p>03 try{</p><p>04 requestPromise( ).then((response)
|
347
|
+
"describe": "<p>03 try{</p><p>04 requestPromise( ).then((response) => {</p><p>05 handleResponse(response);</p><p>06 });</p><p>07 } catch() {</p><p>08 nextStep();</p><p>09 }</p>",
|
348
348
|
"isRight": false
|
349
349
|
},
|
350
350
|
{
|
351
|
-
"describe": "<p>05 }).catch( ( )
|
351
|
+
"describe": "<p>05 }).catch( ( ) => {</p><p>06 nextStep();</p><p>07 });</p>",
|
352
352
|
"isRight": true
|
353
353
|
},
|
354
354
|
{
|
355
|
-
"describe": "<p>03 requestPromise( ).then( (response)
|
355
|
+
"describe": "<p>03 requestPromise( ).then( (response) => {</p><p>04 handleResponse(response);</p><p>05 }).then(() => {</p><p>06 nextStep();</p><p>07});</p>",
|
356
356
|
"isRight": false
|
357
357
|
}
|
358
358
|
],
|
@@ -429,7 +429,7 @@
|
|
429
429
|
"hashCode": 2001090074
|
430
430
|
},
|
431
431
|
{
|
432
|
-
"describe": "<p>A developer needs to test this function:</p><p>01 const sum3 = (arr)
|
432
|
+
"describe": "<p>A developer needs to test this function:</p><p>01 const sum3 = (arr) => {</p><p>02 if (! arr.length) return 0;</p><p>03 if( arr.length === 1) return arr[0];</p><p>04 if(arr.length ===2) return arr[0] + arr[1];</p><p>05 return arr[0] + arr[1] + arr[2];</p><p>06 };</p><p>Which two assert statements are valid tests for this function? Choose 2 answers</p><p></p>",
|
433
433
|
"answerOptions": [
|
434
434
|
{
|
435
435
|
"describe": "<p>console.assert(sum3( [0] )===0);</p>",
|