Free CRT-600 Exam Braindumps (page: 8)

Page 7 of 57

Refer to the code below:

Async funct on functionUnderTest(isOK) {
If (isOK) return `OK' ;
Throw new Error(`not OK');
)
Which assertion accurately tests the above code?

  1. Console.assert (await functionUnderTest(true), ` OK ')
  2. Console.assert (await functionUnderTest(true), ` not OK ')
  3. Console.assert (await functionUnderTest(true), ` not OK ')
  4. Console.assert (await functionUnderTest(true), `OK')

Answer(s): D



Consider type coercion, what does the following expression evaluate to? True + 3 + `100' + null

  1. 104
  2. 4100
  3. `3100null'
  4. `4100null'

Answer(s): D



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 number in the array, The test passes:
Let res = sum2([1, 2, 3 ]) ;
console.assert(res === 6 );
Res = sum3([ 1, 2, 3, 4]);
console.assert(res=== 6);
A different developer made changes to the behavior of sum3 to instead sum all of the numbers present in the array. The test passes:
Which two results occur when running the test on the updated sum3 function ? Choose 2 answers

  1. The line 02 assertion passes.
  2. The line 02 assertion fails
  3. The line 05 assertion passes.
  4. The line 05 assertion fails.

Answer(s): A,D



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.
Here is the HTML file content:

<input type =" text" value="Hello" name ="input">
<button type ="button" >Display </button>
The developer wrote the javascript code below:
Const button = document.querySelector(`button');
button.addEvenListener(`click', () => (
Const input = document.querySelector(`input');
console.log(input.getAttribute(`value'));
When the user clicks the button, the output is always "Hello".
What needs to be done make this code work as expected?

  1. Replace line 04 with console.log(input .value);
  2. Replace line 03 with const input = document.getElementByName(`input');
  3. Replace line 02 with button.addEventListener("onclick", function() {
  4. Replace line 02 with button.addCallback("click", function() {

Answer(s): A






Post your Comments and Discuss Salesforce CRT-600 exam with other Community members:

CRT-600 Discussions & Posts