[2021] CRT-600 PDF Questions - Perfect Prospect To Go With DumpsReview Practice Exam
Salesforce CRT-600 Pdf Questions - Outstanding Practice To your Exam
NEW QUESTION 10
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?
- A. Calling the console.trace (total) method on line 03.
- B. Using the debugger command on line 05.
- C. Wrapping findSubtotal in a console.log() method.
- D. Using the debugger command on line 03
Answer: B
NEW QUESTION 11
A developer needs to test this function:
01 const sum3 = (arr) => (
02 if (!arr.length) return 0,
03 if (arr.length === 1) return arr[0],
04 if (arr.length === 2) return arr[0] + arr[1],
05 return arr[0] + arr[1] + arr[2],
06 );
Which two assert statements are valid tests for the function?
Choose 2 answers
- A. console.assert(sum3('hello', 2, 3, 4)) === NaN);
- B. console.assert(sum3(1, '2')) == 12);
- C. console.assert(sum3(0)) == 0);
- D. console.assert(sum3(-3, 2 )) == -1);
Answer: B,D
NEW QUESTION 12
In which situation should a developer include a try .. catch block around their function call ?
- A. The function contains scheduled code.
- B. The function might raise a runtime error that needs to be handled.
- C. The function has an error that should not be silenced.
- D. The function results in an out of memory issue.
Answer: B
NEW QUESTION 13
A developer is setting up a new Node.js server with a client library that is built using events and callbacks.
The library:
* Will establish a web socket connection and handle receipt of messages to the server
* Will be imported with require, and made available with a variable called we.
The developer also wants to add error logging if a connection fails.
Given this info, which code segment shows the correct way to set up a client with two events that listen at execution time?
- A. try{
ws.connect (( ) => {
console.log('connected to client'); });
} catch(error) { console.log('ERROR' , error); };
} - B. ws.on ('connect', ( ) => { console.log('connected to client'); }}; ws.on('error', (error) => { console.log('ERROR' , error); }};
- C. ws.connect (( ) => {
console.log('connected to client'); }).catch((error) => { console.log('ERROR' , error); }}; - D. ws.on ('connect', ( ) => {
console.log('connected to client'); ws.on('error', (error) => { console.log('ERROR' , error); });
});
Answer: B
NEW QUESTION 14
Refer to the code below:
const event = new CustomEvent(
//Missing Code
);
obj.dispatchEvent(event);
A developer needs to dispatch a custom event called update to send information about recordId.
Which two options could a developer insert at the placeholder in line 02 to achieve this?
Choose 2 answers
- A. 'Update' , '123abc'
- B. 'Update' , (
recordId : '123abc'
( - C. 'Update' , {
Details : {
recordId : '123abc'
}
} - D. { type : 'update', recordId : '123abc' }
Answer: B,C
NEW QUESTION 15
Which function should a developer use to repeatedly execute code at a fixed interval ?
- A. setPeriod
- B. setTimeout
- C. setInteria
- D. setIntervel
Answer: D
NEW QUESTION 16
GIven a value, which three options can a developer use to detect if the value is NaN?
Choose 3 answers !
- A. Number.isNaN(value)
- B. Object.is(value, NaN)
- C. value === Number.NaN
- D. value == NaN
- E. value ! == value
Answer: A,D
NEW QUESTION 17
Refer to the code below:
Async funct on functionUnderTest(isOK) {
If (isOK) return 'OK' ;
Throw new Error('not OK');
)
Which assertion accuretely tests the above code?
- A. Console.assert (await functionUnderTest(true), 'OK')
- B. Console.assert (await functionUnderTest(true), ' OK ')
- C. Console.assert (await functionUnderTest(true), ' not OK ')
- D. Console.assert (await functionUnderTest(true), ' not OK ')
Answer: A
NEW QUESTION 18
What is the result of the code block?
- A. The console logs 'flag' and then an error is thrown.
- B. The console logs only 'flag'.
- C. An error is thrown.
- D. The console logs 'flag' and another flag.
Answer: A
NEW QUESTION 19
Refer to the code below:
Let inArray =[ [ 1, 2 ] , [ 3, 4, 5 ] ];
Which two statements result in the array [1, 2, 3, 4, 5] ?
Choose 2 answers
- A. [ ]. concat.apply(inArray, [ ]);
- B. [ ]. Concat.apply ([ ], inArray);
- C. [ ]. concat ( [ ....inArray ] );
- D. [ ]. Concat (... inArray);
Answer: B,D
NEW QUESTION 20
Refer to the code below:
new Promise((resolve, reject) => {
const fraction = Math.random();
if( fraction >0.5) reject("fraction > 0.5, " + fraction);
resolve(fraction);
})
.then(() =>console.log("resolved"))
.catch((error) => console.error(error))
.finally(() => console.log(" when am I called?"));
When does Promise.finally on line 08 get called?
- A. When resolved or rejected
- B. When rejected
- C. WHen resolved
- D. When resolved and settled
Answer: A
NEW QUESTION 21
Refer to the code below:
Const resolveAfterMilliseconds = (ms) => Promise.resolve (
setTimeout (( => console.log(ms), ms ));
Const aPromise = await resolveAfterMilliseconds(500);
Const bPromise = await resolveAfterMilliseconds(500);
Await aPromise, wait bPromise;
What is the result of running line 05?
- A. Only aPromise runs.
- B. aPromise and bPromise run sequentially.
- C. Neither aPromise or bPromise runs.
- D. aPromise and bPromise run in parallel.
Answer: C
NEW QUESTION 22
Refer to the code below:
const addBy = ?
const addByEight =addBy(8);
const sum = addBYEight(50);
Which two functions can replace line 01 and return 58 to sum?
Choose 2 answers
- A. const addBy = (num1) => num1 + num2 ;
- B. const addBy = function(num1){
return num1 + num2;
} - C. const addBY = (num1) => (num2) => num1 + num2;
- D. const addBy = function(num1){
return function(num2){
return num1 + num2;
}
Answer: C,D
NEW QUESTION 23
Refer to the following code that performs a basic mathematical operation on a provided input:
function calculate(num) {
Return (num +10) / 3;
}
How should line 02 be written to ensure that x evaluates to 6 in the line below?
Let x = calculate (8);
- A. Return Number(num + 10) / 3;
- B. Return Number((num +10) /3 );
- C. Return (Number (num +10 ) / 3;
- D. Return Integer(num +10) /3;
Answer: C
NEW QUESTION 24
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
- A. let res = fizzbuzz(15);
console.assert ( res === ' fizzbuzz ' ) - B. let res = fizzbuzz(Infinity);
console.assert ( res === ' ' ) - C. let res = fizzbuzz(5);
console.assert ( res === ' ' ); - D. let res = fizzbuzz(3);
console.assert ( res === ' buzz ' )
Answer: A,B,D
NEW QUESTION 25
Refer to code below:
Let a ='a';
Let b;
// b = a;
console.log(b);
What is displayed when the code executes?
- A. ReferenceError: b is not defined
- B. Undefined
- C. A
- D. Null
Answer: B
NEW QUESTION 26
What are two unique features of functions defined with a fat arrow as compared to normal function definition?
Choose 2 answers
- A. The function generated its own this making it useful for separating the function's scope from its enclosing scope.
- B. The function uses the this from the enclosing scope.
- C. If the function has a single expression in the function body, the expression will be evaluated and implicit returned.
- D. The function receives an argument that is always in scope, called parentThis, which is the enclosing lexical scope.
Answer: A,C
NEW QUESTION 27
Refer to the following object:
const cat ={
firstName: 'Fancy',
lastName: ' Whiskers',
Get fullName() {
return this.firstName + ' ' + this.lastName;
}
};
How can a developer access the fullName property for cat?
- A. cat.function.fullName()
- B. cat.fullName()
- C. cat.fullName
- D. cat.get.fullName
Answer: C
NEW QUESTION 28
Refer to the code below:
Line 05 causes an error.
What are the values of greeting and salutation once code completes?
- A. Greeting is Goodbye and salutation is I say Hello.
- B. Greeting is Goodbye and salutation is Hello, Hello.
- C. Greeting is Hello and salutation is Hello, Hello.
- D. Greeting is Hello and salutation is I say hello.
Answer: C
NEW QUESTION 29
Refer to code below:
Function muFunction(reassign){
Let x = 1;
var y = 1;
if( reassign ) {
Let x= 2;
Var y = 2;
console.log(x);
console.log(y);}
console.log(x);
console.log(y);}
What is displayed when myFunction(true) is called?
- A. 2 2 1 2
- B. 2 2 undefined undefined
- C. 2 2 2 2
- D. 2 2 1 1
Answer: A
NEW QUESTION 30
developer has a web server running with Node.js. The command to start the web server is node server,js. The web server started having latency issues. Instead of a one second turn around for web requests, the developer now sees a five second turnaround, Which command can the web developer run to see what the module is doing during the latency period?
- A. DEBUG =true node server.js
- B. DEBUG = http, https node server.js
- C. NODE_DEBUG =true node server.js
- D. NODE_DEBUG =http, https node server.js
Answer: A
NEW QUESTION 31
Refer to the following array:
Let arr1 = [ 1, 2, 3, 4, 5 ];
Which two lines of code result in a second array, arr2 being created such that arr2 is not a reference to arr1?
- A. Let arr2 = arr1.slice(0, 5);
- B. Let arr2 = Array.from(arr1);
- C. Let arr2 = arr1.sort();
- D. Let arr2 = arr1;
Answer: A,B
NEW QUESTION 32
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?
- A. Browser performance toots
- B. On the webpage.
- C. Browser javaScript console
- D. Terminal running the web server.
Answer: C
NEW QUESTION 33
......
Online Questions - Outstanding Practice To your CRT-600 Exam: https://www.dumpsreview.com/CRT-600-exam-dumps-review.html
Practice To CRT-600 - DumpsReview Remarkable Practice On your Salesforce Certified JavaScript Developer I Exam: https://drive.google.com/open?id=15DqPN_r4aRd7TUs5Qjq8-snthTBwnH72

