Dani Armngd
Test por , creado hace más de 1 año

test exam

167
0
0
Dani Armngd
Creado por Dani Armngd hace casi 4 años
Cerrar

Salesforce JavaScript Developer I

Pregunta 1 de 57

1

Refer to the code below:

Let str = ‘javascript’;

Str[0] = ‘J’;

Str[4] = ’S’;

After changing the string index values, the value of str is ‘javascript’.

What is the reason for this value:

Selecciona una de las siguientes respuestas posibles:

  • Non-primitive values are mutable.

  • Non-primitive values are immutable.

  • Primitive values are mutable.

  • Primitive values are immutable.

Explicación

Pregunta 2 de 57

1

2. What are two unique features of functions defined with a fat arrow as compared to normal function definition? Choose 2 answers

Selecciona una o más de las siguientes respuestas posibles:

  • The function generated its own this making it useful for separating the function’s scope from its enclosing scope.

  • If the function has a single expression in the function body, the expression will be evaluated and implicit returned.

  • The function receives an argument that is always in scope, called parentThis, which is the enclosing lexical scope.

  • The function uses the this from the enclosing scope.

Explicación

Pregunta 3 de 57

1

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

Selecciona una o más de las siguientes respuestas posibles:

  • ‘Update’ , (
    recordId : ‘123abc’
    (

  • correct
    ‘Update’ , ‘123abc’
    { type : ‘update’, recordId : ‘123abc’ }

  • ‘Update’ , {
    Details : {
    recordId : ‘123abc’
    }
    }

Explicación

Pregunta 4 de 57

1

At Universal Containers, every team has its own way of copying JavaScript objects.

The code Snippet shows an implementation from one team:

Function Person() {

this.firstName = “John”;

this.lastName = ‘Doe’;

This.name =() => (

console.log(‘Hello $(this.firstName) $(this.firstName)’);

)}

Const john = new Person ();

Const dan = JSON.parse(JSON.stringify(john));

dan.firstName =’Dan’;

dan.name();

What is the Output of the code execution?

Selecciona una de las siguientes respuestas posibles:

  • Hello Dan Doe

  • Hello John DOe

  • TypeError: dan.name is not a function

  • TypeError: Assignment to constant variable

Explicación

Pregunta 5 de 57

1

Refer to the code below:

catch( arr => (

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

11 ));

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

Selecciona una de las siguientes respuestas posibles:

  • Car 3 completed the race.

  • Car 1 crashed in the race.

  • Car 2 completed the race.

  • Race is cancelled.

Explicación

Pregunta 6 de 57

1

Given the code below:

Function myFunction(){

A =5; Var b =1;

}

myFunction();

console.log(a);

console.log(b);

What is the expected output?

Selecciona una de las siguientes respuestas posibles:

  • Both lines 08 and 09 are executed, and the variables are outputted.

  • Line 08 outputs the variable, but line 09 throws an error.

  • Line 08 thrones an error, therefore line 09 is never executed.

  • Both lines 08 and 09 are executed, but values outputted are undefined.

Explicación

Pregunta 7 de 57

1

Refer to the following code:

function test (val) {

If (val === undefined) {

return ‘Undefined values!’ ;

}

if (val === null) {

return ‘Null value! ’;

}

return val;

}

Let x;

test(x);

What is returned by the function call on line 13?

Selecciona una de las siguientes respuestas posibles:

  • Undefined

  • Line 13 throws an error.

  • ‘Undefined values!’

  • ‘Null value!’

Explicación

Pregunta 8 de 57

1

CORRECT TEXT

Given the requirement to refactor the code above to JavaScript class format, which class definition is correct?
A)

B)

C)

D)

Selecciona una de las siguientes respuestas posibles:

  • Option A

  • Option B

  • Option C

  • Option D

Explicación

Pregunta 9 de 57

1

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?

Selecciona una de las siguientes respuestas posibles:

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

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

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

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

Explicación

Pregunta 10 de 57

1

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

Selecciona una o más de las siguientes respuestas posibles:

  • Let countingDown = function(startNumber) { If ( startNumber >0) { console.log(startNumber) ; return countingDown(startNUmber); } else { return startNumber; }};

  • Function factorial ( numVar ) { If (numVar < 0) return; If ( numVar === 0 ) return 1; return numVar -1;

  • Const sumToTen = numVar => { If (numVar < 0) Return; return sumToTen(numVar + 1)};

  • Const factorial =numVar => { If (numVar < 0) return; If ( numVar === 0 ) return 1; return numVar * factorial ( numVar - 1 ); };

Explicación

Pregunta 11 de 57

1

Refer to the HTML below:

<div id=”main”>

<ul>

<li>Leo</li>

<li>Tony</li>

<li>Tiger</li>

</ul>

</div>

Which JavaScript statement results in changing “ Tony” to “Mr. T.”?

Selecciona una de las siguientes respuestas posibles:

  • document.querySelectorAll(‘$main $TONY’).innerHTML =’ Mr.’;

  • document.querySelectorAll(‘$main $TONY’).innerHTML = ’ Mr.’;

  • document.querySelector(‘$main li.Tony’).innerHTML = ’ Mr.’;

  • document.querySelector(‘$main li:nth-child(2)’),innerHTML = ’ Mr.’;

Explicación

Pregunta 12 de 57

1

Universal Containers (UC) notices that its application that allows users to search for accounts makes a network request each time a key is pressed. This results in too many requests for the server to handle.

Address this problem, UC decides to implement a debounce function on string change handler.

What are three key steps to implement this debounce function? Choose 3 answers:

Selecciona una o más de las siguientes respuestas posibles:

  • If there is an existing setTimeout and the search string change, allow the existing setTimeout to finish, and do not enqueue a new setTimeout.

  • When the search string changes, enqueue the request within a setTimeout.

  • Ensure that the network request has the property debounce set to true.

  • If there is an existing setTimeout and the search string changes, cancel the existing setTimeout using the persisted timerId and replace it with a new setTimeout.

  • Store the timeId of the setTimeout last enqueued by the search string change handle.

Explicación

Pregunta 13 de 57

1

Refer to the code snippet below:

Let array = [1, 2, 3, 4, 4, 5, 4, 4];

For (let i =0; i < array.length; i++)

if (array[i] === 4) {

array.splice(i, 1);

}

}

What is the value of array after the code executes?

Selecciona una de las siguientes respuestas posibles:

  • [1, 2, 3, 4, 5, 4, 4]

  • [1, 2, 3, 4, 4, 5, 4]

  • [1, 2, 3, 5]

  • [1, 2, 3, 4, 5, 4]

Explicación

Pregunta 14 de 57

1

Given code below:

setTimeout (() => (

console.log(1);

). 0);

console.log(2);

New Promise ((resolve, reject )) = > (

setTimeout(() => (

reject(console.log(3));

). 1000);

)).catch(() => (

console.log(4);

));

console.log(5);

What is logged to the console?

Selecciona una de las siguientes respuestas posibles:

  • 2 1 4 3 5

  • 2 5 1 3 4

  • 1 2 4 3 5

  • 1 2 5 3 4

Explicación

Pregunta 15 de 57

1

Given two expressions var1 and var2.

What are two valid ways to return the logical AND of the two expressions and ensure it is data type Boolean? Choose 2 answers:

Selecciona una o más de las siguientes respuestas posibles:

  • Boolean(var1 && var2)

  • var1 && var2

  • var1.toBoolean() && var2toBoolean()

  • Boolean(var1) && Boolean(var2)

Explicación

Pregunta 16 de 57

1

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?

Selecciona una de las siguientes respuestas posibles:

  • End

  • Start Success

  • Start Success End

  • Start End Success

  • Success Start

Explicación

Pregunta 17 de 57

1

Which code statement correctly retrieves and returns an object from localStorage?

Selecciona una de las siguientes respuestas posibles:

  • const retrieveFromLocalStorage = () =>{ return JSON.stringify(window.localStorage.getItem(storageKey)); }

  • const retrieveFromLocalStorage = (storageKey) =>{ return window.localStorage.getItem(storageKey); }

  • const retrieveFromLocalStorage = (storageKey) =>{ return JSON.parse(window.localStorage.getItem(storageKey)); }

  • const retrieveFromLocalStorage = (storageKey) =>{ return window.localStorage[storageKey]; }

Explicación

Pregunta 18 de 57

1

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?

Selecciona una de las siguientes respuestas posibles:

  • aPromise and bPromise run sequentially.

  • Neither aPromise or bPromise runs.

  • aPromise and bPromise run in parallel.

  • Only aPromise runs.

Explicación

Pregunta 19 de 57

1

A developer wants to set up a secure web server with Node.js. The developer creates a directory locally called app-server, and the first file is app-server/index.js

Without using any third-party libraries, what should the developer add to index.js to create the secure web server?

Selecciona una de las siguientes respuestas posibles:

  • const https =require(‘https’);

  • const server =require(‘secure-server’);

  • const tls = require(‘tls’);

  • const http =require(‘http’);

Explicación

Pregunta 20 de 57

1

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);

Selecciona una de las siguientes respuestas posibles:

  • Return Number((num +10) /3 );

  • Return (Number (num +10 ) / 3;

  • Return Integer(num +10) /3;

  • Return Number(num + 10) / 3;

Explicación

Pregunta 21 de 57

1

A developer wrote the following code:

01 let X = object.value;

02

03 try {

4 handleObjectValue(X);

5 } catch (error) {

6 handleError(error);

7 }

The developer has a getNextValue function to execute after handleObjectValue(), but does not want to execute getNextValue() if an error occurs.

How can the developer change the code to ensure this behavior?

Selecciona una de las siguientes respuestas posibles:

  • 03 try{ 4 handleObjectValue(x); 5 } catch(error){ 6 handleError(error); 7 } then { 8 getNextValue(); 9 }

  • 03 try{ 4 handleObjectValue(x); 5 } catch(error){ 6 handleError(error); 07 } finally { 8 getNextValue(); 10 }

  • 03 try{ 4 handleObjectValue(x); 5 } catch(error){ 6 handleError(error); 7 } 8 getNextValue();

  • 03 try { 4 handleObjectValue(x) 5 ……………………

Explicación

Pregunta 22 de 57

1

Which code statement below correctly persists an objects in local Storage?

Selecciona una de las siguientes respuestas posibles:

  • const setLocalStorage = (storageKey, jsObject) => { window.localStorage.setItem(storageKey, JSO
    stringify(jsObject)); }

  • const setLocalStorage = ( jsObject) => { window.localStorage.connectObject(jsObject)); }

  • const setLocalStorage = ( jsObject) => { window.localStorage.setItem(jsObject); }

  • const setLocalStorage = (storageKey, jsObject) => { window.localStorage.persist(storageKey, jsObject); }

Explicación

Pregunta 23 de 57

1

A developer uses a parsed JSON string to work with user information as in the block below:

01 const userInformation ={

02 “ id ” : “user-01”,

03 “email” : “user01@universalcontainers.demo”,

04 “age” : 25

Which two options access the email attribute in the object? Choose 2 answers

Selecciona una o más de las siguientes respuestas posibles:

  • userInformation(“email”)

  • userInformation.get(“email”)

  • userInformation.email

  • userInformation(email)

Explicación

Pregunta 24 de 57

1

Given the following code:

Counter = 0;

const logCounter = () => {

console.log(counter);

);

logCounter();

setTimeout(logCOunter, 1100);

setInterval(() => {

Counter++

logCounter();

}, 1000);

What is logged by the first four log statements?

Selecciona una de las siguientes respuestas posibles:

  • 0 0 1 2

  • 0 1 2 3

  • 0 1 1 2

  • 0 1 2 2

Explicación

Pregunta 25 de 57

1

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?

Selecciona una de las siguientes respuestas posibles:

  • 2.0.0

  • 1.2.3

  • 1.1.4

  • 1.2.0

Explicación

Pregunta 26 de 57

1

A developer has an ErrorHandler module that contains multiple functions.

What kind of export be leverages so that multiple functions can be used?

Selecciona una de las siguientes respuestas posibles:

  • Named

  • All

  • Multi

  • Default

Explicación

Pregunta 27 de 57

1

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

Selecciona una o más de las siguientes respuestas posibles:

  • [ ]. Concat.apply ([ ], inArray);

  • [ ]. Concat (... inArray);correct

  • [ ]. concat.apply(inArray, [ ]);

  • [ ]. concat ( [ ….inArray ] );

Explicación

Pregunta 28 de 57

1

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?

Selecciona una de las siguientes respuestas posibles:

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

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

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

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

Explicación

Pregunta 29 de 57

1

A developer writers the code below to calculate the factorial of a given number. Function factorial(number) {

Return number + factorial(number -1);

}

factorial(3);

What is the result of executing line 04?

Selecciona una de las siguientes respuestas posibles:

  • 0

  • 6

  • -Infinity

  • RuntimeError

Explicación

Pregunta 30 de 57

1

Refer to the following code:

01 function Tiger(){

02 this.Type = ‘Cat’;

03 this.size = ‘large’;

04 }

05

06 let tony = new Tiger();

07 tony.roar = () =>{

08 console.log(‘They’re great1’);

9 };

10

11 function Lion(){

12 this.type = ‘Cat’;

13 this.size = ‘large’;

14 }

15

16 let leo = new Lion();

17 //Insert code here

18 leo.roar();

Selecciona una o más de las siguientes respuestas posibles:

  • Leo.roar = () => { console.log(‘They’re pretty good:’); };

  • Object.assign(leo,Tiger);

  • Object.assign(leo,tony);

  • Leo.prototype.roar = () => { console.log(‘They’re pretty good:’); };

Explicación

Pregunta 31 de 57

1

developer wants to use a module named universalContainersLib and them call functions from it.

How should a developer import every function from the module and then call the fuctions foo and bar?

Selecciona una de las siguientes respuestas posibles:

  • import * ad lib from ‘/path/universalContainersLib.js’; lib.foo(); lib.bar();

  • import (foo, bar) from ‘/path/universalContainersLib.js’; foo(); bar();

  • import all from ‘/path/universalContaineraLib.js’; universalContainersLib.foo(); universalContainersLib.bar();

  • import * from ‘/path/universalContaineraLib.js’; universalContainersLib.foo(); universalContainersLib.bar();

Explicación

Pregunta 32 de 57

1

A developer creates a generic function to log custom messages in the console.

To do this, the function below is implemented.

01 function logStatus(status){

02 console./*Answer goes here*/{‘Item status is: %s’, status};

03 }

Which three console logging methods allow the use of string substitution in line 02?

Selecciona una o más de las siguientes respuestas posibles:

  • Assert

  • Log

  • Message

  • Info

  • Error

Explicación

Pregunta 33 de 57

1

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?

Selecciona una de las siguientes respuestas posibles:

  • Using the debugger command on line 05

  • Using the debugger command on line 03

  • Calling the console.trace (total) method on line 03

  • Wrapping findSubtotal in a console.log() method

Explicación

Pregunta 34 de 57

1

A developer is wondering whether to use, Promise.then or Promise.catch, especially when a Promise throws an error?

Which two promises are rejected?

Which 2 are correct?

Selecciona una o más de las siguientes respuestas posibles:

  • Promise.reject(‘cool error here’).then(error => console.error(error));

  • Promise.reject(‘cool error here’).catch(error => console.error(error));

  • New Promise((resolve, reject) => (throw ‘cool error here’}).catch(error => console.error(error)) ;

  • New Promise(() => (throw ‘cool error here’}).then(null, error => console.error(error)));

Explicación

Pregunta 35 de 57

1

A developer removes the HTML class attribute from the checkout button, so now it is simply:

<button>Checkout</button>.

There is a test to verify the existence of the checkout button, however it looks for a button with class= “blue”. The test fails because no such button is found.

Which type of test category describes this test?

Selecciona una de las siguientes respuestas posibles:

  • True positive

  • True negative

  • False positive

  • False negative

Explicación

Pregunta 36 de 57

1

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?

Selecciona una de las siguientes respuestas posibles:

  • Object.const()

  • Object.eval()

  • Object.lock()

  • Object.freeze()

Explicación

Pregunta 37 de 57

1

Refer to the code below:

Const searchTest = ‘Yay! Salesforce is amazing!” ;

Let result1 = searchText.search(/sales/i);

Let result 21 = searchText.search(/sales/i);

console.log(result1);

console.log(result2);

After running this code, which result is displayed on the console?

Selecciona una de las siguientes respuestas posibles:

  • true > false

  • 5 >undefined

  • 5 > -1

  • 5 > 0

Explicación

Pregunta 38 de 57

1

Refer to the code below:

Function changeValue(obj) {

Obj.value = obj.value/2;

}

Const objA = (value: 10);

Const objB = objA;

changeValue(objB);

Const result = objA.value;

What is the value of result after the code executes?

Selecciona una de las siguientes respuestas posibles:

  • 10

  • Nan

  • 5

  • Undefined

Explicación

Pregunta 39 de 57

1

A developer is required to write a function that calculates the sum of elements in an array but is getting undefined every time the code is executed.

The developer needs to find what is missing in the code below.

Const sumFunction = arr => {

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

//

Result += current;

//

), 10);

);

Which option makes the code work as expected?

Selecciona una de las siguientes respuestas posibles:

  • Replace line 02 with return arr.map(( result, current) => (

  • Replace line 04 with result = result +current;

  • Replace line 03 with if(arr.length == 0 ) ( return 0; )

  • Replace line 05 with return result;

Explicación

Pregunta 40 de 57

1

The developer wants to test the array shown:

const arr = Array(5).fill(0)

Which two tests are the most accurate for this array? Choose 2 answers:

Selecciona una o más de las siguientes respuestas posibles:

  • console.assert( arr.length === 5 );

  • arr.forEach(elem => console.assert(elem === 0)) ;

  • console.assert(arr[0] === 0 && arr[ arr.length] === 0);

  • console.assert (arr.length >0);

Explicación

Pregunta 41 de 57

1

Refer to the following code:

Let obj ={

Foo: 1,

Bar: 2

}

Let output =[],

for(let something in obj{

output.push(something);

}

console.log(output);

What is the output line 11?

Selecciona una de las siguientes respuestas posibles:

  • [1,2]

  • [“bar”,”foo”]

  • [“foo”,”bar”]

  • [“foo:1”,”bar:2”]

Explicación

Pregunta 42 de 57

1

In which situation should a developer include a try .. catch block around their function call?

Selecciona una de las siguientes respuestas posibles:

  • The function has an error that should not be silenced.

  • The function results in an out of memory issue.

  • The function might raise a runtime error that needs to be handled.

  • The function contains scheduled code.

Explicación

Pregunta 43 de 57

1

Which three statements are true about promises? Choose 3 answers

Selecciona una o más de las siguientes respuestas posibles:

  • The executor of a new Promise runs automatically.

  • A Promise has a .then() method.

  • A fulfilled or rejected promise will not change states .

  • A settled promise can become resolved.

  • A pending promise can become fulfilled, settled, or rejected.

Explicación

Pregunta 44 de 57

1

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

Selecciona una de las siguientes respuestas posibles:

  • The associated class contains some asynchronous functions.

  • The associated function will always return a promise

  • The associated function can only be called via asynchronous methods

  • The associated sometimes returns a promise.

Explicación

Pregunta 45 de 57

1

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?

Selecciona una de las siguientes respuestas posibles:

  • First is Who and second is When

  • First is why and second is where

  • First is who and second is where

  • First is why and second is when

Explicación

Pregunta 46 de 57

1

A developer has the following array of student test grades:

Let arr = [ 7, 8, 5, 8, 9 ];

The Teacher wants to double each score and then see an array of the students

who scored more than 15 points.

How should the developer implement the request?

Selecciona una de las siguientes respuestas posibles:

  • Let arr1 = arr.filter(( val) => ( return val > 15 )) .map (( num) => ( return num *2 ))

  • Let arr1 = arr.mapBy (( num) => ( return num *2 )) .filterBy (( val ) => return val > 15 )) ;

  • Let arr1 = arr.map((num) => num*2). Filter (( val) => val > 15);

  • Let arr1 = arr.map((num) => ( num *2)).filterBy((val) => ( val >15 ));

Explicación

Pregunta 47 de 57

1

A developer implements a function that adds a few values.

Function sum(num) {

If (num == undefined) {

Num =0;

}

Return function( num2, num3){

If (num3 === undefined) {

Num3 =0 ;

}

Return num + num2 + num3;

}

}

Which three options can the developer invoke for this function to get a return value of 10? Choose 3 answers

Selecciona una o más de las siguientes respuestas posibles:

  • Sum () (20)

  • Sum (5, 5) ()

  • sum() (5, 5)

  • sum(5)(5)

  • sum(10) ()

Explicación

Pregunta 48 de 57

1

Cloud Kicks has a class to represent items for sale in an online store, as shown below:

Class Item{

constructor (name, price){

this.name = name;

this.price = price;

}

formattedPrice(){

return ‘s’ + String(this.price);}}

A new business requirement comes in that requests a ClothingItem class that should have all of the properties and methods of the Item class but will also have properties that are specific to clothes.

Which line of code properly declares the clothingItem class such that it inherits from Item?

Selecciona una de las siguientes respuestas posibles:

  • Class ClothingItem implements Item{

  • Class ClothingItem {

  • Class ClothingItem super Item {

  • Class ClothingItem extends Item {

Explicación

Pregunta 49 de 57

1

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

Selecciona una o más de las siguientes respuestas posibles:

  • console.assert(sum3(1, ‘2’)) == 12);

  • console.assert(sum3(0)) == 0);

  • console.assert(sum3(-3, 2 )) == -1);

  • console.assert(sum3(‘hello’, 2, 3, 4)) === NaN);

Explicación

Pregunta 50 de 57

1

A developer is creating a simple webpage with a button. When a user clicks this button for the first time, a message is displayed.

The developer wrote the JavaScript code below, but something is missing. The message gets displayed every time a user clicks the button, instead of just the first time.

01 function listen(event) {

02 alert ( ‘Hey! I am John Doe’) ;

03 button.addEventListener (‘click’, listen);

Which two code lines make this code work as required? Choose 2 answers

Selecciona una o más de las siguientes respuestas posibles:

  • On line 02, use event.first to test if it is the first execution.

  • On line 04, use event.stopPropagation ( ),

  • On line 04, use button.removeEventListener(‘ click” , listen);

  • On line 06, add an option called once to button.addEventListener().

Explicación

Pregunta 51 de 57

1

Given the code below:

01 function GameConsole (name) {

02 this.name = name;

3 }

4

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

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

7 )

8 function Console 16 Bit (name) {

9 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 . . .

Selecciona una de las siguientes respuestas posibles:

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

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

  • Console16bit = Object.create(GameConsole.prototype).load = function (gamename) {

  • Console16bit.prototype.load(gamename) {

Explicación

Pregunta 52 de 57

1

developer is trying to convince management that their team will benefit from using Node.js for a backend server that they are going to create. The server will be a web server that handles API requests from a website that the team has already built using HTML, CSS, and JavaScript.

Which three benefits of Node.js can the developer use to persuade their manager? Choose 3 answers:

Selecciona una o más de las siguientes respuestas posibles:

  • I nstalls with its own package manager to install and manage third-party libraries.

  • Ensures stability with one major release every few years.

  • Performs a static analysis on code before execution to look for runtime errors.

  • Executes server-side JavaScript code to avoid learning a new language.

  • User non blocking functionality for performant request handling.

Explicación

Pregunta 53 de 57

1

Refer to the code:
Given the code above, which three properties are set pet1? Choose 3 answers:

Selecciona una o más de las siguientes respuestas posibles:

  • Name

  • canTalk

  • Type

  • Owner

  • Size

Explicación

Pregunta 54 de 57

1

Refer to following code block:

Let array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,];

Let output =0;

For (let num of array){

if (output >0){

Break;

}

if(num % 2 == 0){

Continue;

}

Output +=num;

What is the value of output after the code executes?

Selecciona una de las siguientes respuestas posibles:

  • 16

  • 36

  • 11

  • 25

Explicación

Pregunta 55 de 57

1

Given the following code:

document.body.addEventListener(‘ click ’, (event) => {

if (/* CODE REPLACEMENT HERE */) {

console.log(‘button clicked!’);

)

});

Which replacement for the conditional statement on line 02 allows a developer to correctly determine that a button on page is clicked?

Selecciona una de las siguientes respuestas posibles:

  • Event.clicked

  • e.nodeTarget ==this

  • event.target.nodeName == ‘BUTTON’

  • button.addEventListener(‘click’)

Explicación

Pregunta 56 de 57

1

A test has a dependency on database.query. During the test the dependency is replaced with an object called database with the method, query, that returns an array. The developer needs to verify how many times the method was called and the arguments used each time.

Which two test approaches describe the requirement? Choose 2 answers

Selecciona una o más de las siguientes respuestas posibles:

  • Integration

  • Black box

  • White box

  • Mocking

Explicación

Pregunta 57 de 57

1

Given the code below:

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

What is the value of copy?

Selecciona una de las siguientes respuestas posibles:

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

  • -- [ false, { } ]--

  • -- [ ”false” , false, undefined ]--

  • -- [ ”false” ,false, null ]--

Explicación