Free CRT-600 Exam Braindumps (page: 22)

Page 21 of 57

A developer wrote a fizzbuzz function that when passed in a number, returns the following:
`Fizz' if the number is divisible by 3.
`Buzz' if the number is divisible by 5.
`Fizzbuzz' if the number is divisible by both 3 and 5. 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

  1. let res = fizzbuzz(5);
    console.assert ( res === ` ' );
  2. let res = fizzbuzz(15);
    console.assert ( res === ` fizzbuzz ' )
  3. let res = fizzbuzz(Infinity);
    console.assert ( res === ` ' )
  4. let res = fizzbuzz(3);
    console.assert ( res === ` buzz ' )

Answer(s): B,C,D



A developer has code that calculates a restaurant bill, but generates incorrect answers while testing the code:
function calculateBill ( items ) {
let total = 0;
total += findSubTotal(items);
total += addTax(total);
total += addTip(total);
return total;
}
Which option allows the developer to step into each function execution within calculateBill?

  1. Using the debugger command on line 05.
  2. Using the debugger command on line 03
  3. Calling the console.trace (total) method on line 03.
  4. Wrapping findSubtotal in a console.log() method.

Answer(s): A



The developer has a function that prints "Hello" to an input name. To test this, thedeveloper created a function that returns "World". However the following snippet does not print " Hello World".



What can the developer do to change the code to print "Hello World" ?

  1. Change line 7 to ) () ;
  2. Change line 2 to console.log(`Hello' , name() );
  3. Change line 9 to sayHello(world) ();
  4. Change line 5 to function world ( ) {

Answer(s): B



A developer has the function, shown below, that is called when a page loads.
function onload() {
console.log("Page has loaded!");
}
Where can the developer see the log statement after loading the page in the browser?

  1. Terminal running the web server.
  2. Browser performance toots
  3. Browser javaScript console
  4. On the webpage.

Answer(s): C






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

CRT-600 Discussions & Posts