@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.
Files changed (83) hide show
  1. package/dist/index.html +1 -1
  2. package/dist/static/css/app.4293d3540537974d843eca825dcda382.css +2 -0
  3. package/dist/static/css/app.4293d3540537974d843eca825dcda382.css.map +1 -0
  4. package/dist/static/js/app.e278f9557d317b4606b0.js +2 -0
  5. package/dist/static/js/app.e278f9557d317b4606b0.js.map +1 -0
  6. package/dist/static/js/manifest.3ad1d5771e9b13dbdad2.js.map +1 -1
  7. package/lib-json/Dev1/345/237/272/347/241/200/351/242/230.json +1407 -0
  8. package/lib-json/Dev1/346/250/241/346/213/237/345/215/267A.json +1538 -0
  9. package/lib-json/Dev1/346/250/241/346/213/237/345/215/267B.json +1534 -0
  10. 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
  11. 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
  12. 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
  13. package/lib-json/Dev1/347/224/250/346/210/267/347/225/214/351/235/242.json +1243 -0
  14. package/lib-json/[DEV2]Salesforce/345/237/272/347/241/200.json +375 -0
  15. package/lib-json/[DEV2]/346/200/247/350/203/275.json +728 -0
  16. package/lib-json/[DEV2]/346/250/241/346/213/237/345/215/267A.json +1403 -0
  17. package/lib-json/[DEV2]/346/250/241/346/213/237/345/215/267B.json +1387 -0
  18. package/lib-json/[DEV2]/346/265/213/350/257/225/344/270/216/351/203/250/347/275/262.json +828 -0
  19. package/lib-json/[DEV2]/347/224/250/346/210/267/347/225/214/351/235/2421.json +977 -0
  20. package/lib-json/[DEV2]/347/224/250/346/210/267/347/225/214/351/235/2422.json +667 -0
  21. 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
  22. 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
  23. 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
  24. package/lib-json/[JS]/347/254/254/344/270/203/347/253/240 /346/265/213/350/257/225.json" +356 -0
  25. 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
  26. 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
  27. 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
  28. 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
  29. 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
  30. package/lib-json/[/345/222/270/351/261/274]AppBuilder-1.json +977 -0
  31. package/lib-json/[/345/222/270/351/261/274]AppBuilder-2.json +941 -0
  32. package/lib-json/[/345/222/270/351/261/274]AppBuilder-3.json +973 -0
  33. package/lib-json/[/345/222/270/351/261/274]AppBuilder-4.json +981 -0
  34. package/lib-json/[/345/222/270/351/261/274]AppBuilder-5.json +771 -0
  35. package/lib-json/map.json +28 -43
  36. package/package.json +4 -2
  37. package/dist/static/css/app.d3e969a579969be885a3462a1e12e37f.css +0 -2
  38. package/dist/static/css/app.d3e969a579969be885a3462a1e12e37f.css.map +0 -1
  39. package/dist/static/js/app.53370ddfe5eba6a10565.js +0 -2
  40. package/dist/static/js/app.53370ddfe5eba6a10565.js.map +0 -1
  41. package/lib-json/Salesforce-Admin(302)-[Set-10].json +0 -321
  42. package/lib-json/Salesforce-Admin(302)-[Set-1].json +0 -301
  43. package/lib-json/Salesforce-Admin(302)-[Set-2].json +0 -325
  44. package/lib-json/Salesforce-Admin(302)-[Set-3].json +0 -305
  45. package/lib-json/Salesforce-Admin(302)-[Set-4].json +0 -325
  46. package/lib-json/Salesforce-Admin(302)-[Set-5].json +0 -329
  47. package/lib-json/Salesforce-Admin(302)-[Set-6].json +0 -322
  48. package/lib-json/Salesforce-Admin(302)-[Set-7].json +0 -321
  49. package/lib-json/Salesforce-Admin(302)-[Set-8].json +0 -321
  50. package/lib-json/Salesforce-Admin(302)-[Set-9].json +0 -325
  51. package/lib-json/Salesforce-Admin-201-[Set-10].json +0 -158
  52. package/lib-json/Salesforce-Admin-201-[Set-1].json +0 -604
  53. package/lib-json/Salesforce-Admin-201-[Set-2].json +0 -621
  54. package/lib-json/Salesforce-Admin-201-[Set-3].json +0 -650
  55. package/lib-json/Salesforce-Admin-201-[Set-4].json +0 -636
  56. package/lib-json/Salesforce-Admin-201-[Set-5].json +0 -640
  57. package/lib-json/Salesforce-Admin-201-[Set-6].json +0 -126
  58. package/lib-json/Salesforce-Admin-201-[Set-7].json +0 -126
  59. package/lib-json/Salesforce-Admin-201-[Set-8].json +0 -126
  60. package/lib-json/Salesforce-Admin-201-[Set-9].json +0 -126
  61. package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-1].json +0 -321
  62. package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-2].json +0 -325
  63. package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-3].json +0 -321
  64. package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-4].json +0 -337
  65. package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-5].json +0 -329
  66. package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-6].json +0 -325
  67. package/lib-json/Salesforce-Certified-Platform-Developer-1-[Set-7].json +0 -480
  68. package/lib-json/Salesforce-Sales-Cloud-Certification(81)-[Set-1].json +0 -305
  69. package/lib-json/Salesforce-Sales-Cloud-Certification(81)-[Set-2].json +0 -297
  70. package/lib-json/Salesforce-Sales-Cloud-Certification(81)-[Set-3].json +0 -269
  71. package/lib-json/Salesforce-Sales-Cloud-Certification(81)-[Set-4].json +0 -309
  72. package/lib-json/Salesforce-Sales-Cloud-Certification(81)-[Set-5].json +0 -515
  73. package/lib-json/app-builder-01.json +0 -1
  74. package/lib-json/app-builder-02.json +0 -1
  75. package/lib-json/app-builder-03.json +0 -1
  76. package/lib-json/app-builder-04.json +0 -1
  77. package/lib-json/app-builder-05.json +0 -1
  78. package/lib-json/app-builder-06.json +0 -1
  79. package/lib-json/app-builder-07.json +0 -1
  80. package/lib-json/app-builder-08.json +0 -1
  81. package/lib-json/app-builder-09.json +0 -1
  82. package/lib-json/app-builder-10.json +0 -1
  83. package/lib-json/app-builder-11.json +0 -311
@@ -0,0 +1,851 @@
1
+ {
2
+ "title": "[JS]第三章 浏览器和事件",
3
+ "category": "JS-1",
4
+ "questions": [
5
+ {
6
+ "describe": "<p>Refer to the HTML below:</p><p>&lt;div id = \"main\"&gt;</p><p>&lt;ul&gt;</p><p>&lt;li&gt;Leo&lt;/li&gt;</p><p>&lt;li&gt;Tony&lt;/li&gt;</p><p>&lt;li&gt;Tiger&lt;/li&gt;</p><p>&lt;/ul&gt;</p><p>&lt;/div&gt;</p><p>Which JavaScript statement results in changing “Tony\" to \"Mr.T.\"?</p>",
7
+ "answerOptions": [
8
+ {
9
+ "describe": "<p>document.querySelector('#main</p><p>li : nth-child (2)').innerHTML = 'Mr.T.';</p>",
10
+ "isRight": true
11
+ },
12
+ {
13
+ "describe": "<p>document.querySelectorAll('#main</p><p>#TONY').innerHTML = 'Mr.T.';</p>",
14
+ "isRight": false
15
+ },
16
+ {
17
+ "describe": "<p>document.querySelectorAll('#main</p><p>li.Tony').innerHTML = 'Mr.T.';</p>",
18
+ "isRight": false
19
+ },
20
+ {
21
+ "describe": "<p>document.querySelector('#main</p><p>li : second-child').innerHTML = 'Mr.T.';</p>",
22
+ "isRight": false
23
+ }
24
+ ],
25
+ "analysis": "<p>CSS: :nth-child() Selector see:</p><p>https://www.w3schools.com/cssref/sel_nth-child.asp</p><p>2。how to add class: https://www.w3schools.com/howto/howto_js_add_class.asp</p><p>querySelectorAll will return a list of matched elemens.</p><p>getElementById should not have '#'</p><p>HTML DOM classList property. https://www.w3schools.com/jsref/prop_element_classlist.asp</p>",
26
+ "hashCode": 591770595
27
+ },
28
+ {
29
+ "describe": "<p>Given</p><p>the HTML below:</p><p>&lt;div&gt;</p><p>&lt;div id</p><p>=\"row-uc\"&gt;Universal Containers&lt;/div&gt;</p><p>&lt;div id</p><p>=\"row-as\"&gt;Applied Shipping&lt;/div&gt;</p><p>&lt;div id</p><p>=\"row-bt\"&gt;Burlington Textiles&lt;/div&gt;</p><p>&lt;/div&gt;</p><p>Which statement adds the priority-account CSS class to the Universal</p><p>Containers row?</p>",
30
+ "answerOptions": [
31
+ {
32
+ "describe": "<p>document.querySelectorAll('#row-uc').classList.add('priority-account');</p>",
33
+ "isRight": false
34
+ },
35
+ {
36
+ "describe": "<p>document.querySelector('#row-uc').classes.push('priority-account');</p>",
37
+ "isRight": false
38
+ },
39
+ {
40
+ "describe": "<p>document.getElementById('#row-uc').addClass('priority-account');</p>",
41
+ "isRight": false
42
+ },
43
+ {
44
+ "describe": "<p>document.querySelector('#row-uc').classList.add('priority-account');</p>",
45
+ "isRight": true
46
+ }
47
+ ],
48
+ "analysis": "",
49
+ "hashCode": 1260350995
50
+ },
51
+ {
52
+ "describe": "<p>A developer tries to retrieve all cookies, then sets a certain key value pair in the cookie. These statements are used:</p><p>01 document.cookie;</p><p>02 document.cookie = 'Key=John Smith';</p><p>What is the behavior?</p>",
53
+ "answerOptions": [
54
+ {
55
+ "describe": "<p>Cookies are read and the key value is set, and all cookies are wiped.</p>",
56
+ "isRight": false
57
+ },
58
+ {
59
+ "describe": "<p>Cookies are read and the key value is set, the remaining cookies are unaffected.</p>",
60
+ "isRight": true
61
+ },
62
+ {
63
+ "describe": "<p>Cookies are read, but the key value is not set because the value is not URL encoded.</p>",
64
+ "isRight": false
65
+ },
66
+ {
67
+ "describe": "<p>Cookies are not read because line 01 should be document.cookies, but the key value is set and all cookies are wiped.</p>",
68
+ "isRight": false
69
+ }
70
+ ],
71
+ "analysis": "",
72
+ "hashCode": -2083032662
73
+ },
74
+ {
75
+ "describe": "<p>A developer at UC creates a new landing page based on HTML, CSS, and JavaScript.</p><p>To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to be executed when the webpage is fully loaded (HTML content and all related files), in order to do some custom initialization.</p><p>Which statement should be used to call personalizeWebsiteContent based on the above business requirement?</p>",
76
+ "answerOptions": [
77
+ {
78
+ "describe": "<p>document.addEventListener('onDOMContentLoaded', personalizeWebsiteContent) ;</p>",
79
+ "isRight": false
80
+ },
81
+ {
82
+ "describe": "<p>window. addEventListener('onload', personalizeWebsiteContent);</p>",
83
+ "isRight": false
84
+ },
85
+ {
86
+ "describe": "<p>window. addEventListener('load', personalizeWebsiteContent);</p>",
87
+ "isRight": true
88
+ },
89
+ {
90
+ "describe": "<p>document. addEventListener('DOMContentLoaded', personalizeWebsiteContent);</p>",
91
+ "isRight": false
92
+ }
93
+ ],
94
+ "analysis": "<p>windows load event:</p><p>https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event</p>",
95
+ "hashCode": 1652847756
96
+ },
97
+ {
98
+ "describe": "<p>Which three browser specific APIs are available for developers to persist data between page loads? Choose 3 answer</p>",
99
+ "answerOptions": [
100
+ {
101
+ "describe": "<p>global variables</p>",
102
+ "isRight": false
103
+ },
104
+ {
105
+ "describe": "<p>IIFEs</p>",
106
+ "isRight": false
107
+ },
108
+ {
109
+ "describe": "<p>indexedDB</p>",
110
+ "isRight": true
111
+ },
112
+ {
113
+ "describe": "<p>localStorage</p>",
114
+ "isRight": true
115
+ },
116
+ {
117
+ "describe": "<p>cookies</p>",
118
+ "isRight": true
119
+ }
120
+ ],
121
+ "analysis": "<p>The IndexedDB API (sometimes abbreviated IDB) is a complete database system available in the browser in which you can store complex related data</p><p>check client side storage:</p><p>https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Client-side_storage</p>",
122
+ "hashCode": -1052135917
123
+ },
124
+ {
125
+ "describe": "<p>Refer to the code below:</p><p>01 const event = new CustomEvent (</p><p>02 //Missing code</p><p>03 );</p><p>04 obj.dispatchEvent (event) ;</p><p>A developer needs to dispatch a custom event called update to send information about recordId.</p><p>Which two options could a developer insert at the placeholder in line 02 to achieve this? Choose 2 answers</p>",
126
+ "answerOptions": [
127
+ {
128
+ "describe": "<p>update', '123abc'</p>",
129
+ "isRight": false
130
+ },
131
+ {
132
+ "describe": "<p>update', {</p><p>recordId : '123abc'</p><p>}</p>",
133
+ "isRight": true
134
+ },
135
+ {
136
+ "describe": "<p>update', {</p><p>detail : {</p><p>recordId : '123abc'</p><p>}</p><p>}</p>",
137
+ "isRight": true
138
+ },
139
+ {
140
+ "describe": "<p>{type : 'update', recordId : '123abc'}</p>",
141
+ "isRight": false
142
+ }
143
+ ],
144
+ "analysis": "<p>check customEvent:</p><p>https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent</p>",
145
+ "hashCode": -998090915
146
+ },
147
+ {
148
+ "describe": "<p>UC recently launched its new landing page to host a crowd funding campaign. The page uses an external library to display some third-party ads. Once the page is fully loaded, it creates more than 50 new HTML item placed randomly inside the DOM, like the one in the codebelow:</p><p>&lt; img src=\" /ad- library/ad01.gif\" /&gt;</p><p>All the elements include the same ad-library-item class. They are hidden by default, and they are randomly displayed while the user navigates through the page.</p><p>Tired of all the ads, what can the developer do to temporarily and quickly remove them?</p>",
149
+ "answerOptions": [
150
+ {
151
+ "describe": "<p>Use the DOM inspector to remove all the elements containing the class ad-library-item.</p>",
152
+ "isRight": false
153
+ },
154
+ {
155
+ "describe": "<p>Use the DOM inspector to prevent the load event to be fired.</p>",
156
+ "isRight": false
157
+ },
158
+ {
159
+ "describe": "<p>Use the browser console to execute a script that prevents the load event to be fired.</p>",
160
+ "isRight": false
161
+ },
162
+ {
163
+ "describe": "<p>Use the browser console to execute a script that removes all the elements containing the class ad-library-item.</p>",
164
+ "isRight": true
165
+ }
166
+ ],
167
+ "analysis": "<p>const el = document.querySelector('ad-library-item');</p><p>el.remove();</p>",
168
+ "hashCode": 396955090
169
+ },
170
+ {
171
+ "describe": "<p>A developer implements and calls the following code when an application state change occurs:</p><p>const onStatechange = (newPageState)=&gt; {</p><p>window. history. pushState (newPageState, ' ', null) ;</p><p>If the back button is clicked after this method is executed, what can a developer expect?</p>",
172
+ "answerOptions": [
173
+ {
174
+ "describe": "<p>The page reloads and all JavaScript is reinitialized .</p>",
175
+ "isRight": false
176
+ },
177
+ {
178
+ "describe": "<p>A popstate event is fired with a state property that details the application's last state .</p>",
179
+ "isRight": false
180
+ },
181
+ {
182
+ "describe": "<p>The page is navigated away from and the previous page in the browser's history is loaded.</p>",
183
+ "isRight": true
184
+ },
185
+ {
186
+ "describe": "<p>A navigate event is fired with a state property that details the previous application state.</p>",
187
+ "isRight": false
188
+ }
189
+ ],
190
+ "analysis": "<p>check history API:</p><p>https://developer.mozilla.org/en-US/docs/Web/API/History_API/Working_with_the_History_API</p>",
191
+ "hashCode": -649318349
192
+ },
193
+ {
194
+ "describe": "<p>Refer to the HTML below:</p><p>&lt;p&gt; The current status of an Order: &lt;span id=\"status\"&gt; In Progress &lt;/span&gt; &lt;/p &gt;</p><p>Which JavaScript statement changes the text 'In Progress' to 'Completed' ?</p>",
195
+ "answerOptions": [
196
+ {
197
+ "describe": "<p>document.getElementById(\".status\").innerHTML = 'Completed' ;</p>",
198
+ "isRight": false
199
+ },
200
+ {
201
+ "describe": "<p>document.getElementById(\"status\").Value = 'Completed' ;</p>",
202
+ "isRight": false
203
+ },
204
+ {
205
+ "describe": "<p>document.getElementById(\"#status\").innerHTML = 'Completed' ;</p>",
206
+ "isRight": false
207
+ },
208
+ {
209
+ "describe": "<p>document.getElementById(\"status\").innerHTML = 'Completed' ;</p>",
210
+ "isRight": true
211
+ }
212
+ ],
213
+ "analysis": "<p>getElementById, 无需使用 #</p>",
214
+ "hashCode": 1671046131
215
+ },
216
+ {
217
+ "describe": "<p>A developer creates a simple webpage with an input field. When a user enters text in the input field and clicks the button, the actual value of the field must be displayed in the console.</p><p>Here is the HTML file content:</p><p>&lt;input type=\"text\" value=\"Hello\" name=\"input\"&gt;</p><p>&lt;button type=\"button\"&gt;Display&lt;/button&gt;</p><p>The developer wrote the JavaScript code below:</p><p>01 const button = document.querySelector ('button');</p><p>02 button.addEventListener('click', ( ) =&gt; {</p><p>03 const input = document.querySelector('input');</p><p>04 console.log (input.getAttribute('value'));</p><p>05 });</p><p>When the user clicks the button, the output is always \"Hello\".</p><p>What needs to be done to make this code work as expected?</p><p></p>",
218
+ "answerOptions": [
219
+ {
220
+ "describe": "<p>Replace line 04 with console.log(input.value);</p>",
221
+ "isRight": true
222
+ },
223
+ {
224
+ "describe": "<p>Replace line 02 with button. addCallback(\"click\", function( ) {</p>",
225
+ "isRight": false
226
+ },
227
+ {
228
+ "describe": "<p>Replace line 02 with button. addEventListener(\"onclick\", function( ) {</p>",
229
+ "isRight": false
230
+ },
231
+ {
232
+ "describe": "<p>Replace line 03 with const input = document. getElementByName('input') ;</p>",
233
+ "isRight": false
234
+ }
235
+ ],
236
+ "analysis": "<p>line03 will get error: document.getElementByName is not a function</p><p>The getElementsByName() method returns a collection of all elements in the document with the specified name</p><p>check addEventListener:</p><p>https://www.w3schools.com/JSREF/met_element_addeventlistener.asp</p>",
237
+ "hashCode": -1653947682
238
+ },
239
+ {
240
+ "describe": "<p>A developer is creating a simple webpage with a button. When a user clicks this button for the first time, a message is displayed.</p><p>The developer wrote the JavaScript code below, but something is missing. The message gets displayed every time a user clicks the button, instead of just the first time.</p><p>01 function listen (event) {</p><p>02</p><p>03 alert('Hey! I am John Doe');</p><p>04</p><p>05 }</p><p>06 button. addEventListener('click', listen) ;</p><p>Which two code lines make this code work as required? Choose 2 answers</p><p></p>",
241
+ "answerOptions": [
242
+ {
243
+ "describe": "<p>On line 02, use event.first to test if it is the first execution.</p>",
244
+ "isRight": false
245
+ },
246
+ {
247
+ "describe": "<p>On line 04, use event.stopPropagation( );</p>",
248
+ "isRight": false
249
+ },
250
+ {
251
+ "describe": "<p>On line 04, use button.removeEventListener('click', listen);</p>",
252
+ "isRight": true
253
+ },
254
+ {
255
+ "describe": "<p>On line 06. add an option called once to button.addEventListener( ).</p>",
256
+ "isRight": true
257
+ }
258
+ ],
259
+ "analysis": "",
260
+ "hashCode": -1471083619
261
+ },
262
+ {
263
+ "describe": "<p>Given two nested divs and the code below:</p><p>window.onload = (event) =&gt; {</p><p>document.querySelector('.outerDiv')</p><p>.addEventListener('click', displayOuterMessage, true);</p><p>document.querySelector('.innerDiv')</p><p>.addEventListener('click', displayInnerMessage, true);</p><p>};</p><p>What order will the event listeners be called when the innerDiv is clicked?</p><p></p>",
264
+ "answerOptions": [
265
+ {
266
+ "describe": "<p>displayInnerMessage, displayOuterMessage</p>",
267
+ "isRight": false
268
+ },
269
+ {
270
+ "describe": "<p>displayOuterMessage, displayInnerMessage</p>",
271
+ "isRight": true
272
+ },
273
+ {
274
+ "describe": "<p>displayOuterMessage only</p>",
275
+ "isRight": false
276
+ },
277
+ {
278
+ "describe": "<p>displayInnerMessage only</p>",
279
+ "isRight": false
280
+ }
281
+ ],
282
+ "analysis": "<p>Events in the target phase will trigger all listeners on an element in the order they were registered. Hence, the outer message will be displayed first, then the inner message.</p>",
283
+ "hashCode": -1670279583
284
+ },
285
+ {
286
+ "describe": "<p>What happens when the following code is executed?</p><p>alert(\"There will be an error\")</p><p>[1, 2].forEach(alert)</p><p></p>",
287
+ "answerOptions": [
288
+ {
289
+ "describe": "<p>The browser will show 3 alerts \"There will be an error\", \"1\" and \"2\".</p>",
290
+ "isRight": false
291
+ },
292
+ {
293
+ "describe": "<p>The browser will show 1 alert \"There will be an error\".</p>",
294
+ "isRight": true
295
+ },
296
+ {
297
+ "describe": "<p>The browser will show 1 alert \"TypeError: Cannot read property '2' of undefined\".</p>",
298
+ "isRight": false
299
+ },
300
+ {
301
+ "describe": "<p>The browser will show 2 alerts \"There will be an error\", and \"TypeError: Cannot read property '2' of undefined\".</p>",
302
+ "isRight": false
303
+ }
304
+ ],
305
+ "analysis": "<p>The correct answer will be showing 2 alerts: “There will be an error” and “TypeError: Cannot read property ‘2’ of undefined”.</p><p>The first line of code is missing a semicolon(;) at the end which JavaScript does not assume a semicolon before square brackets, hence the code is treated as a single statement like this: alert(\"There will be an error\")[1, 2].forEach(alert)</p><p>By default, [1, 2].forEach(alert) will show two alerts “1” and “2”. Since the code statement is malfunction, hence the JavaScript throws an error after showing the first alert.</p><p>In most cases, a newline implies a semicolon. But “in most cases” does not mean “always”! As for best practice, always include a semicolon when you are done with the line to avoid unnecessary issues!</p><p>只会有一个alert, there will be an error. Console 会显示 Error: cannot read property '2' of undefined</p>",
306
+ "hashCode": 109030409
307
+ },
308
+ {
309
+ "describe": "<p>JavaScript automatically allocates memory when objects are created and frees it when they are not used anymore. This mechanism is often called Garbage Collection (GC). Which of the following regarding GC is correct?</p><p></p>",
310
+ "answerOptions": [
311
+ {
312
+ "describe": "<p>Garbage collection feature can be turned off and managed manually.</p>",
313
+ "isRight": false
314
+ },
315
+ {
316
+ "describe": "<p>When an object is being referenced by others, it will not be garbage collected.</p>",
317
+ "isRight": false
318
+ },
319
+ {
320
+ "describe": "<p>Garbage collection is only supported by major browsers, such as Google Chrome and Mozilla Firefox.</p>",
321
+ "isRight": false
322
+ },
323
+ {
324
+ "describe": "<p>When an object becomes unreachable, garbage collector will sweep the data and free the memory.</p>",
325
+ "isRight": true
326
+ }
327
+ ],
328
+ "analysis": "<p>When an object becomes unreachable, garbage collector will sweep the data and free the memory.</p><p>Being referenced is not the same as being reachable (from a root): a pack of interlinked objects can become unreachable as a whole.</p><p>Garbage collection is performed automatically. We cannot force or prevent it.</p><p>Almost all the browsers (engines) support garbage collection by default, it is just that modern engines implement advanced algorithms of garbage collection.</p>",
329
+ "hashCode": -300512207
330
+ },
331
+ {
332
+ "describe": "<p>Which of the following is a valid event when interacting with the browser? Choose 3 answers.</p>",
333
+ "answerOptions": [
334
+ {
335
+ "describe": "<p>draganddrop</p>",
336
+ "isRight": false
337
+ },
338
+ {
339
+ "describe": "<p>contextmenu</p>",
340
+ "isRight": true
341
+ },
342
+ {
343
+ "describe": "<p>mousedown</p>",
344
+ "isRight": true
345
+ },
346
+ {
347
+ "describe": "<p>scrollup</p>",
348
+ "isRight": false
349
+ },
350
+ {
351
+ "describe": "<p>keyup</p>",
352
+ "isRight": true
353
+ }
354
+ ],
355
+ "analysis": "<p>“contextmenu” event is fired when the right button of the mouse is clicked.</p><p>“mousedown” event is fired when a pointing device button is pressed on an element.</p><p>“keyup” event is fired when any of the keyboard’s key is released.</p><p>There is no “draganddrop” event. However, there is a “drag” event which is fired when an element or text selection is being dragged, and “drop” event which is fired when an element is dropped on a valid drop target.</p><p>There is no “scrollup” event. However, there is an event called “scroll” which is fired when the document view or an element has been scrolled.</p>",
356
+ "hashCode": -634315088
357
+ },
358
+ {
359
+ "describe": "<p>&lt;html&gt;</p><p>&lt;body&gt;</p><p>&lt;div&gt;</p><p>&lt;ul class=\"first\"&gt;</p><p>&lt;li&gt;Item 1&lt;/li&gt;</p><p>&lt;li&gt;Item 2&lt;/li&gt;</p><p>&lt;/ul&gt;</p><p>&lt;ul class=\"second\"&gt;</p><p>&lt;li&gt;Item 3&lt;/li&gt;</p><p>&lt;li&gt;Item 4&lt;/li&gt;</p><p>&lt;li&gt;Item 5&lt;/li&gt;</p><p>&lt;/ul&gt;</p><p>&lt;/div&gt;</p><p>&lt;script&gt;</p><p>let elements = document.querySelectorAll('div, ul &gt; li:last-child, * ul.first li');</p><p>console.log(elements.length);</p><p>&lt;/script&gt;</p><p>&lt;/body&gt;</p><p>&lt;/html&gt;</p><p>Given the code above, what is the length of elements?</p><p></p>",
360
+ "answerOptions": [
361
+ {
362
+ "describe": "<p>6</p>",
363
+ "isRight": false
364
+ },
365
+ {
366
+ "describe": "<p>7</p>",
367
+ "isRight": false
368
+ },
369
+ {
370
+ "describe": "<p>4</p>",
371
+ "isRight": true
372
+ },
373
+ {
374
+ "describe": "<p>5</p>",
375
+ "isRight": false
376
+ }
377
+ ],
378
+ "analysis": "<p>The length of elements is 4. The query selector selects 1 div and 3 li which are the Item 1, Item 2 and Item 5.</p>",
379
+ "hashCode": -1252572505
380
+ },
381
+ {
382
+ "describe": "<p>&lt;!DOCTYPE html&gt;</p><p>&lt;html&gt;</p><p>&lt;body&gt;</p><p>&lt;form&gt;FORM</p><p>&lt;div&gt;DIV</p><p>&lt;p&gt;P&lt;/p&gt;</p><p>&lt;/div&gt;</p><p>&lt;/form&gt;</p><p>&lt;script&gt;</p><p>for(let elem of document.querySelectorAll('*')) {</p><p>elem.addEventListener(\"click\", e =&gt; console.log(`Bubbling: ${elem.tagName}`)); elem.addEventListener(\"click\", e =&gt; console.log(`Capturing: ${elem.tagName}`), true);</p><p>}</p><p>&lt;/script&gt;</p><p>&lt;/body&gt;</p><p>&lt;/html&gt;</p><p>Given the code above, which one of the following will be the correct output in the console when you click on the paragraph element?</p><p></p>",
383
+ "answerOptions": [
384
+ {
385
+ "describe": "<p>“Capturing: P”</p><p>“Bubbling: P”</p><p>“Capturing: DIV”</p><p>“Bubbling: DIV”</p><p>“Capturing: FORM”</p><p>“Bubbling: FORM”</p><p>“Capturing: BODY”</p><p>“Bubbling: BODY”</p><p>“Capturing: HTML”</p><p>“Bubbling: HTML”</p>",
386
+ "isRight": false
387
+ },
388
+ {
389
+ "describe": "<p>“Bubbling: HTML”</p><p>“Bubbling: BODY”</p><p>“Bubbling: FORM”</p><p>“Bubbling: DIV”</p><p>“Bubbling: P”</p><p>“Capturing: P”</p><p>“Capturing: DIV”</p><p>“Capturing: FORM”</p><p>“Capturing: BODY”</p><p>“Capturing: HTML”</p>",
390
+ "isRight": false
391
+ },
392
+ {
393
+ "describe": "<p>“Capturing: HTML”</p><p>“Capturing: BODY”</p><p>“Capturing: FORM”</p><p>“Capturing: DIV”</p><p>“Bubbling: P”</p><p>“Capturing: P”</p><p>“Bubbling: DIV”</p><p>“Bubbling: FORM”</p><p>“Bubbling: BODY”</p><p>“Bubbling: HTML”</p>",
394
+ "isRight": true
395
+ },
396
+ {
397
+ "describe": "<p>“Capturing: HTML”</p><p>“Capturing: BODY”</p><p>“Capturing: FORM”</p><p>“Capturing: DIV”</p><p>“Capturing: P”</p><p>“Bubbling: P”</p><p>“Bubbling: DIV”</p><p>“Bubbling: FORM”</p><p>“Bubbling: BODY”</p><p>“Bubbling: HTML”</p>",
398
+ "isRight": false
399
+ }
400
+ ],
401
+ "analysis": "<p>The correct output sequence will be the following:</p><p>“Capturing: HTML”</p><p>“Capturing: BODY”</p><p>“Capturing: FORM”</p><p>“Capturing: DIV”</p><p>“Bubbling: P”</p><p>“Capturing: P”</p><p>“Bubbling: DIV”</p><p>“Bubbling: FORM”</p><p>“Bubbling: BODY”</p><p>“Bubbling: HTML”</p><p>The standard DOM Events describes 3 phases of event propagation:</p><p>Capturing phase – the event goes down to the element.</p><p>Target phase – the event reached the target element.</p><p>Bubbling phase – the event bubbles up from the element.</p><p>In this case, the click on paragraph element captures down from the rootdown to</p><p>element, and then bubbles up all the way to the root.</p><p>Since the addEventListener for capturing events is initiated before bubbling events, hence the console prints “Bubbling: P” before “Capturing: P”.</p>",
402
+ "hashCode": -1595759444
403
+ },
404
+ {
405
+ "describe": "<p>If an application manipulates the browser history using the History API, which event should a developer use to detect when the browser’s native back or forward button is clicked? Choose 1 answer.</p><p></p>",
406
+ "answerOptions": [
407
+ {
408
+ "describe": "<p>popstate</p>",
409
+ "isRight": true
410
+ },
411
+ {
412
+ "describe": "<p>change</p>",
413
+ "isRight": false
414
+ },
415
+ {
416
+ "describe": "<p>pushstate</p>",
417
+ "isRight": false
418
+ },
419
+ {
420
+ "describe": "<p>navigate</p>",
421
+ "isRight": false
422
+ }
423
+ ],
424
+ "analysis": "<p>A popstate event is dispatched to the window each time the active history entry changes between two history entries for the same document.</p><p>The navigate() method loads a specified URL.</p><p>The pushstate() method pushes the given data onto the session history stack with the specified title.</p><p>The change event is fired for changes to element.</p>",
425
+ "hashCode": 760715380
426
+ },
427
+ {
428
+ "describe": "<p>&lt;div id=\"elem\"&gt;&lt;/div&gt;</p><p>&lt;script&gt;</p><p>// get the element</p><p>let elem = ____________;</p><p>// set background as red color</p><p>elem.style.background = 'red';</p><p>&lt;/script&gt;</p><p>Given the code above, what would you write in the blank field on line 4? Choose 1 answer.</p><p></p>",
429
+ "answerOptions": [
430
+ {
431
+ "describe": "<p>html.getElementById('elem');</p>",
432
+ "isRight": false
433
+ },
434
+ {
435
+ "describe": "<p>document.getElementById('elem');</p>",
436
+ "isRight": true
437
+ },
438
+ {
439
+ "describe": "<p>Element.getElementById('elem');</p>",
440
+ "isRight": false
441
+ },
442
+ {
443
+ "describe": "<p>this.getElementById('elem');</p>",
444
+ "isRight": false
445
+ }
446
+ ],
447
+ "analysis": "<p>document.getElementById('elem'); is the correct way to look for an element by its id.</p>",
448
+ "hashCode": 1024050894
449
+ },
450
+ {
451
+ "describe": "<p>&lt;form onclick=\"alert('form')\"&gt;FORM</p><p>&lt;div onclick=\"alert('div')\"&gt;DIV</p><p>&lt;p onclick=\"alert('p')\"&gt;P&lt;/p&gt;</p><p>&lt;/div&gt;</p><p>&lt;/form&gt;</p><p>what would happen when the div element block is clicked?</p><p></p>",
452
+ "answerOptions": [
453
+ {
454
+ "describe": "<p>alert('div') will show first, then alert('form').</p>",
455
+ "isRight": true
456
+ },
457
+ {
458
+ "describe": "<p>alert('div') will show first, then alert('p').</p>",
459
+ "isRight": false
460
+ },
461
+ {
462
+ "describe": "<p>Only alert('div') will show.</p>",
463
+ "isRight": false
464
+ },
465
+ {
466
+ "describe": "<p>alert('p') will show first, then alert('div') , and lastly alert('form').</p>",
467
+ "isRight": false
468
+ }
469
+ ],
470
+ "analysis": "<p>alert('div') will show first, then alert('form').</p><p>When an event happens on an element, it first runs the handlers on it, then on its parent, then all the way up on other ancestors. In this case, a click on the div element will bubble up to form element which resulting in showing two alerts.</p>",
471
+ "hashCode": 1905395048
472
+ },
473
+ {
474
+ "describe": "<p>Which of the following regarding DOM is correct? Choose 2 answers.</p><p></p>",
475
+ "answerOptions": [
476
+ {
477
+ "describe": "<p>DOM is a programming language that handles the whole webpage.</p>",
478
+ "isRight": false
479
+ },
480
+ {
481
+ "describe": "<p>DOM is a programming interface for HTML and XML documents.</p>",
482
+ "isRight": true
483
+ },
484
+ {
485
+ "describe": "<p>DOM stands for Document Object Model.</p>",
486
+ "isRight": true
487
+ },
488
+ {
489
+ "describe": "<p>DOM stands for Document Object Management.</p>",
490
+ "isRight": false
491
+ }
492
+ ],
493
+ "analysis": "<p>DOM stands for Document Object Model.</p><p>DOM is not a programming language, it is a programming interface for HTML and XML documents. It represents the page so that programs can change the document structure, style, and content. The DOM represents the document as nodes and objects. That way, programming languages like JavaScript can connect to the page.</p>",
494
+ "hashCode": 73646446
495
+ },
496
+ {
497
+ "describe": "<p>Refer to the code below:</p><p>01 &lt;html lang=\"en\"&gt;</p><p>02 &lt;table onclick=\"console. log('Table log');\"&gt;</p><p>03 &lt;tr id=\"row1\"&gt;</p><p>04 &lt;td&gt;Click me!&lt;/td&gt;</p><p>05 &lt;/tr&gt;</p><p>06 &lt;/table&gt;</p><p>07 &lt;script&gt;</p><p>08 function printMessage (event) {</p><p>09 console.log('Row log') ;</p><p>10 }</p><p>11</p><p>12 let elem = document. getElementById('row1') ;</p><p>13 elem. addEventListener('click', printMessage, false) ;</p><p>14 &lt;/script&gt;</p><p>15 &lt;/html&gt;</p><p>Which code change should be made for the console to log only Row log when 'Click me!' is clicked?</p><p></p>",
498
+ "answerOptions": [
499
+ {
500
+ "describe": "<p>Add event. stopPropagation( ); to printMessage function.</p>",
501
+ "isRight": true
502
+ },
503
+ {
504
+ "describe": "<p>Add event .stopPropagation( ); to window.onLoad event handler.</p>",
505
+ "isRight": false
506
+ },
507
+ {
508
+ "describe": "<p>Add event.removeEventListener( ); to printMessage function.</p>",
509
+ "isRight": false
510
+ },
511
+ {
512
+ "describe": "<p>Add event.removeEventListener( ); to window.onLoad event handler.</p>",
513
+ "isRight": false
514
+ }
515
+ ],
516
+ "analysis": "",
517
+ "hashCode": -73700738
518
+ },
519
+ {
520
+ "describe": "<p>Universal Containers (UC) notices that its application that allows users to search for accounts makes a network request each time a key is pressed. This results in too many requests for the server to handle.</p><p>To address this problem, UC decides to implement a debounce function on the search string change handler.</p><p>What are three key steps to implement this debounce function? Choose 3 answers</p>",
521
+ "answerOptions": [
522
+ {
523
+ "describe": "<p>When the search string changes, enqueue the request within a setTimeout.</p>",
524
+ "isRight": true
525
+ },
526
+ {
527
+ "describe": "<p>Ensure that the network request has the property debounce set to true.</p>",
528
+ "isRight": false
529
+ },
530
+ {
531
+ "describe": "<p>Store the timerId of the setTimeout last enqueued by the search string change handler.</p>",
532
+ "isRight": true
533
+ },
534
+ {
535
+ "describe": "<p>If there is an existing setTimeout and the search string changes, allow the existing setTimeout to finish, and do not enqueue a new setTimeout.</p>",
536
+ "isRight": false
537
+ },
538
+ {
539
+ "describe": "<p>If there is an existing setTimeout and the search string changes, cancel the existing setTimeout using the persisted timerId and replace it witha new setTimeout.</p>",
540
+ "isRight": true
541
+ }
542
+ ],
543
+ "analysis": "",
544
+ "hashCode": -1101212415
545
+ },
546
+ {
547
+ "describe": "<p>Refer to the following code:</p><p>01 &lt;html&gt;</p><p>02 &lt;body&gt;</p><p>03 &lt;div onclick=\"console.log('Outer message');\" &gt;</p><p>04 &lt;button id=\"myButton\"&gt;Click me!&lt;/button&gt;</p><p>05 &lt;/div&gt;</p><p>06 &lt;/body&gt;</p><p>07 &lt;script&gt;</p><p>08 function displayMessage(ev) {</p><p>09 ev.stopPropagation( ) ;</p><p>10 console.log('Inner message.') ;</p><p>11 }</p><p>12 const elem = document. getElementById('myButton') ;</p><p>13 elem.addEventListener('click', displayMessage) ;</p><p>14 &lt;/scrípt&gt;</p><p>15 &lt;/html&gt;</p><p>What will the console show when the button is clicked?</p><p></p>",
548
+ "answerOptions": [
549
+ {
550
+ "describe": "<p>Inner message</p>",
551
+ "isRight": true
552
+ },
553
+ {
554
+ "describe": "<p>Outer message</p>",
555
+ "isRight": false
556
+ },
557
+ {
558
+ "describe": "<p>Inner message Outer message</p>",
559
+ "isRight": false
560
+ },
561
+ {
562
+ "describe": "<p>Outer message Inner message</p>",
563
+ "isRight": false
564
+ }
565
+ ],
566
+ "analysis": "<p>The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.</p><p>https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation</p>",
567
+ "hashCode": 79169378
568
+ },
569
+ {
570
+ "describe": "<p>Which statement can a developer apply to increment the browser's navigation history without a page refresh?</p><p></p>",
571
+ "answerOptions": [
572
+ {
573
+ "describe": "<p>window.history.replaceState (newStateObject, ' ', null) ;</p>",
574
+ "isRight": false
575
+ },
576
+ {
577
+ "describe": "<p>window.history.state.push (newStateObject) ;</p>",
578
+ "isRight": false
579
+ },
580
+ {
581
+ "describe": "<p>window.history.pushState (newStateObject);</p>",
582
+ "isRight": false
583
+ },
584
+ {
585
+ "describe": "<p>window.history.pushState (newStateobject, ' ', null) ;</p>",
586
+ "isRight": true
587
+ }
588
+ ],
589
+ "analysis": "<p>https://developer.mozilla.org/en-US/docs/Web/API/History/pushState</p>",
590
+ "hashCode": 75700286
591
+ },
592
+ {
593
+ "describe": "<p>Which code statement below correctly persists an object in localStorage?</p><p></p>",
594
+ "answerOptions": [
595
+ {
596
+ "describe": "<p>const setLocalStorage = (storageKey, jsObject) =&gt; {</p><p>window.localStorage.persist (storageKey, jsObject) ;</p><p>}</p>",
597
+ "isRight": false
598
+ },
599
+ {
600
+ "describe": "<p>const setLocalStorage = (storageKey, jsObject) =&gt; { window.localStorage.setItem(storageKey, JSON. stringify(jsObject)) ;</p><p>}</p>",
601
+ "isRight": true
602
+ },
603
+ {
604
+ "describe": "<p>const setLocalStorage = (jsObject) =&gt; { window·localStorage·connectObject(jsObject);</p><p>}</p>",
605
+ "isRight": false
606
+ },
607
+ {
608
+ "describe": "<p>const setLocalStorage = (jsObject) =&gt; {</p><p>window.localStorage·setItem (jsObject);</p><p>}</p>",
609
+ "isRight": false
610
+ }
611
+ ],
612
+ "analysis": "<p>https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage</p>",
613
+ "hashCode": -615328800
614
+ },
615
+ {
616
+ "describe": "<p>Given the following code:</p><p>01 document.body.addEventListener('click', (event) =&gt; {</p><p>02 if (/* CODE REPLACEMENT HERE */) {</p><p>03 console.log( 'Button clicked!') ;</p><p>04 }</p><p>05 }) ;</p><p>Which replacement for the conditional statement on line 02 allows a developer to correctly determine that a button on the page is clicked?</p><p></p>",
617
+ "answerOptions": [
618
+ {
619
+ "describe": "<p>event.target.nodeName == 'BUTTON'</p>",
620
+ "isRight": true
621
+ },
622
+ {
623
+ "describe": "<p>button.addEventListener('click')</p>",
624
+ "isRight": false
625
+ },
626
+ {
627
+ "describe": "<p>e.nodeTarget == this</p>",
628
+ "isRight": false
629
+ },
630
+ {
631
+ "describe": "<p>event.clicked</p>",
632
+ "isRight": false
633
+ }
634
+ ],
635
+ "analysis": "",
636
+ "hashCode": 990457691
637
+ },
638
+ {
639
+ "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>Where can the developer see the log statement after loading the page in the browser?</p><p></p>",
640
+ "answerOptions": [
641
+ {
642
+ "describe": "<p>Browser JavaScript console</p>",
643
+ "isRight": true
644
+ },
645
+ {
646
+ "describe": "<p>Browser performance tools</p>",
647
+ "isRight": false
648
+ },
649
+ {
650
+ "describe": "<p>On the webpage</p>",
651
+ "isRight": false
652
+ },
653
+ {
654
+ "describe": "<p>Terminal running the web server</p>",
655
+ "isRight": false
656
+ }
657
+ ],
658
+ "analysis": "",
659
+ "hashCode": -950730568
660
+ },
661
+ {
662
+ "describe": "<p>Refer to the HTML below:</p><p>&lt;div id=\"main\"&gt;</p><p>&lt;div id=\"card-00\"&gt;This card is smaller.&lt;/div&gt;</p><p>&lt;div id=\"card-01\"&gt;The width and height of this card is determined by its contents. &lt;/div&gt;</p><p>&lt;/div&gt;</p><p>Which expression outputs the screen width of the element with the ID card-01?</p><p></p>",
663
+ "answerOptions": [
664
+ {
665
+ "describe": "<p>document.getElementById( 'card-01' ).style.width</p>",
666
+ "isRight": true
667
+ },
668
+ {
669
+ "describe": "<p>document.getElementById( 'card-01' ).innerHTML.length*6</p>",
670
+ "isRight": false
671
+ },
672
+ {
673
+ "describe": "<p>document.getElementById( 'card-01' ).width</p>",
674
+ "isRight": false
675
+ },
676
+ {
677
+ "describe": "<p>document.getElementById( 'card-01' ).getBoundingClientRect( ).width</p>",
678
+ "isRight": false
679
+ }
680
+ ],
681
+ "analysis": "<p>The :nth-child() CSS pseudo-class matches elements based on their position in a group of siblings.</p><p>https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child</p>",
682
+ "hashCode": -587254574
683
+ },
684
+ {
685
+ "describe": "<p>Which three actions can be done using the JavaScript browser console? Choose 3 answers</p>",
686
+ "answerOptions": [
687
+ {
688
+ "describe": "<p>View, change, and debug the JavaScript code of the page.</p>",
689
+ "isRight": true
690
+ },
691
+ {
692
+ "describe": "<p>View and change security cookies.</p>",
693
+ "isRight": false
694
+ },
695
+ {
696
+ "describe": "<p>View and change the DOM of the page.</p>",
697
+ "isRight": true
698
+ },
699
+ {
700
+ "describe": "<p>Display a report showing the performance of a page.</p>",
701
+ "isRight": false
702
+ },
703
+ {
704
+ "describe": "<p>Run code that is not related to the page.</p>",
705
+ "isRight": true
706
+ }
707
+ ],
708
+ "analysis": "",
709
+ "hashCode": 1569259728
710
+ },
711
+ {
712
+ "describe": "<p>Refer to the code below:</p><p>01 document.body.addEventListener('click', (event) =&gt; {</p><p>02 if ( /* ANSWER HERE */) {</p><p>03 console.log('myElement clicked!');</p><p>04 }</p><p>05 });</p><p>Which replacement for the conditional statement on line 02 allows a developer to correctly determine that a specific element, myElement, on the page had been clicked?</p><p></p>",
713
+ "answerOptions": [
714
+ {
715
+ "describe": "<p>e.nodeTarget == myElement</p>",
716
+ "isRight": false
717
+ },
718
+ {
719
+ "describe": "<p>button.addEventListener('click', 'myElement')</p>",
720
+ "isRight": false
721
+ },
722
+ {
723
+ "describe": "<p>event.target.id == 'myElement'</p>",
724
+ "isRight": true
725
+ },
726
+ {
727
+ "describe": "<p>myElement.clicked</p>",
728
+ "isRight": false
729
+ }
730
+ ],
731
+ "analysis": "",
732
+ "hashCode": 437895865
733
+ },
734
+ {
735
+ "describe": "<p>Refer to the following code:</p><p>01 &lt;html&gt;</p><p>02 &lt;body&gt;</p><p>03 &lt;span onclick=\"console.log('Span message');\"&gt;</p><p>04 &lt;button id=\"myButton\"&gt;Send message!&lt;/button&gt;</p><p>05 &lt;/span&gt;</p><p>06 &lt;/body&gt;</p><p>07 &lt;script&gt;</p><p>08 function displayMessage(ev) {</p><p>09 ev.stopPropagation();</p><p>10 console.log('Button message');</p><p>11 }</p><p>12 const elem = document.getElementById('myButton');</p><p>13 elem.addEventListener('click', displayMessage);</p><p>14 &lt;/script&gt;</p><p>15 &lt;/html&gt;</p><p>What will the console show when the button is clicked?</p><p></p>",
736
+ "answerOptions": [
737
+ {
738
+ "describe": "<p>Span message</p>",
739
+ "isRight": false
740
+ },
741
+ {
742
+ "describe": "<p>Button message Span message</p>",
743
+ "isRight": false
744
+ },
745
+ {
746
+ "describe": "<p>Span message Button message</p>",
747
+ "isRight": false
748
+ },
749
+ {
750
+ "describe": "<p>Button message</p>",
751
+ "isRight": true
752
+ }
753
+ ],
754
+ "analysis": "",
755
+ "hashCode": 1848855696
756
+ },
757
+ {
758
+ "describe": "<p>Refer to the following code:</p><p>01 &lt;html&gt;</p><p>02 &lt;div&gt;</p><p>03 &lt;button&gt;Click me!&lt;/button&gt;</p><p>04 &lt;/div&gt;</p><p>05 &lt;script&gt;</p><p>06 function displayInnerMessage(ev) {</p><p>07 console.log('Inner message.');</p><p>08 }</p><p>09 function displayOuterMessage(ev) {</p><p>10 console.log('Outer message.');</p><p>11 }</p><p>12</p><p>13 window.onload = (event) =&gt; {</p><p>14 document.querySelector('.outerDiv')</p><p>15 .addEventListener('click', displayOuterMessage, true);</p><p>16 document.querySelector('.myButton')</p><p>17 .addEventListener('click', displayInnerMessage, true);</p><p>18 };</p><p>19 &lt;/script&gt;</p><p>20 &lt;/html&gt;</p><p>What will the console show when the button is clicked?</p><p></p>",
759
+ "answerOptions": [
760
+ {
761
+ "describe": "<p>&gt; Outer message.</p>",
762
+ "isRight": false
763
+ },
764
+ {
765
+ "describe": "<p>&gt; Inner message.</p><p>&gt; Outer message.</p>",
766
+ "isRight": false
767
+ },
768
+ {
769
+ "describe": "<p>&gt; Inner message.</p>",
770
+ "isRight": true
771
+ },
772
+ {
773
+ "describe": "<p>&gt; Outer message.</p><p>&gt; Inner message.</p>",
774
+ "isRight": false
775
+ }
776
+ ],
777
+ "analysis": "",
778
+ "hashCode": -978870915
779
+ },
780
+ {
781
+ "describe": "<p>Refer to the HTML below:</p><p>&lt;div id=\"main\"&gt;</p><p>&lt;div id=\"card-00\"&gt;This card is smaller.&lt;/div&gt;</p><p>&lt;div id=\"card-01\"&gt;The width and height of this card is determined by its contents. &lt;/div&gt;</p><p>&lt;/div&gt;</p><p>Which statement outputs the height of the element with the ID card-01?</p><p></p>",
782
+ "answerOptions": [
783
+ {
784
+ "describe": "<p>document.getElementById( 'card-01' ).style.height</p>",
785
+ "isRight": false
786
+ },
787
+ {
788
+ "describe": "<p>(document.getElementById( 'card-01' ).innerHTML.length)/32)*6</p>",
789
+ "isRight": false
790
+ },
791
+ {
792
+ "describe": "<p>document.getElementById( 'card-01' ).height</p>",
793
+ "isRight": false
794
+ },
795
+ {
796
+ "describe": "<p>document.getElementById( 'card-01' ).getBoundingClientRect( ).height</p>",
797
+ "isRight": true
798
+ }
799
+ ],
800
+ "analysis": "",
801
+ "hashCode": -1734822652
802
+ },
803
+ {
804
+ "describe": "<p>A developer wants to create a simple image upload in the browser using the File API. The HTML is below:</p><p>&lt;imput type=\"file\" onchange=\"previewFile()\"&gt;</p><p>&lt;img src=\"\" height=\"200\" alt=\"Image preview…\"/&gt;</p><p>The JavaScript portion is:</p><p>01 function previewFile() {</p><p>02 const preview = document.querySelector('img');</p><p>03 const file = document.querySelector('input[type=file]').files[0];</p><p>04 // line 4 code</p><p>05 reader.addEventListener(\"load\", () =&gt; {</p><p>06 preview.src = reader.result;</p><p>07 }, false);</p><p>08 // line 8 code</p><p>09 }</p><p>In lines 04 and 08, which code allows the user to select an image from their local computer, and to display the image in the browser?</p><p></p>",
805
+ "answerOptions": [
806
+ {
807
+ "describe": "<p>04 const reader = new File();</p><p>08 if (file) reader.readAsDataURL(file);</p>",
808
+ "isRight": false
809
+ },
810
+ {
811
+ "describe": "<p>04 const reader = new FileReader();</p><p>08 if (file) URL.createObjectURL(file);</p>",
812
+ "isRight": true
813
+ },
814
+ {
815
+ "describe": "<p>04 const reader = new File();</p><p>08 if (file) URL.createObjectURL(file);</p>",
816
+ "isRight": false
817
+ },
818
+ {
819
+ "describe": "<p>document.getElementById( 'card-01' ).style.height</p>",
820
+ "isRight": false
821
+ }
822
+ ],
823
+ "analysis": "",
824
+ "hashCode": 599621267
825
+ },
826
+ {
827
+ "describe": "<p>Which two actions can be done using the JavaScript browser console? Choose 2 answers</p><p></p>",
828
+ "answerOptions": [
829
+ {
830
+ "describe": "<p>Run code that is not related to the page.</p>",
831
+ "isRight": true
832
+ },
833
+ {
834
+ "describe": "<p>Change the DOM and the JavaScript code of the page.</p>",
835
+ "isRight": true
836
+ },
837
+ {
838
+ "describe": "<p>Display a report showing the performance of a page.</p>",
839
+ "isRight": false
840
+ },
841
+ {
842
+ "describe": "<p>View the security cookies.</p>",
843
+ "isRight": false
844
+ }
845
+ ],
846
+ "analysis": "",
847
+ "hashCode": -981384439
848
+ }
849
+ ],
850
+ "hashCode": 2013466315
851
+ }