@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,525 @@
|
|
1
|
+
{
|
2
|
+
"title": "[JS]第四章 调试和错误处理",
|
3
|
+
"category": "JS-1",
|
4
|
+
"questions": [
|
5
|
+
{
|
6
|
+
"describe": "<p>A developer wrote the following code:</p><p>01 let x = object.value;</p><p>02</p><p>03 try {</p><p>04 handleObjectValue(x);</p><p>05 } catch (error) {</p><p>06 handleError(error);</p><p>07 }</p><p>The developer has a getNextValue function to execute after handleObjectValue( ), but does not want to execute getNextValue ( ) if an error occurs.</p><p>How can the developer change the code to ensure this behavior?</p>",
|
7
|
+
"answerOptions": [
|
8
|
+
{
|
9
|
+
"describe": "<p>03 try {</p><p>04 handleObjectValue(x);</p><p>05 } catch (error) {</p><p>06 handleError(error);</p><p>07 }</p><p>08 getNextValue( );</p>",
|
10
|
+
"isRight": false
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"describe": "<p>03 try {</p><p>04 handleObjectValue(x);</p><p>05 getNextValue( );</p><p>06 } catch (error) {</p><p>07 handleError(error);</p><p>08 }</p>",
|
14
|
+
"isRight": true
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"describe": "<p>03 try {</p><p>04 handleObjectValue(x);</p><p>05 } catch (error) {</p><p>06 handleError(error);</p><p>07 } then {</p><p>08 getNextValue( );</p><p>09 }</p>",
|
18
|
+
"isRight": false
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"describe": "<p>03 try {</p><p>04 handleObjectValue(x);</p><p>05 } catch (error) {</p><p>06 handleError(error);</p><p>07 } finally {</p><p>08 getNextValue( );</p><p>09 }</p>",
|
22
|
+
"isRight": false
|
23
|
+
}
|
24
|
+
],
|
25
|
+
"analysis": "",
|
26
|
+
"hashCode": -54695334
|
27
|
+
},
|
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>",
|
30
|
+
"answerOptions": [
|
31
|
+
{
|
32
|
+
"describe": "<p>console.assert(sum3( [0] )===0);</p>",
|
33
|
+
"isRight": true
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"describe": "<p>console.assert(sum3( [-3, 2] ) ===-1);</p>",
|
37
|
+
"isRight": true
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"describe": "<p>console.assert(sum3( ['hello', 2,3,4] ) ===NaN);</p>",
|
41
|
+
"isRight": false
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"describe": "<p>console.assert(sum3( [1, 2] ) ==12);</p>",
|
45
|
+
"isRight": false
|
46
|
+
}
|
47
|
+
],
|
48
|
+
"analysis": "<p>return false, sum3( ['hello', 2,3,4] ) return hello23</p><p>return false, sum3( [1, 2]) return 3</p>",
|
49
|
+
"hashCode": -426455060
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"describe": "<p>A developer creates a generic function to log custom messages in the console. To do this, the function below is implemented.</p><p>01 function logStatu(status) {</p><p>02 console./* Answer goes here */ ('Item Status is : %s', status);</p><p>03 }</p><p>Which three console logging methods allow the use of string substitution in line 02?</p><p>Choose 3 answers</p>",
|
53
|
+
"answerOptions": [
|
54
|
+
{
|
55
|
+
"describe": "<p>message</p>",
|
56
|
+
"isRight": false
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"describe": "<p>info</p>",
|
60
|
+
"isRight": true
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"describe": "<p>assert</p>",
|
64
|
+
"isRight": true
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"describe": "<p>log</p>",
|
68
|
+
"isRight": true
|
69
|
+
}
|
70
|
+
],
|
71
|
+
"analysis": "<p>No such a method, console.message();</p><p>console.info(), Informative logging of information. You may use string substitution and additional arguments with this method.</p><p>https://developer.mozilla.org/en-US/docs/Web/API/console/assert</p><p>console.log(), For general output of logging information. You may use string substitution and additional arguments with this method.</p>",
|
72
|
+
"hashCode": -2089401711
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"describe": "<p>A developer has the function, shown below, that is called when a page loads.</p><p>Function onLoad() {</p><p>console,log(\"Page has loaded!\");</p><p>}</p><p>Where can the developer see the log statement after loading the page in the browser?</p>",
|
76
|
+
"answerOptions": [
|
77
|
+
{
|
78
|
+
"describe": "<p>Terminal running the web server</p>",
|
79
|
+
"isRight": false
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"describe": "<p>Browser JavaScript console</p>",
|
83
|
+
"isRight": true
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"describe": "<p>Browser performance tools</p>",
|
87
|
+
"isRight": false
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"describe": "<p>On the webpage</p>",
|
91
|
+
"isRight": false
|
92
|
+
}
|
93
|
+
],
|
94
|
+
"analysis": "",
|
95
|
+
"hashCode": 804974455
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"describe": "<p>A developer is asked to fix some bugs reported by users. To do that, the developer adds a breakpoint for debugging.</p><p>01 function Car (maxSpeed, color) {</p><p>02 this.maxSpeed = maxSpeed;</p><p>03 this.color = color;</p><p>04 }</p><p>05 let carSpeed = document.getElementById('carSpeed') ;</p><p>06 debugger ;</p><p>07 let fourWheels = new Car (carSpeed.value, 'red') ;</p><p>When the code execution stops at the breakpoint on line 06, which two types of information are available in the browser console? Choose 2 answers</p>",
|
99
|
+
"answerOptions": [
|
100
|
+
{
|
101
|
+
"describe": "<p>The style, event listeners and other attributes applied to the carSpeed DOM element</p>",
|
102
|
+
"isRight": true
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"describe": "<p>The values of the carSpeed and fourWheels variables</p>",
|
106
|
+
"isRight": true
|
107
|
+
},
|
108
|
+
{
|
109
|
+
"describe": "<p>A variable displaying the number of instances created for the Car object</p>",
|
110
|
+
"isRight": false
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"describe": "<p>The information stored in the window. localStorage property</p>",
|
114
|
+
"isRight": false
|
115
|
+
}
|
116
|
+
],
|
117
|
+
"analysis": "<p>debugger will pause the function excution. In the console, we can find carSpeed has value, while fourWheels is undefined.</p>",
|
118
|
+
"hashCode": 1319146909
|
119
|
+
},
|
120
|
+
{
|
121
|
+
"describe": "<p>Refer to the code below:</p><p>01 async function functionUnderTest(isOK) {</p><p>02 if (isOK) return 'OK' ;</p><p>03 throw new Error('not OK') ;</p><p>04 }</p><p>Which assertion accurately tests the above code?</p>",
|
122
|
+
"answerOptions": [
|
123
|
+
{
|
124
|
+
"describe": "<p>console.assert (await (functionUnderTest(true), 'not OK') )</p>",
|
125
|
+
"isRight": false
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"describe": "<p>console.assert (functionUnderTest(true), 'OK')</p>",
|
129
|
+
"isRight": false
|
130
|
+
},
|
131
|
+
{
|
132
|
+
"describe": "<p>console.assert (await functionUnderTest(true), 'not OK')</p>",
|
133
|
+
"isRight": true
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"describe": "<p>console.assert (await functionUnderTest(true), 'OK')</p>",
|
137
|
+
"isRight": false
|
138
|
+
}
|
139
|
+
],
|
140
|
+
"analysis": "<p>The console.assert() method writes an error message to the console if the assertion is false. If the assertion is true, nothing happens.</p><p>check console.asset();</p><p>https://developer.mozilla.org/en-US/docs/Web/API/console/assert</p>",
|
141
|
+
"hashCode": 566394768
|
142
|
+
},
|
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>",
|
145
|
+
"answerOptions": [
|
146
|
+
{
|
147
|
+
"describe": "<p>assert (number % 2 === 0) ;</p>",
|
148
|
+
"isRight": false
|
149
|
+
},
|
150
|
+
{
|
151
|
+
"describe": "<p>console.error (number % 2 === 0) ;</p>",
|
152
|
+
"isRight": false
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"describe": "<p>console.debug (number % 2 === 0) ;</p>",
|
156
|
+
"isRight": false
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"describe": "<p>console.assert (number % 2 === 0) ;</p>",
|
160
|
+
"isRight": true
|
161
|
+
}
|
162
|
+
],
|
163
|
+
"analysis": "<p>The console.assert() method writes an error message to the console if the assertion is false. If the assertion is true, nothing happens.</p><p>https://developer.mozilla.org/en-US/docs/Web/API/console/assert</p>",
|
164
|
+
"hashCode": -988778999
|
165
|
+
},
|
166
|
+
{
|
167
|
+
"describe": "<p>As a new frontend developer at XYZ company, you have been asked to fix an issue when the function is called:</p><p>function hello(name) {</p><p>let phrase = `Hello, ${name}!`;</p><p>________; // type your code here</p><p>say(phrase);</p><p>}</p><p>What would you type in the given blank to debug the code?</p>",
|
168
|
+
"answerOptions": [
|
169
|
+
{
|
170
|
+
"describe": "<p>debug</p>",
|
171
|
+
"isRight": false
|
172
|
+
},
|
173
|
+
{
|
174
|
+
"describe": "<p>set breakpoint</p>",
|
175
|
+
"isRight": false
|
176
|
+
},
|
177
|
+
{
|
178
|
+
"describe": "<p>pause</p>",
|
179
|
+
"isRight": false
|
180
|
+
},
|
181
|
+
{
|
182
|
+
"describe": "<p>debugger</p>",
|
183
|
+
"isRight": true
|
184
|
+
}
|
185
|
+
],
|
186
|
+
"analysis": "<p>We can pause the code by using the debugger command. That’s very convenient when you are in a code editor and don’t want to switch to the browser and look up the script in developer tools to set the breakpoint.</p>",
|
187
|
+
"hashCode": -1689668624
|
188
|
+
},
|
189
|
+
{
|
190
|
+
"describe": "<p>Which of the following is a valid error type in JavaScript? Choose 3 answers</p>",
|
191
|
+
"answerOptions": [
|
192
|
+
{
|
193
|
+
"describe": "<p>ExternalError</p>",
|
194
|
+
"isRight": false
|
195
|
+
},
|
196
|
+
{
|
197
|
+
"describe": "<p>EvalError</p>",
|
198
|
+
"isRight": true
|
199
|
+
},
|
200
|
+
{
|
201
|
+
"describe": "<p>InternalError</p>",
|
202
|
+
"isRight": true
|
203
|
+
},
|
204
|
+
{
|
205
|
+
"describe": "<p>SyntaxError</p>",
|
206
|
+
"isRight": true
|
207
|
+
},
|
208
|
+
{
|
209
|
+
"describe": "<p>UnexpectedError</p>",
|
210
|
+
"isRight": false
|
211
|
+
}
|
212
|
+
],
|
213
|
+
"analysis": "<p>The following error types are valid:</p><p>EvalError – Creates an instance representing an error that occurs regarding the global function eval().</p><p>InternalError – Creates an instance representing an error that occurs when an internal error in the JavaScript engine is thrown. E.g. “too much recursion”.</p><p>SyntaxError – Creates an instance representing a syntax error.</p><p>There is no ExternalError or UnexpectedError error types in JavaScript.</p><p>Please check out the reference link below for more error types.</p>",
|
214
|
+
"hashCode": 157897039
|
215
|
+
},
|
216
|
+
{
|
217
|
+
"describe": "<p>Universal Containers (UC) just launched a new landing page, but users complain that the website is slow. A developer found some functions that might cause this problem. To verify this, the developer decides to execute everything and log the time each of these three suspicious functions consumes.</p><p>01 console. time(' Performance') ;</p><p>02</p><p>03 maybeAHeavyFunction( ) ;</p><p>04</p><p>05 thisCouldTakeTooLong( ) ;</p><p>06</p><p>07 orMaybeThisOne( ) ;</p><p>08</p><p>09 console. endTime (' Performance') ;</p><p>Which function can the developer use to obtain the time spent by one of the three functions?</p><p></p>",
|
218
|
+
"answerOptions": [
|
219
|
+
{
|
220
|
+
"describe": "<p>console.getTime ( )</p>",
|
221
|
+
"isRight": false
|
222
|
+
},
|
223
|
+
{
|
224
|
+
"describe": "<p>console.timeStamp( )</p>",
|
225
|
+
"isRight": false
|
226
|
+
},
|
227
|
+
{
|
228
|
+
"describe": "<p>console.timeLog( )</p>",
|
229
|
+
"isRight": true
|
230
|
+
},
|
231
|
+
{
|
232
|
+
"describe": "<p>console.trace ( )</p>",
|
233
|
+
"isRight": false
|
234
|
+
}
|
235
|
+
],
|
236
|
+
"analysis": "<p>https://developer.mozilla.org/en-US/docs/Web/API/Console/timeLog</p>",
|
237
|
+
"hashCode": 2135560228
|
238
|
+
},
|
239
|
+
{
|
240
|
+
"describe": "<p>A developer receives a comment from the Tech Lead that the code below gives an error.</p><p>01 const monthName = 'Ju1y' ;</p><p>02 const year = 2019;</p><p>03 if (year === 2019) {</p><p>04 monthName = 'June' ;</p><p>05 }</p><p>Which line edit should be made to make this code run?</p><p></p>",
|
241
|
+
"answerOptions": [
|
242
|
+
{
|
243
|
+
"describe": "<p>01 let monthName = 'July' ;</p>",
|
244
|
+
"isRight": true
|
245
|
+
},
|
246
|
+
{
|
247
|
+
"describe": "<p>03 if (year == 2019) {</p>",
|
248
|
+
"isRight": false
|
249
|
+
},
|
250
|
+
{
|
251
|
+
"describe": "<p>02 const year = 2020 ;</p>",
|
252
|
+
"isRight": false
|
253
|
+
},
|
254
|
+
{
|
255
|
+
"describe": "<p>02 let year = 2019 ;</p>",
|
256
|
+
"isRight": false
|
257
|
+
}
|
258
|
+
],
|
259
|
+
"analysis": "<p>const variable is immutable</p>",
|
260
|
+
"hashCode": -1985870738
|
261
|
+
},
|
262
|
+
{
|
263
|
+
"describe": "<p>A developer is trying to handle an error within a function. Which code segment shows the correct approach to handle an error without propagating it elsewhere?</p><p></p>",
|
264
|
+
"answerOptions": [
|
265
|
+
{
|
266
|
+
"describe": "<p>try {</p><p>doSomething();</p><p>} catch(error) {</p><p>throw new Error('Error found');</p><p>}</p>",
|
267
|
+
"isRight": false
|
268
|
+
},
|
269
|
+
{
|
270
|
+
"describe": "<p>try {</p><p>doSomething();</p><p>} catch(error) {</p><p>return error;</p><p>}</p>",
|
271
|
+
"isRight": false
|
272
|
+
},
|
273
|
+
{
|
274
|
+
"describe": "<p>try {</p><p>doSomething();</p><p>} catch(error) {</p><p>return null;</p><p>}</p>",
|
275
|
+
"isRight": false
|
276
|
+
},
|
277
|
+
{
|
278
|
+
"describe": "<p>try {</p><p>doSomething();</p><p>} catch(error) {</p><p>processError(error);</p><p>}</p>",
|
279
|
+
"isRight": true
|
280
|
+
}
|
281
|
+
],
|
282
|
+
"analysis": "",
|
283
|
+
"hashCode": 1904477124
|
284
|
+
},
|
285
|
+
{
|
286
|
+
"describe": "<p>A developer creates a generic function to log custom messages in the console. To do this, the function below is implemented.</p><p>01 function logStatu(status) {</p><p>02 console./* Answer goes here */ ('Item Status is : %s', status);</p><p>03 }</p><p>Which three console logging methods allow the use of string substitution in line 02?</p><p>Choose 3 answers</p>",
|
287
|
+
"answerOptions": [
|
288
|
+
{
|
289
|
+
"describe": "<p>message</p>",
|
290
|
+
"isRight": false
|
291
|
+
},
|
292
|
+
{
|
293
|
+
"describe": "<p>assert</p>",
|
294
|
+
"isRight": false
|
295
|
+
},
|
296
|
+
{
|
297
|
+
"describe": "<p>info</p>",
|
298
|
+
"isRight": true
|
299
|
+
},
|
300
|
+
{
|
301
|
+
"describe": "<p>log</p>",
|
302
|
+
"isRight": true
|
303
|
+
},
|
304
|
+
{
|
305
|
+
"describe": "<p>error</p>",
|
306
|
+
"isRight": true
|
307
|
+
}
|
308
|
+
],
|
309
|
+
"analysis": "",
|
310
|
+
"hashCode": -2089401711
|
311
|
+
},
|
312
|
+
{
|
313
|
+
"describe": "<p>A developer created a generic function to log custom messages shown in the code below.</p><p>01 function myLog(message) {</p><p>02 console./*Answer goes here*/(Custom log: ' + message);</p><p>03 }</p><p>Which three options can the developer use to log custom messages in the console? Choose 3 answers</p>",
|
314
|
+
"answerOptions": [
|
315
|
+
{
|
316
|
+
"describe": "<p>count</p>",
|
317
|
+
"isRight": false
|
318
|
+
},
|
319
|
+
{
|
320
|
+
"describe": "<p>group</p>",
|
321
|
+
"isRight": true
|
322
|
+
},
|
323
|
+
{
|
324
|
+
"describe": "<p>error</p>",
|
325
|
+
"isRight": true
|
326
|
+
},
|
327
|
+
{
|
328
|
+
"describe": "<p>trace</p>",
|
329
|
+
"isRight": false
|
330
|
+
},
|
331
|
+
{
|
332
|
+
"describe": "<p>debug</p>",
|
333
|
+
"isRight": true
|
334
|
+
}
|
335
|
+
],
|
336
|
+
"analysis": "",
|
337
|
+
"hashCode": 661463567
|
338
|
+
},
|
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>",
|
341
|
+
"answerOptions": [
|
342
|
+
{
|
343
|
+
"describe": "<p>05 }) .finally( ( ) => {</p><p>06 nextStep( );</p><p>07 });</p>",
|
344
|
+
"isRight": false
|
345
|
+
},
|
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>",
|
348
|
+
"isRight": false
|
349
|
+
},
|
350
|
+
{
|
351
|
+
"describe": "<p>05 }).catch( ( ) => {</p><p>06 nextStep();</p><p>07 });</p>",
|
352
|
+
"isRight": true
|
353
|
+
},
|
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>",
|
356
|
+
"isRight": false
|
357
|
+
}
|
358
|
+
],
|
359
|
+
"analysis": "",
|
360
|
+
"hashCode": -853486224
|
361
|
+
},
|
362
|
+
{
|
363
|
+
"describe": "<p>A developer wants to use a try…catch statement to catch any error that countSheep() may throw and pass it to a handError() function. What is the correct implementation of the try…catch?</p><p></p>",
|
364
|
+
"answerOptions": [
|
365
|
+
{
|
366
|
+
"describe": "<p>setTimeout(function() {</p><p>try {</p><p>countSheep();</p><p>} catch (e) {</p><p>handleError(e);</p><p>}</p><p>},1000);</p>",
|
367
|
+
"isRight": false
|
368
|
+
},
|
369
|
+
{
|
370
|
+
"describe": "<p>try {</p><p>countSheep();</p><p>} finally {</p><p>handleError(e);</p><p>}</p>",
|
371
|
+
"isRight": false
|
372
|
+
},
|
373
|
+
{
|
374
|
+
"describe": "<p>try {</p><p>countSheep();</p><p>} handleError (e) {</p><p>catch(e);</p><p>}</p>",
|
375
|
+
"isRight": false
|
376
|
+
},
|
377
|
+
{
|
378
|
+
"describe": "<p>try {</p><p>setTimeout(function() {</p><p>countSheep();</p><p>}, 1000);</p><p>} catch(e) {</p><p>handleError(e);</p><p>}</p>",
|
379
|
+
"isRight": true
|
380
|
+
}
|
381
|
+
],
|
382
|
+
"analysis": "",
|
383
|
+
"hashCode": 1855561702
|
384
|
+
},
|
385
|
+
{
|
386
|
+
"describe": "<p>Refer to the code below:</p><p>01 let first = 'Who';</p><p>02 let second = 'What';</p><p>03 (function() {</p><p>04 try {</p><p>05 try {</p><p>06 throw new Error('Sad trombone');</p><p>07 } catch (err) {</p><p>08 first = 'Why' ;</p><p>09 throw err;</p><p>10 } finally {</p><p>11 second = 'When' ;</p><p>12 return;</p><p>13 }</p><p>14 } catch (err) {</p><p>15 second = 'Where' ;</p><p>16 }</p><p>17 })();</p><p>What are the values for first and second once the code executes?</p><p></p>",
|
387
|
+
"answerOptions": [
|
388
|
+
{
|
389
|
+
"describe": "<p>first is Who and second is When.</p>",
|
390
|
+
"isRight": false
|
391
|
+
},
|
392
|
+
{
|
393
|
+
"describe": "<p>first is Why and second is When.</p>",
|
394
|
+
"isRight": true
|
395
|
+
},
|
396
|
+
{
|
397
|
+
"describe": "<p>first is Who and second is Where.</p>",
|
398
|
+
"isRight": false
|
399
|
+
},
|
400
|
+
{
|
401
|
+
"describe": "<p>first is Why and second is Where.</p>",
|
402
|
+
"isRight": false
|
403
|
+
}
|
404
|
+
],
|
405
|
+
"analysis": "",
|
406
|
+
"hashCode": 1085254507
|
407
|
+
},
|
408
|
+
{
|
409
|
+
"describe": "<p>A developer wrote the following code:</p><p>01 let x = object.value;</p><p>02</p><p>03 try {</p><p>04 handleObjectValue(x);</p><p>05 } catch (error) {</p><p>06 handleError(error);</p><p>07 }</p><p>The developer has a getNextValue function to execute after handleObjectValue( ), but does not want to execute getNextValue ( ) if an error occurs. How can the developer change the code to ensure this behavior?</p><p></p>",
|
410
|
+
"answerOptions": [
|
411
|
+
{
|
412
|
+
"describe": "<p>03 try {</p><p>04 handleObjectValue(x);</p><p>05 } catch (error) {</p><p>06 handleError(error);</p><p>07 }</p><p>08 getNextValue( );</p>",
|
413
|
+
"isRight": false
|
414
|
+
},
|
415
|
+
{
|
416
|
+
"describe": "<p>03 try {</p><p>04 handleObjectValue(x);</p><p>05 getNextValue( );</p><p>06 } catch (error) {</p><p>07 handleError(error);</p><p>08 }</p>",
|
417
|
+
"isRight": true
|
418
|
+
},
|
419
|
+
{
|
420
|
+
"describe": "<p>03 try {</p><p>04 handleObjectValue(x);</p><p>05 } catch (error) {</p><p>06 handleError(error);</p><p>07 } then {</p><p>08 getNextValue( );</p><p>09 }</p>",
|
421
|
+
"isRight": false
|
422
|
+
},
|
423
|
+
{
|
424
|
+
"describe": "<p>03 try {</p><p>04 handleObjectValue(x);</p><p>05 } catch (error) {</p><p>06 handleError(error);</p><p>07 } finally {</p><p>08 getNextValue( );</p><p>09 }</p>",
|
425
|
+
"isRight": false
|
426
|
+
}
|
427
|
+
],
|
428
|
+
"analysis": "<p>return false, sum3( ['hello', 2,3,4] ) return hello23</p><p>return false, sum3( [1, 2]) return 3</p>",
|
429
|
+
"hashCode": 2001090074
|
430
|
+
},
|
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>",
|
433
|
+
"answerOptions": [
|
434
|
+
{
|
435
|
+
"describe": "<p>console.assert(sum3( [0] )===0);</p>",
|
436
|
+
"isRight": true
|
437
|
+
},
|
438
|
+
{
|
439
|
+
"describe": "<p>console.assert(sum3( [-3, 2] ) ===-1);</p>",
|
440
|
+
"isRight": true
|
441
|
+
},
|
442
|
+
{
|
443
|
+
"describe": "<p>console.assert(sum3( ['hello', 2,3,4] ) ===NaN);</p>",
|
444
|
+
"isRight": false
|
445
|
+
},
|
446
|
+
{
|
447
|
+
"describe": "<p>console.assert(sum3( [1, 2] ) ==12);</p>",
|
448
|
+
"isRight": false
|
449
|
+
}
|
450
|
+
],
|
451
|
+
"analysis": "",
|
452
|
+
"hashCode": -795960248
|
453
|
+
},
|
454
|
+
{
|
455
|
+
"describe": "<p>A developer creates a generic function to log custom messages in the console. To do this, the function below is implemented.</p><p>01 function logStatu(status) {</p><p>02 console./* Answer goes here */ ('Item Status is : %s', status);</p><p>03 }</p><p>Which three console logging methods allow the use of string substitution in line 02? Choose 3 answers</p><p></p>",
|
456
|
+
"answerOptions": [
|
457
|
+
{
|
458
|
+
"describe": "<p>message</p>",
|
459
|
+
"isRight": false
|
460
|
+
},
|
461
|
+
{
|
462
|
+
"describe": "<p>info</p>",
|
463
|
+
"isRight": true
|
464
|
+
},
|
465
|
+
{
|
466
|
+
"describe": "<p>assert</p>",
|
467
|
+
"isRight": true
|
468
|
+
},
|
469
|
+
{
|
470
|
+
"describe": "<p>log</p>",
|
471
|
+
"isRight": true
|
472
|
+
}
|
473
|
+
],
|
474
|
+
"analysis": "<p>No such a method, console.message();</p><p>console.info(), Informative logging of information. You may use string substitution and additional arguments with this method.</p><p>https://developer.mozilla.org/en-US/docs/Web/API/console/assert</p><p>console.log(), For general output of logging information. You may use string substitution and additional arguments with this method.</p>",
|
475
|
+
"hashCode": -807698877
|
476
|
+
},
|
477
|
+
{
|
478
|
+
"describe": "<p>A developer has code that calculates a restaurant bill, but generates incorrect answers while testing the code.</p><p>01 function calculateBill(items) {</p><p>02 let total = 0 ;</p><p>03</p><p>04 total += findsubtotal (items) ;</p><p>05</p><p>06 total += addTax (total) ;</p><p>07 total += addTip (total) ;</p><p>08 return total ;</p><p>09 }</p><p>Which option allows the developer to step into each function execution within calculateBill?</p><p></p>",
|
479
|
+
"answerOptions": [
|
480
|
+
{
|
481
|
+
"describe": "<p>Calling the console.trace(total) method on line 03.</p>",
|
482
|
+
"isRight": true
|
483
|
+
},
|
484
|
+
{
|
485
|
+
"describe": "<p>Using the debugger command on line 03.</p>",
|
486
|
+
"isRight": false
|
487
|
+
},
|
488
|
+
{
|
489
|
+
"describe": "<p>Wrapping findSubtotal in a console.log ( ) method.</p>",
|
490
|
+
"isRight": false
|
491
|
+
},
|
492
|
+
{
|
493
|
+
"describe": "<p>Using the debugger command on line 05.</p>",
|
494
|
+
"isRight": false
|
495
|
+
}
|
496
|
+
],
|
497
|
+
"analysis": "<p>The debugger statement invokes any available debugging functionality, such as setting a breakpoint. If no debugging functionality is available, this statement has no effect.</p><p>https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger</p><p>The console interface's trace() method outputs a stack trace to the Web Console.</p><p>https://developer.mozilla.org/en-US/docs/Web/API/Console/trace</p>",
|
498
|
+
"hashCode": -394252655
|
499
|
+
},
|
500
|
+
{
|
501
|
+
"describe": "<p>Refer to the code below:</p><p>01 let greeting = 'Goodbye' ;</p><p>02 let salutation = 'Hello, hello, hello' ;</p><p>03 try {</p><p>04 greeting = 'Hello' ;</p><p>05 decodeURI( '%%%' ) ; // throws error</p><p>06 salutation = 'Goodbye' ;</p><p>07 } catch(err) {</p><p>08 salutation = 'I say hello' ;</p><p>09 } finally {</p><p>10 salutation = 'Hello, Hello';</p><p>11 }</p><p>Line 05 causes an error.</p><p>What are the values of greeting and salutation once the code completes?</p><p></p>",
|
502
|
+
"answerOptions": [
|
503
|
+
{
|
504
|
+
"describe": "<p>greeting is Hello and salutation is I say hello.</p>",
|
505
|
+
"isRight": false
|
506
|
+
},
|
507
|
+
{
|
508
|
+
"describe": "<p>greeting is Goodbye and salutation is Hello, Hello.</p>",
|
509
|
+
"isRight": false
|
510
|
+
},
|
511
|
+
{
|
512
|
+
"describe": "<p>greeting is Goodbye and salutation is I say hello.</p>",
|
513
|
+
"isRight": false
|
514
|
+
},
|
515
|
+
{
|
516
|
+
"describe": "<p>greeting is Hello and salutation is Hello, Hello.</p>",
|
517
|
+
"isRight": true
|
518
|
+
}
|
519
|
+
],
|
520
|
+
"analysis": "",
|
521
|
+
"hashCode": 681073869
|
522
|
+
}
|
523
|
+
],
|
524
|
+
"hashCode": 390324247
|
525
|
+
}
|