@palerock/exam-qa 1.0.6-patch15 → 1.0.6-patch17
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/static/js/manifest.3ad1d5771e9b13dbdad2.js.map +1 -1
- package/lib-json/[JS]/347/254/254/344/270/200/347/253/240 /345/217/230/351/207/217-/347/261/273/345/236/213-/351/233/206/345/220/210.json" +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/map.json +8 -1
- package/package.json +1 -1
@@ -0,0 +1,356 @@
|
|
1
|
+
{
|
2
|
+
"title": "[JS]第七章 测试",
|
3
|
+
"category": "JS-1",
|
4
|
+
"questions": [
|
5
|
+
{
|
6
|
+
"describe": "<p>The developer wants to test this code:</p><p>const toNumber = (strOrNum) => +strOrNum ;</p><p>Which two tests are most accurate for this code? Choose 2 answers</p>",
|
7
|
+
"answerOptions": [
|
8
|
+
{
|
9
|
+
"describe": "<p>console.assert (toNumber('-3') < 0) ;</p>",
|
10
|
+
"isRight": false
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"describe": "<p>console.assert (Number.isNaN (toNumber( ))) ;</p>",
|
14
|
+
"isRight": true
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"describe": "<p>console.assert (toNumber ( )== NaN) ;</p>",
|
18
|
+
"isRight": false
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"describe": "<p>console.assert (toNumber('2') === 2) ;</p>",
|
22
|
+
"isRight": true
|
23
|
+
}
|
24
|
+
],
|
25
|
+
"analysis": "<p>explain: +'2' will be converted to 2, which is a number</p><p>toNumber(), output: NaN</p><p>console.assert (toNumber('-3') < 0) ; is not most accurate</p>",
|
26
|
+
"hashCode": -1147043528
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"describe": "<p>The developer wants to test the array shown:</p><p>const arr = Array(5). fill(0);</p><p>Which two tests are the most accurate for this array? Choose 2 answers</p>",
|
30
|
+
"answerOptions": [
|
31
|
+
{
|
32
|
+
"describe": "<p>arr . forEach(elem => console . assert(elem === 0)) ;</p>",
|
33
|
+
"isRight": true
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"describe": "<p>console . assert(arr[0] === 0 && arr[arr . length] === 0) ;</p>",
|
37
|
+
"isRight": false
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"describe": "<p>console . assert (arr . length === 5) ;</p>",
|
41
|
+
"isRight": true
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"describe": "<p>console . assert (arr . length > 0);</p>",
|
45
|
+
"isRight": false
|
46
|
+
}
|
47
|
+
],
|
48
|
+
"analysis": "<p>console . assert(arr[0] === 0 && arr[arr . length] === 0) ; is not most accurate</p>",
|
49
|
+
"hashCode": 1515758694
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"describe": "<p>Given the code below:</p><p>function f(arr){</p><p>return arr.reduce(function(a, b){</p><p>return a + b;</p><p>});</p><p>}</p><p>let res = f([2, 3, 4]);</p><p>which of the following code lines will assert the method adds the numbers in the array passed in?</p>",
|
53
|
+
"answerOptions": [
|
54
|
+
{
|
55
|
+
"describe": "<p>console.log(res === 9);</p>",
|
56
|
+
"isRight": false
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"describe": "<p>console.assert(res != 9);</p>",
|
60
|
+
"isRight": false
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"describe": "<p>console.error(res != 9);</p>",
|
64
|
+
"isRight": false
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"describe": "<p>console.assert(res === 9);</p>",
|
68
|
+
"isRight": true
|
69
|
+
}
|
70
|
+
],
|
71
|
+
"analysis": "<p>console.assert(res === 9); is the correct way of writing assertion. If the assertion is true, nothing will happen. If the assertion is false, it will show an error message on the console.</p><p>console.log(res === 9) and console.error(res != 9); are not used to assert values.</p>",
|
72
|
+
"hashCode": 835810537
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"describe": "<p>Given the code below:</p><p>let res = sum3([1, 2, 3]);</p><p>console.assert(res === 6);</p><p>The sum3 method gets updated to multiply the numbers instead of adding them. Line 2 is now a false positive assertion. How can the test be changed to fix it? Choose 1 answer.</p>",
|
76
|
+
"answerOptions": [
|
77
|
+
{
|
78
|
+
"describe": "<p>let res = sum3([1, 2, 3, 4]);</p><p>console.assert(res === 10);</p>",
|
79
|
+
"isRight": false
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"describe": "<p>let res = sum3([1, 2]);</p><p>console.assert(res === 3);</p>",
|
83
|
+
"isRight": false
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"describe": "<p>let res = sum3([1, 2, 3, 4]);</p><p>console.assert(res === 24);</p>",
|
87
|
+
"isRight": true
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"describe": "<p>let res = sum3([3, 2, 1]);</p><p>console.assert(res === 6);</p>",
|
91
|
+
"isRight": false
|
92
|
+
}
|
93
|
+
],
|
94
|
+
"analysis": "<p>The correct answer is:</p><p>let res = sum3([1, 2, 3, 4]);</p><p>console.assert(res === 24);</p><p>Adding another number in the sequence ensures the result is different if added or multiplied. The rest of the assertions are either wrong or no difference.</p>",
|
95
|
+
"hashCode": -1461975055
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"describe": "<p>Mocha is a very popular JavaScript Testing framework running on Node.js. James is a developer who is new to this and he is asked by his manager to take care of some issues. Currently, there are over hundreds of tests but he only wants to run certain tests to test the code. What would you suggest to him in this scenario? Choose 1 answer.</p>",
|
99
|
+
"answerOptions": [
|
100
|
+
{
|
101
|
+
"describe": "<p>Append .only() to the functions that he needs to work on.</p>",
|
102
|
+
"isRight": true
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"describe": "<p>Comment out the test cases that are irrelevant.</p>",
|
106
|
+
"isRight": false
|
107
|
+
},
|
108
|
+
{
|
109
|
+
"describe": "<p>Append .exclude() to the functions that he doesn’t need to work on.</p>",
|
110
|
+
"isRight": false
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"describe": "<p>Append .skip() to the functions that he doesn’t need to work on.</p>",
|
114
|
+
"isRight": false
|
115
|
+
}
|
116
|
+
],
|
117
|
+
"analysis": "<p>Append .only() to the functions that he needs to work on is the correct answer. For example:</p><p>describe('Test', function () {</p><p>describe.only('Test 1', function () {</p><p>it('Test 1 Item A', function () {</p><p>// this test will not be run</p><p>});</p><p>it.only('Test 1 Item B', function () {</p><p>// this test will be run</p><p>});</p><p>});</p><p>describe('Test 2', function () {</p><p>it('Test 2 Item A', function () {</p><p>// this test will not be run</p><p>});</p><p>it.only('Test 2 Item B', function () {</p><p>// this test will also be run</p><p>});</p><p>});</p><p>});</p><p>.skip() can be appended to functions to exclude test cases, however, there are hundreds of test cases and the developer only wants to run certain tests, hence using .only() is more appropriate.</p><p>There is no function called .exclude() in Mocha testing framework.</p><p>Comment out the test cases is really unnecessary.</p>",
|
118
|
+
"hashCode": -1798172481
|
119
|
+
},
|
120
|
+
{
|
121
|
+
"describe": "<p>Which of the following is the most popular testing frameworks used by JavaScript developers? Choose 3 answers</p>",
|
122
|
+
"answerOptions": [
|
123
|
+
{
|
124
|
+
"describe": "<p>Puppeteer</p>",
|
125
|
+
"isRight": true
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"describe": "<p>TestNG</p>",
|
129
|
+
"isRight": false
|
130
|
+
},
|
131
|
+
{
|
132
|
+
"describe": "<p>Junit</p>",
|
133
|
+
"isRight": false
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"describe": "<p>Mocha</p>",
|
137
|
+
"isRight": true
|
138
|
+
},
|
139
|
+
{
|
140
|
+
"describe": "<p>Jasmine</p>",
|
141
|
+
"isRight": true
|
142
|
+
}
|
143
|
+
],
|
144
|
+
"analysis": "<p>Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun.</p><p>Puppeteer is a Node library which provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol.</p><p>Jasmine is a behavior-driven development framework for testing JavaScript code.</p><p>JUnit is a unit testing framework for the Java programming language.</p><p>TestNG is also an open-source automation testingframework specifically designed for Java Programming language.</p>",
|
145
|
+
"hashCode": 1566473470
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"describe": "<p>Which of the test type descriptions is incorrect?</p>",
|
149
|
+
"answerOptions": [
|
150
|
+
{
|
151
|
+
"describe": "<p>Integration Testing is testing the integration of different parts of the system together.</p>",
|
152
|
+
"isRight": false
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"describe": "<p>Unit Testing is a software testing method by which it tests if individual components/units of an application match the requirements.</p>",
|
156
|
+
"isRight": false
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"describe": "<p>Beta Testing is usually carried out by testers which uses both white-box and black-box testing techniques.</p>",
|
160
|
+
"isRight": true
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"describe": "<p>Functional Testing is a black-box testing technique, where the functionality of the application is tested to generate the desired output on providing a certain input.</p>",
|
164
|
+
"isRight": false
|
165
|
+
}
|
166
|
+
],
|
167
|
+
"analysis": "<p>All of the test type descriptions are correct except that Beta Testing is usually performed by clients or end-users who are not employees of the organization and typically uses black-box testing technique only. Alpha Testing is usually carried out by testers and involves both the white-box and black-box techniques.</p>",
|
168
|
+
"hashCode": 1351002996
|
169
|
+
},
|
170
|
+
{
|
171
|
+
"describe": "<p>A developer wrote a fizzbuzz function that when passed in a number, returns the following:</p><p>'fizz' if the number is divisible by 3.</p><p>'buzz' if the number is divisible by 5.</p><p>'fizzbuzz' if the number is divisible by both 3 and 5.</p><p>empty string if the number is divisible by neither 3 or 5.Which two test cases will properly test scenarios for the fizzbuzz function? Choose 2 answers</p>",
|
172
|
+
"answerOptions": [
|
173
|
+
{
|
174
|
+
"describe": "<p>let res = fizzbuzz(5) ;</p><p>console.assert(res === ' ') ;</p>",
|
175
|
+
"isRight": false
|
176
|
+
},
|
177
|
+
{
|
178
|
+
"describe": "<p>let res = fizzbuzz(15) ;</p><p>console.assert(res === 'fizzbuzz') ;</p>",
|
179
|
+
"isRight": true
|
180
|
+
},
|
181
|
+
{
|
182
|
+
"describe": "<p>let res = fizzbuzz (Infinity);</p><p>console.assert(res === ' ');</p>",
|
183
|
+
"isRight": true
|
184
|
+
},
|
185
|
+
{
|
186
|
+
"describe": "<p>let res = fizzbuzz(3);</p><p>console.assert(res === 'buzz');</p>",
|
187
|
+
"isRight": false
|
188
|
+
}
|
189
|
+
],
|
190
|
+
"analysis": "",
|
191
|
+
"hashCode": -1211075237
|
192
|
+
},
|
193
|
+
{
|
194
|
+
"describe": "<p>A developer wrote the following code to test a sum3 function that takes in an array of numbers and returns the sum of the first three numbers in the array, and the test passes.</p><p>01 let res = sum3([1, 4, 1]);</p><p>02 console.assert(res === 6);</p><p>0З</p><p>04 res = sum3([1, 5, 0, 5]);</p><p>05 console.assert(res === 6);</p>",
|
195
|
+
"answerOptions": [
|
196
|
+
{
|
197
|
+
"describe": "<p>different developer made changes to the behavior of sum3 to instead sum only the first 2 numbers present in the array.</p><p>Which two results occur when running this test on the updated sum3 function? Choose 2 answers</p><p>A The line 02 assertion fails.</p>",
|
198
|
+
"isRight": true
|
199
|
+
},
|
200
|
+
{
|
201
|
+
"describe": "<p>The line 05 assertion passes.</p>",
|
202
|
+
"isRight": true
|
203
|
+
},
|
204
|
+
{
|
205
|
+
"describe": "<p>The line 02 assertion passes.</p>",
|
206
|
+
"isRight": false
|
207
|
+
},
|
208
|
+
{
|
209
|
+
"describe": "<p>The line 05 assertion fails.</p>",
|
210
|
+
"isRight": false
|
211
|
+
}
|
212
|
+
],
|
213
|
+
"analysis": "<p>原本的sum3函数是将求组前三项求和,因此题目中的两个assert可以通过。 将函数改成将求组前两个求和,那么第一个assert的求组就fail了,此时的res是5</p>",
|
214
|
+
"hashCode": 269951395
|
215
|
+
},
|
216
|
+
{
|
217
|
+
"describe": "<p>A test has a dependency on database.query. During the test the dependency is replaced with an object called database with the method, query, that returns an array. The developer needs to verify how many times the method was called and the arguments used each time.</p><p>Which two test approaches describe the requirement?Choose 2 answers</p><p></p>",
|
218
|
+
"answerOptions": [
|
219
|
+
{
|
220
|
+
"describe": "<p>Black box</p>",
|
221
|
+
"isRight": false
|
222
|
+
},
|
223
|
+
{
|
224
|
+
"describe": "<p>Integration</p>",
|
225
|
+
"isRight": false
|
226
|
+
},
|
227
|
+
{
|
228
|
+
"describe": "<p>White box</p>",
|
229
|
+
"isRight": true
|
230
|
+
},
|
231
|
+
{
|
232
|
+
"describe": "<p>Mocking</p>",
|
233
|
+
"isRight": true
|
234
|
+
}
|
235
|
+
],
|
236
|
+
"analysis": "<p>Black Box Testing is a software testing method in which the internal structure/ design/ implementation of the item being tested is not known to the tester.</p><p>White Box Testing is a software testing method in which the internal structure/ design/ implementation of the item being tested is known to the tester</p><p>integration testing – testing your application as it connects with services inside (or outside) of your application</p>",
|
237
|
+
"hashCode": 1349240068
|
238
|
+
},
|
239
|
+
{
|
240
|
+
"describe": "<p>A developer removes the HTML class attrbuite from the checkoutbutton, so now it is simply:</p><p>Checkout .</p><p>There is a test to verify the existence of the checkout button, however it looks for a button with class=\"blue\". The test fails because no such button is found.</p><p>Which type of test category describes this test?</p><p></p>",
|
241
|
+
"answerOptions": [
|
242
|
+
{
|
243
|
+
"describe": "<p>False negative</p>",
|
244
|
+
"isRight": false
|
245
|
+
},
|
246
|
+
{
|
247
|
+
"describe": "<p>True positive</p>",
|
248
|
+
"isRight": false
|
249
|
+
},
|
250
|
+
{
|
251
|
+
"describe": "<p>True negative</p>",
|
252
|
+
"isRight": true
|
253
|
+
},
|
254
|
+
{
|
255
|
+
"describe": "<p>False positive</p>",
|
256
|
+
"isRight": false
|
257
|
+
}
|
258
|
+
],
|
259
|
+
"analysis": "",
|
260
|
+
"hashCode": 1279788027
|
261
|
+
},
|
262
|
+
{
|
263
|
+
"describe": "<p>The developer wants to test this code:</p><p>const stringifyNumber = (num) => Number(num).toString();</p><p>Which two tests are the most accurate for this code? Choose 2 answers</p><p></p>",
|
264
|
+
"answerOptions": [
|
265
|
+
{
|
266
|
+
"describe": "<p>console.assert(stringifyNunber() === 'NaN')</p>",
|
267
|
+
"isRight": false
|
268
|
+
},
|
269
|
+
{
|
270
|
+
"describe": "<p>console.assert(typeof stringifyNumber(2) === 'string')</p>",
|
271
|
+
"isRight": true
|
272
|
+
},
|
273
|
+
{
|
274
|
+
"describe": "<p>console.assert(stringifyNumber(-2) === '-2')</p>",
|
275
|
+
"isRight": true
|
276
|
+
},
|
277
|
+
{
|
278
|
+
"describe": "<p>console.assert(stringifyNumber(' ') == '0' )</p>",
|
279
|
+
"isRight": false
|
280
|
+
}
|
281
|
+
],
|
282
|
+
"analysis": "",
|
283
|
+
"hashCode": -2043818043
|
284
|
+
},
|
285
|
+
{
|
286
|
+
"describe": "<p>A test has a dependency on database.query. During the test the dependency is replaced with an object called database with the method, query, that returns an array. The developer does not need to verify how many times the method has been called. Which two test approaches describe the requirement? Choose 2 answers</p><p></p>",
|
287
|
+
"answerOptions": [
|
288
|
+
{
|
289
|
+
"describe": "<p>Stubbing</p>",
|
290
|
+
"isRight": false
|
291
|
+
},
|
292
|
+
{
|
293
|
+
"describe": "<p>Black box</p>",
|
294
|
+
"isRight": false
|
295
|
+
},
|
296
|
+
{
|
297
|
+
"describe": "<p>Substitution</p>",
|
298
|
+
"isRight": true
|
299
|
+
},
|
300
|
+
{
|
301
|
+
"describe": "<p>White box</p>",
|
302
|
+
"isRight": true
|
303
|
+
}
|
304
|
+
],
|
305
|
+
"analysis": "",
|
306
|
+
"hashCode": 115201245
|
307
|
+
},
|
308
|
+
{
|
309
|
+
"describe": "<p>A developer wrote the following code to test a sum3 function that takes in an array of numbers and returns the sum of the first three numbers in the array. The test passes:</p><p>01 let res = sum3([1, 2, 3]);</p><p>02 console.assert(res === 6);</p><p>0З</p><p>04 res = sum3([1, 2, 3, 4]);</p><p>05 console.assert(res === 6);</p><p></p>",
|
310
|
+
"answerOptions": [
|
311
|
+
{
|
312
|
+
"describe": "<p>different developer made changes to the behavior of sum3 to instead sum all of the numbers present in the array. Which two results occur when running this test on the updated sum3 function? Choose 2 answers</p><p>A The line 02 assertion fails.</p>",
|
313
|
+
"isRight": false
|
314
|
+
},
|
315
|
+
{
|
316
|
+
"describe": "<p>The line 05 assertion passes.</p>",
|
317
|
+
"isRight": false
|
318
|
+
},
|
319
|
+
{
|
320
|
+
"describe": "<p>The line 02 assertion passes.</p>",
|
321
|
+
"isRight": true
|
322
|
+
},
|
323
|
+
{
|
324
|
+
"describe": "<p>The line 05 assertion fails.</p>",
|
325
|
+
"isRight": true
|
326
|
+
}
|
327
|
+
],
|
328
|
+
"analysis": "",
|
329
|
+
"hashCode": 1254240553
|
330
|
+
},
|
331
|
+
{
|
332
|
+
"describe": "<p>A developer removes the checkout button that looked like this:</p><p><button class = 'blue'>Checkout</button></p><p>There are multiple components in the component with class ='blue'. An existing test verifies the existence of the checkout button, however it looks for a button with class='blue'. It succeeds because a button with class='blue' is found. Which type of test category describes this test?</p><p></p>",
|
333
|
+
"answerOptions": [
|
334
|
+
{
|
335
|
+
"describe": "<p>true positive</p>",
|
336
|
+
"isRight": true
|
337
|
+
},
|
338
|
+
{
|
339
|
+
"describe": "<p>false negative</p>",
|
340
|
+
"isRight": false
|
341
|
+
},
|
342
|
+
{
|
343
|
+
"describe": "<p>false positive</p>",
|
344
|
+
"isRight": false
|
345
|
+
},
|
346
|
+
{
|
347
|
+
"describe": "<p>true negative</p>",
|
348
|
+
"isRight": false
|
349
|
+
}
|
350
|
+
],
|
351
|
+
"analysis": "",
|
352
|
+
"hashCode": -994254076
|
353
|
+
}
|
354
|
+
],
|
355
|
+
"hashCode": -1308319513
|
356
|
+
}
|