0% found this document useful (0 votes)
31 views4 pages

Salesforce JavaScript Developer I Exam Q&A

The document contains a series of questions and answers related to the Salesforce Certified JavaScript Developer I exam. It includes code snippets and asks for correct execution methods, valid test assertions, and outcomes of promise races. Each question is followed by multiple-choice answers and the correct options are indicated with explanations.

Uploaded by

Vikash Yadav
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views4 pages

Salesforce JavaScript Developer I Exam Q&A

The document contains a series of questions and answers related to the Salesforce Certified JavaScript Developer I exam. It includes code snippets and asks for correct execution methods, valid test assertions, and outcomes of promise races. Each question is followed by multiple-choice answers and the correct options are indicated with explanations.

Uploaded by

Vikash Yadav
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Salesforce

JAVASCRIPT-DEVELOPER-I Exam
Salesforce Certified JavaScript Developer I
Questions & Answers
Demo
Questions & Answers PDF Page 2

Version: 12.2

Question: 1

Refer to the code below:


01 const exec = (item, delay) =>{
02 new Promise(resolve => setTimeout( () => resolve(item), delay)),
03 async function runParallel() {
04 Const (result1, result2, result3) = await [Link]{
05 [exec (‘x’, ‘100’) , exec(‘y’, 500), exec(‘z’, ‘100’)]
06 );07 return `parallel is done: $(result1) $(result2)$(result3)`;
08 }}}
Which two statements correctly execute the runParallel () function?
Choose 2 answers

A. Async runParallel () .then(data);


B. runParallel ( ). done(function(data){
return data;});
C. runParallel () .then(data);
D. runParallel () .then(function(data)
return data

Answer: B, D
Explanation:

Question: 2

A developer needs to test this function:


01 const sum3 = (arr) => (
02 if (![Link]) return 0,
03 if ([Link] === 1) return arr[0],
04 if ([Link] === 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. [Link](sum3(1, ‘2’)) == 12);


B. [Link](sum3(0)) == 0);
C. [Link](sum3(-3, 2 )) == -1);
Questions & Answers PDF Page 3

D. [Link](sum3(‘hello’, 2, 3, 4)) === NaN);

Answer: A, C
Explanation:

Question: 3

Which statement phrases successfully?

A. [Link] ( ‘ foo ’ );
B. [Link] ( “ foo ” );
C. [Link]( “ ‘ foo ’ ” );
D. [Link](‘ “ foo ” ’);

Answer: D
Explanation:

Question: 4

Refer to the code below:


01 let car1 = new promise((_, reject) =>
02 setTimeout(reject, 2000, “Car 1 crashed in”));
03 let car2 = new Promise(resolve => setTimeout(resolve, 1500, “Car 2
completed”));
04 let car3 = new Promise(resolve => setTimeout (resolve, 3000, “Car 3
Completed”));
05 [Link]([car1, car2, car3])
06 .then(value => (
07 let result = $(value) the race. `;
08 ))
09 .catch( arr => (
10 [Link](“Race is cancelled.”, err);
11 ));
What is the value of result when [Link] executes?

A. Car 3 completed the race.


B. Car 1 crashed in the race.
C. Car 2 completed the race.
D. Race is cancelled.

Answer: C
Explanation:
Questions & Answers PDF Page 4

Question: 5

Refer to the code below:


for(let number =2 ; number <= 5 ; number += 1 ) {
// insert code statement here
}
The developer needs to insert a code statement in the location shown. The code
statement has these requirements:
1. Does require an import
2. Logs an error when the boolean statement evaluates to false
3. Works in both the browser and [Link]
Which meet the requirements?

A. assert (number % 2 === 0);


B. [Link](number % 2 === 0);
C. [Link](number % 2 === 0);
D. [Link](number % 2 === 0);

Answer: B

You might also like