@palerock/exam-qa 1.0.6-patch18 → 1.0.6-patch19

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.
@@ -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) => 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>",
121
+ "describe": "<p>Refer to the code below:</p><p>01 const resolveAfterMilliseconds = (ms) =&gt; Promise.resolve(</p><p>02 setTimeout(( ) =&gt; 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', ( ) => {</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>",
147
+ "describe": "<p>04 ws.on('connect', ( ) =&gt; {</p><p>05 console.log ('Connected to client') ;</p><p>06</p><p>07 ws.on('error', (error) =&gt; {</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', ( ) => {</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>",
151
+ "describe": "<p>04 ws.on('connect', ( ) =&gt; {</p><p>05 console. log( 'Connected to client') ;</p><p>06 });</p><p>07</p><p>08 ws.on('error', (error) =&gt; {</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 ( ( ) => {</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>",
155
+ "describe": "<p>04 try {</p><p>05 ws.connect ( ( ) =&gt; {</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(( ) => {</p><p>05 conole.log('Conneted to ellent');06 }).catch((error) => {</p><p>07 console. log('ERROR',error) ;</p><p>08 });</p>",
159
+ "describe": "<p>04 ws.connect(( ) =&gt; {</p><p>05 conole.log('Conneted to ellent');06 }).catch((error) =&gt; {</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) => {</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>",
213
+ "describe": "<p>Refer to this code below:</p><p>const https = require('https');</p><p>const server = https.createServer((req, res) =&gt; {</p><p>req.on('get', (chunk) =&gt; {</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) => {</p><p>from line 3 with</p><p>req.on('data', (chunk) => {</p><p>.</p>",
216
+ "describe": "<p>Replace</p><p>req.on('get', (chunk) =&gt; {</p><p>from line 3 with</p><p>req.on('data', (chunk) =&gt; {</p><p>.</p>",
217
217
  "isRight": true
218
218
  },
219
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>",
220
+ "describe": "<p>Replace</p><p>req.on('get', (chunk) =&gt; {</p><p>from line 3 with</p><p>req.get((chunk) =&gt; {</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) => {</p><p>from line 3 with</p><p>req.data((chunk) => {</p><p>.</p>",
228
+ "describe": "<p>Replace</p><p>req.on('get', (chunk) =&gt; {</p><p>from line 3 with</p><p>req.data((chunk) =&gt; {</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) => {</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>",
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) =&gt; {</p><p>req.on('data', (chunk) =&gt; {</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) => {</p><p>02 console.log('ERROR', error) ;</p><p>03 });</p>",
358
+ "describe": "<p>01 server.catch((error) =&gt; {</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) => {</p><p>02 console.log('ERROR', error);</p><p>03 }) ;</p>",
362
+ "describe": "<p>01 server.on('error', (error) =&gt; {</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) => {</p><p>02 console.log('ERROR', error);</p><p>03 });</p>",
370
+ "describe": "<p>01 server.error(error) =&gt; {</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 = ( ) => { return 'foo'; }</p><p>const bar = ( ) => { return 'bar'; }</p><p>export {foo, bar}</p>",
381
+ "describe": "<p>const foo = ( ) =&gt; { return 'foo'; }</p><p>const bar = ( ) =&gt; { 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 = ( ) => { return 'foo'; }</p><p>const bar = ( ) => { return 'bar'; }</p><p>export default foo, bar;</p>",
389
+ "describe": "<p>const foo = ( ) =&gt; { return 'foo'; }</p><p>const bar = ( ) =&gt; { 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) => {</p><p>console.log('Listening on', port);</p><p>});</p>",
577
+ "describe": "<p>server.on('connect', (port) =&gt; {</p><p>console.log('Listening on', port);</p><p>});</p>",
578
578
  "isRight": true
579
579
  },
580
580
  {
581
- "describe": "<p>server(port) => {</p><p>console.log('Listening on', port);</p><p>});</p>",
581
+ "describe": "<p>server(port) =&gt; {</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) => {</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>",
29
+ "describe": "<p>A developer needs to test this function:</p><p>01 const sum3 = (arr) =&gt; {</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 <= 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>",
144
+ "describe": "<p>Refer to the code below:</p><p>for (let number = 2; number &lt;= 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) => {</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>",
340
+ "describe": "<p>Refer to the code below:</p><p>01 let requestPromise = client.getRequest;</p><p>02</p><p>03 requestPromise( ).then((response) =&gt; {</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( ( ) => {</p><p>06 nextStep( );</p><p>07 });</p>",
343
+ "describe": "<p>05 }) .finally( ( ) =&gt; {</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) => {</p><p>05 handleResponse(response);</p><p>06 });</p><p>07 } catch() {</p><p>08 nextStep();</p><p>09 }</p>",
347
+ "describe": "<p>03 try{</p><p>04 requestPromise( ).then((response) =&gt; {</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( ( ) => {</p><p>06 nextStep();</p><p>07 });</p>",
351
+ "describe": "<p>05 }).catch( ( ) =&gt; {</p><p>06 nextStep();</p><p>07 });</p>",
352
352
  "isRight": true
353
353
  },
354
354
  {
355
- "describe": "<p>03 requestPromise( ).then( (response) => {</p><p>04 handleResponse(response);</p><p>05 }).then(() => {</p><p>06 nextStep();</p><p>07});</p>",
355
+ "describe": "<p>03 requestPromise( ).then( (response) =&gt; {</p><p>04 handleResponse(response);</p><p>05 }).then(() =&gt; {</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) => {</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>",
432
+ "describe": "<p>A developer needs to test this function:</p><p>01 const sum3 = (arr) =&gt; {</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>",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palerock/exam-qa",
3
- "version": "1.0.6-patch18",
3
+ "version": "1.0.6-patch19",
4
4
  "description": "A Vue.js project",
5
5
  "author": "ryan <1184518756@qq.com>",
6
6
  "scripts": {