11.11 Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: cramtick70

JavaScript-Developer-I Salesforce Certified JavaScript Developer I (SU24) Questions and Answers

Questions 4

Refer to the code below:

console.log(‘’start);

Promise.resolve(‘Success’) .then(function(value){

console.log(‘Success’);

});

console.log(‘End’);

What is the output after the code executes successfully?

Options:

A.

End

Start

Success

B.

Start

Success

End

C.

Start

End

Success

D.

Success

Start

End

Buy Now
Questions 5

Which code change should be done for the console to log the following when 'Click me!' is clicked'

> Row log

> Table log

Options:

A.

Remove lines 13 and 14

B.

Change line 10 to event.stopPropagation (false) ;

C.

Change line 14 to elem.addEventListener ('click', printMessage, true);

D.

Remove line 10

Buy Now
Questions 6

Given the code below:

const copy = JSON.stringify([ new String(‘ false ’), new Bollean( false ), undefined ]);

What is the value of copy?

Options:

A.

-- [ \”false\” , { } ]--

B.

-- [ false, { } ]--

C.

-- [ \”false\” , false, undefined ]--

D.

-- [ \”false\” ,false, null ]--

Buy Now
Questions 7

Universal Containers (UC) just launched a new landing page, but users complain that the website is slow. A developer found some functions any that might cause this problem. To verify this, the developer decides to execute everything and log the time each of these three suspicious functions consumes.

Which function can the developer use to obtain the time spent by every one of the three functions?

Options:

A.

console. timeLog ()

B.

console.timeStamp ()

C.

console.trace()

D.

console.getTime ()

Buy Now
Questions 8

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?

Options:

A.

Console.assert (await functionUnderTest(true), ‘ OK ’)

B.

Console.assert (await functionUnderTest(true), ‘ not OK ’)

C.

Console.assert (await functionUnderTest(true), ‘ not OK ’)

D.

Console.assert (await functionUnderTest(true), ‘OK’)

Buy Now
Questions 9

Refer to code below:

Let productSKU = ‘8675309’ ;

A developer has a requirement to generate SKU numbers that are always 19 characters lon,

starting with ‘sku’, and padded with zeros.

Which statement assigns the values sku0000000008675309 ?

Options:

A.

productSKU = productSKU .padStart (19. ‘0’).padstart(‘sku’);

B.

productSKU = productSKU .padEnd (16. ‘0’).padstart(‘sku’);

C.

productSKU = productSKU .padEnd (16. ‘0’).padstart(19, ‘sku’);

D.

productSKU = productSKU .padStart (16. ‘0’).padstart(19, ‘sku’);

Buy Now
Questions 10

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.

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.

Buy Now
Questions 11

Given the code below:

01 function GameConsole (name) {

02 this.name = name;

03 }

04

05 GameConsole.prototype.load = function(gamename) {

06 console.log( ` $(this.name) is loading a game : $(gamename) …`);

07 )

08 function Console 16 Bit (name) {

09 GameConsole.call(this, name) ;

10 }

11 Console16bit.prototype = Object.create ( GameConsole.prototype) ;

12 //insert code here

13 console.log( ` $(this.name) is loading a cartridge game : $(gamename) …`);

14 }

15 const console16bit = new Console16bit(‘ SNEGeneziz ’);

16 console16bit.load(‘ Super Nonic 3x Force ’);

What should a developer insert at line 15 to output the following message using the

method ?

> SNEGeneziz is loading a cartridge game: Super Monic 3x Force . . .

Options:

A.

Console16bit.prototype.load(gamename) = function() {

B.

Console16bit.prototype.load = function(gamename) {

C.

Console16bit = Object.create(GameConsole.prototype).load = function

(gamename) {

D.

Console16bit.prototype.load(gamename) {

Buy Now
Questions 12

What is the result of the code block?

Options:

A.

The console logs only ‘flag’.

B.

The console logs ‘flag’ and another flag.

C.

An error is thrown.

D.

The console logs ‘flag’ and then an error is thrown.

Buy Now
Questions 13

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

Options:

A.

const addBy = function(num1){

return function(num2){

return num1 + num2;

}

B.

const addBy = function(num1){

return num1 + num2;

}

C.

const addBy = (num1) => num1 + num2 ;

D.

const addBY = (num1) => (num2) => num1 + num2;

Buy Now
Questions 14

A test has a dependency on database. query. During the test, the dependency is replaced with an object called database with the method,

Calculator query, that returns an array. The developer does not need to verify how many times the method has been called.

Which two test approaches describe the requirement?

Choose 2 answers

Options:

A.

White box

B.

Stubbing

C.

Black box

D.

Substitution

Buy Now
Questions 15

Refer to the code below:

Let car1 = new Promise((_ , reject) =>

setTimeout(reject, 2000, “car 1 crashed in” =>

Let car2 =new Promise(resolve => setTimeout(resolve, 1500, “car 2 completed”)

Let car3 =new Promise(resolve => setTimeout(resolve, 3000, “car 3 completed”)

Promise.race(( car1, car2, car3))

.then (value => (

Let result = ‘$(value) the race.’;)}

.catch(arr => {

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

});

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

Options:

A.

Car 3 completes the race

B.

Car 2 completed the race.

C.

Car 1 crashed in the race.

D.

Race is cancelled.

Buy Now
Questions 16

Refer to following code:

class Vehicle {

constructor(plate) {

This.plate =plate;

}

}

Class Truck extends Vehicle {

constructor(plate, weight) {

//Missing code

This.weight = weight;

}

displayWeight() {

console.log(‘The truck ${this.plate} has a weight of ${this.weight} lb.’);}}

Let myTruck = new Truck(‘123AB’, 5000);

myTruck.displayWeight();

Which statement should be added to line 09 for the code to display ‘The truck 123AB has a

weight of 5000lb.’?

Options:

A.

Super.plate =plate;

B.

super(plate);

C.

This.plate =plate;

D.

Vehicle.plate = plate;

Buy Now
Questions 17

A developer wants to use a module called DataPrettyPrint. This module exports one default function called printDate ().

How can a developer import and use the printDate() function?

A)

B)

C)

D)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 18

Refer to the following code block:

What is the console output?

Options:

A.

> Better student Jackie got 70% on test.

B.

> Jackie got 70% on test.

C.

> Uncaught Reference Error

D.

> Better student Jackie got 100% on test.

Buy Now
Questions 19

A developer is trying to handle an error within a function.

Which code segment shows the correct approach to handle an error without propagating it elsewhere?

A)

B)

C)

D)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 20

A developer wants to use a try...catch statement to catch any error that countSheep () may throw and pass it to a handleError () function.

What is the correct implementation of the try...catch?

A)

B)

C)

D)

Options:

A.

Option

B.

Option

C.

Option

D.

Option

Buy Now
Questions 21

Which two code snippets show working examples of a recursive function?

Choose 2 answers

Options:

A.

Let countingDown = function(startNumber) {

If ( startNumber >0) {

console.log(startNumber) ;

return countingDown(startNUmber);

} else {

return startNumber;

}};

B.

Function factorial ( numVar ) {

If (numVar < 0) return;

If ( numVar === 0 ) return 1;

return numVar -1;

C.

Const sumToTen = numVar => {

If (numVar < 0)

Return;

return sumToTen(numVar + 1)};

D.

Const factorial =numVar => {

If (numVar < 0) return;

If ( numVar === 0 ) return 1;

return numVar * factorial ( numVar - 1 );

};

Buy Now
Questions 22

Refer to code below:

Let first = ‘who’;

Let second = ‘what’;

Try{

Try{

Throw new error(‘Sad trombone’);

}catch (err){

First =’Why’;

}finally {

Second =’when’;

} catch (err) {

Second =’Where’;

}

What are the values for first and second once the code executes ?

Options:

A.

First is Who and second is When

B.

First is why and second is where

C.

First is who and second is where

D.

First is why and second is when

Buy Now
Questions 23

The developer wants to test this code:

Const toNumber =(strOrNum) => strOrNum;

Which two tests are most accurate for this code?

Choose 2 answers

Options:

A.

console.assert(toNumber(‘2’) === 2);

B.

console.assert(Number.isNaN(toNumber()));

C.

console.assert(toNumber(‘-3’) < 0);

D.

console.assert(toNumber () === NaN);

Buy Now
Questions 24

A developer creates an object where its properties should be immutable and prevent

properties from being added or modified.

Which method should be used to execute this business requirement ?

Options:

A.

Object.const()

B.

Object.eval()

C.

Object.lock()

D.

Object.freeze()

Buy Now
Questions 25

Which statement accurately describes the behaviour of the async/ await keyworks ?

Options:

A.

The associated class contains some asynchronous functions.

B.

The associated function will always return a promise

C.

The associated function can only be called via asynchronous methods

D.

The associated sometimes returns a promise.

Buy Now
Questions 26

At Universal Containers, every team has its own way of copying JavaScript objects. The code snippet shows an Implementation from one team:

What is the output of the code execution?

Options:

A.

Hello John Doe

B.

Hello Dan

C.

Hello Dan Doe

D.

SyntaxError: Unexpected token in JSON

Buy Now
Questions 27

Refer to the code below:

What is the value of result when the code executes?

Options:

A.

10-10

B.

5-5

C.

10-5

D.

5-10

Buy Now
Questions 28

Refer to the following code:

What is the output of line 11?

Options:

A.

[1,2]

B.

["bar", "foo"]

C.

["foo:1", "bar:2"]

D.

["foo", "bar"]

Buy Now
Questions 29

Given the code below:

const delay = async delay =>{

return new Promise((resolve,reject)=>{

console.log(1);

setTimeout(resolve,deleay);

});

};

const callDelay = async ()=>{

console.log(2);

const yup = await delay(1000);

console.log(3);

}

console.log(4);

callDelay();

console.log(5);

What is logged to the console?

Options:

A.

4 2 1 5 3

Buy Now
Questions 30

Refer to the code below:

function changeValue(param) {

Param =5;

}

Let a =10;

Let b =5;

changeValue(b);

Const result = a+ “ - ”+ b;

What is the value of result when code executes?

Options:

A.

10 -10

B.

5 -5

C.

5 - 10

D.

10 - 5

Buy Now
Questions 31

Refer to the following code:

What will the console show when the button is clicked?

Options:

A.

Outer message

B.

Outer message

Inner message

C.

Inner message

Outer message

D.

Inner message

Buy Now
Questions 32

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.

Buy Now
Questions 33

Refer to the code below:

Const myFunction = arr => {

Return arr.reduce((result, current) =>{

Return result = current;

}, 10};

}

What is the output of this function when called with an empty array ?

Options:

A.

Returns 0

B.

Throws an error

C.

Returns 10

D.

Returns NaN

Buy Now
Exam Name: Salesforce Certified JavaScript Developer I (SU24)
Last Update: Nov 16, 2024
Questions: 215
JavaScript-Developer-I pdf

JavaScript-Developer-I PDF

$24  $80
JavaScript-Developer-I Engine

JavaScript-Developer-I Testing Engine

$28.5  $95
JavaScript-Developer-I PDF + Engine

JavaScript-Developer-I PDF + Testing Engine

$39  $130