Pass the Salesforce Salesforce Developer JavaScript-Developer-I Questions and answers with CertsForce

Viewing page 4 out of 7 pages
Viewing questions 31-40 out of questions
Questions # 31:

Refer to the codebelow:

function foo () {

const a =2;

function bat() {

console.log(a);

}

return bar;

}

Why does the function bar have access to variable a ?

Options:

A.

Inner function’s scope


B.

Hoisting


C.

Outer function’s scope


D.

Prototype chain


Expert Solution
Questions # 32:

A developer initiates a server with the file server,js and adds dependencies in the source codes package,json that are required to run the server.

Which command should the developer run to start the server locally?

Options:

A.

start server,js


B.

npm start server,js


C.

npm start


D.

node start


Expert Solution
Questions # 33:

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.

A different developer made changes to the behavior of sum3 to instead sum only the first two numbers present in the array.

Question # 33

Which two results occur when running this test on the updated sum3 function?

Choose 2 answers

Options:

A.

The line 05 assertion passes.


B.

The line 02 assertion passes.


C.

The line 02 assertion fails.


D.

The line 05 assertion fails.


Expert Solution
Questions # 34:

Refer to the code below:

Question # 34

Which value can a developer expect when referencing country,capital,cityString?

Options:

A.

'London'


B.

undefined


C.

An error


D.

'NaN'


Expert Solution
Questions # 35:

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 Promise.race([car1, car2, car3])

06 .then(value => (

07 let result = $(value) the race. `;

08 ))

09 .catch( arr => (

10 console.log(“Race is cancelled.”, err);

11 ));

What is the value of result when Promise.race executes?

Options:

A.

Car 3 completed the race.


B.

Car 1 crashed in the race.


C.

Car 2 completed the race.


D.

Race is cancelled.


Expert Solution
Questions # 36:

Refer to the code below:

Question # 36

What is the value of result when the code executes?

Options:

A.

10-10


B.

5-5


C.

10-5


D.

5-10


Expert Solution
Questions # 37:

Which statement phrases successfully?

Options:

A.

JSON.parse ( ‘ foo ’ );


B.

JSON.parse ( “ foo ” );


C.

JSON.parse( “ ‘ foo ’ ” );


D.

JSON.parse(‘ “ foo ” ’);


Expert Solution
Questions # 38:

Considering the implications of 'use strict' on line 04, which three statements describe the execution of the code?

Choose 3 answers

Options:

A.

z is equal to 3.14.


B.

'use strict' is hoisted, so it has an effect on all lines.


C.

'use strict' has an effect only on line 05.


D.

'use strict' has an effect between line 04 and the end of the file.


E.

Line 05 throws an error.


Expert Solution
Questions # 39:

developer publishes a new version of a package with new features that do not break

backward compatibility. The previous version number was 1.1.3.

Following semantic versioning format, what should the new package version number

be?

Options:

A.

2.0.0


B.

1.2.3


C.

1.1.4


D.

1.2.0


Expert Solution
Questions # 40:

A developer has an is Dog function that takes one argument cat. They want to schedule the function to run every minute.

What is the correct syntax for scheduling this function?

Options:

A.

setInterval(isDog, 60000,'cat');


Expert Solution
Viewing page 4 out of 7 pages
Viewing questions 31-40 out of questions