Salesforce.javaScript Developer I.v2024!08!09.q110
Salesforce.javaScript Developer I.v2024!08!09.q110
q110
NEW QUESTION: 1
Given the HTML below:
Which statement adds the priority-account css class to the Applied Shipping row?
Answer:
document.querySelector('#row-as').classList.add('priority-account');
NEW QUESTION: 2
A developer wants to create an object from a function in the browser using the code below:
Function Monster() { this.name = 'hello' };
Const z = Monster();
What happens due to lackof the new keyword on line 02?
A. Window.name is assigned to 'hello' and the variable z remains undefined.
B. Window.m is assigned the correct object.
C. The z variable is assigned the correct object but this.name remains undefined.
D. The z variable is assigned the correct object.
Answer: A (LEAVE A REPLY)
NEW QUESTION: 3
Refer to HTML below:
<div id ="main">
<div id = " card-00">This card is smaller.</div>
<div id = "card-01">The width and height of this card is determined by its contents.</div>
</div>
Which expression outputs the screen width of the element with the ID card-01?
A. document.getElementById(' card-01 ').style.width
B. document.getElementById(' card-01 ').getBoundingClientRest().width
C. document.getElementById(' card-01 ').width
D. document.getElementById(' card-01 ').innerHTML.lenght*e
Answer: (SHOW ANSWER)
NEW QUESTION: 4
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?
A. Console.assert (await functionUnderTest(true), ' OK ')
B. Console.assert (await functionUnderTest(true), 'OK')
C. Console.assert (await functionUnderTest(true), ' notOK ')
D. Console.assert (await functionUnderTest(true), ' not OK ')
Answer: (SHOW ANSWER)
NEW QUESTION: 5
What are two unique features of functions defined with a fat arrow as compared to normal
function definition?
Choose 2 answers
A. If the function has a single expression in the function body, the expression will be evaluated
and implicit returned.
B. The function generated its own this making it useful for separating the function's scope from its
enclosing scope.
C. The function uses the this from the enclosing scope.
D. The function receives an argument that is always in scope, called parentThis, which is the
enclosing lexical scope.
Answer: (SHOW ANSWER)
NEW QUESTION: 6
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 = function(num1){
return function(num2){
return num1 + num2;
}
B. const addBY = (num1) => (num2) => num1 + num2;
C. const addBy = (num1) => num1 + num2 ;
D. const addBy = function(num1){
return num1 + num2;
}
Answer: (SHOW ANSWER)
NEW QUESTION: 7
In which situation should a developer include a try .. catch block around their function call ?
A. The function has an error that should not be silenced.
B. The function results in an out of memory issue.
C. The function contains scheduled code.
D. The function might raise a runtime error that needs to be handled.
Answer: (SHOW ANSWER)
NEW QUESTION: 8
Given the following code:
let x = null;
console.log(typeof x);
What is the output?
A. "x"
B. "undefined"
C. "null"
D. "object"
Answer: (SHOW ANSWER)
NEW QUESTION: 9
Given the JavaScript below:
01 function filterDOM (searchString) {
02 const parsedSearchString = searchString && searchString.toLowerCase() ;
03 document.quesrySelectorAll(' .account' ) . forEach(account => (
04 const accountName = account.innerHTML.toLOwerCase();
05 account. Style.display = accountName.includes(parsedSearchString) ? /*Insert code*/;
06 )};
07 }
Which code should replace the placeholder comment on line 05 to hide accounts that do not
match thesearch string?
A. ' Block ' : ' none '
B. ' visible ' : ' hidden '
C. ' hidden ' : ' visible '
D. ' name ' : ' block '
Answer: (SHOW ANSWER)
NEW QUESTION: 10
A. setTimeout (formatName(), 5000, "John", "BDoe");
B. setTimeout ('formatName', 5000, 'John", "Doe');
C. setTimout(() => { formatName("John', 'Doe') }, 5000);
D. setTimeout (formatName('John', ''Doe'), 5000);
Answer: (SHOW ANSWER)
NEW QUESTION: 11
Refer to thefollowing code that imports a module named utils:
import (foo, bar) from '/path/Utils.js';
foo() ;
bar() ;
Which two implementations of Utils.js export foo and bar such that the code above runs without
error?
Choose 2 answers
A. // FooUtils.js and BarUtils.js existImport (foo) from '/path/FooUtils.js';Import (boo) from '
/path/NarUtils.js';
B. const foo = () => { return 'foo';}const bar = () => {return 'bar'; }Export default foo, bar;
C. const foo = () => { return 'foo' ; }const bar = () => { return 'bar' ; }export { bar, foo }
D. Export default class {foo() { return 'foo' ; }bar() { return 'bar' ; }}
Answer: C,D (LEAVE A REPLY)
NEW QUESTION: 12
A developer writes the code below to return a message to a user attempting to register a new
username. If the username is available, a variable named nag is declared and assigned a value
on line 03.
What is the value of msg when getAvailableabilityMessage ("newUserName") is executed and get
Availability ("newUserName") returns true?
A. "msg is not defined"
B. "User-name available"
C. undefined
D. "newUserName"
Answer: (SHOW ANSWER)
NEW QUESTION: 13
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?
A. [1, 2, 3, 4, 5, 4]
B. [1, 2, 3, 5]
C. [1,2, 3, 4, 5, 4, 4]
D. [1, 2, 3, 4, 4, 5, 4]
Answer: (SHOW ANSWER)
NEW QUESTION: 14
Refer the following code
What is the value of array after code executes?
Answer:
1, 2, 3, 5
NEW QUESTION: 15
Given the requirement to refactor the code above to JavaScript class format, which class
definition is correct?
A.
B.
C.
D.
Answer: (SHOW ANSWER)
NEW QUESTION: 16
A developer has an ErrorHandler module that contains multiple functions.
What kind of export should be leveraged so that multiple functions can be used?
A. default
B. named
C. all
D. multi
Answer: (SHOW ANSWER)
NEW QUESTION: 17
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 ?
A. Returns 10
B. Throws an error
C. Returns 0
D. Returns NaN
Answer: (SHOW ANSWER)
NEW QUESTION: 18
A developer has two ways to write a function:
Option A:
function Monster(){
this.growl = ()=>{
console.log('Grr!');
}
}
Option B:
function Monster(){};
Monster.prototype.growl = ()=>{
console.log('Grr!');
}
After deciding on an option, the developercreates 1000 monster objects.
How many growl methods are created with Option A and Option B?
A. 1 for Option A, 1000 for Option B
B. 1000 for both
C. 1 methods for both
D. 1000 for Option A, 1 for Option B
Answer: (SHOW ANSWER)
NEW QUESTION: 19
Which code change should be done for the console to log the following when 'Click me!' is
clicked'
> Row log
> Table log
A. Change line 14 to elem.addEventListener ('click', printMessage, true);
B. Remove line 10
C. Remove lines 13 and14
D. Change line 10 to event.stopPropagation (false) ;
Answer: (SHOW ANSWER)
NEW QUESTION: 20
Refer to the code:
Given the code above, which three properties are set pet1?
Choose 3 answers:
A. Owner
B. Name
C. Type
D. Size
E. canTalk
Answer: (SHOW ANSWER)
NEW QUESTION: 21
A developer creates a class that represents a blog post based on the requirement that a Post
should have a body author and view count.
The Code shown Below:
Class Post{
// Insert code here
This.body =body
This.author = author;
this.viewCount = viewCount;
}
}
Which statement should be inserted in the placeholder on line 02 to allow for a variable to be set
to a new instanceof a Post with the three attributes correctly populated?
A. constructor() {
B. super (body, author, viewCount) {
C. constructor (body, author, viewCount) {
D. Function Post (body, author, viewCount) {
Answer: (SHOW ANSWER)
NEW QUESTION: 22
bar, awesome is a popular JavaScript module. the versions publish to npm are:
Teams at Universal Containers use this module in a number of projects. A particular project has
thepackage, json definition below.
NEW QUESTION: 23
Refer to the code below:
Let str = 'javascript';
Str[0] = 'J';
Str[4] = 'S';
After changing the string indexvalues, the value of str is 'javascript'. What is the reason for this
value:
A. Primitive values are immutable.
B. Non-primitive values are mutable.
C. Primitive values are mutable.
D. Non-primitive values are immutable.
Answer: (SHOW ANSWER)
NEW QUESTION: 24
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:
A. console.assert( arr.length === 5 );
B. console.assert(arr[0] === 0 && arr[ arr.length] === 0);
C. arr.forEach(elem => console.assert(elem === 0)) ;
D. console.assert (arr.length >0);
Answer: (SHOW ANSWER)
NEW QUESTION: 25
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 1
B. 2 2 2 2
C. 2 2 1 2
D. 2 2 undefined undefined
Answer: (SHOW ANSWER)
NEW QUESTION: 26
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?
A. 1.2.3
B. 2.0.0
C. 1.2.0
D. 1.1.4
Answer: (SHOW ANSWER)
NEW QUESTION: 27
Refer the code below.
x=3.14;
function myfunction() {
"use strict";
y=x;
}
z=x;
myFunction();
Answer:
Z is equal to 3.14
Use strict has effect only on line 5.
Line 5 throws an error
NEW QUESTION: 28
Refer to the code below:
Considering that JavaScript is single-threaded, what is the output of line 08 after the code
executes?
A. 10
B. 12
C. 11
D. 13
Answer: (SHOW ANSWER)
NEW QUESTION: 29
Refer to the code below:
Let foodMenu1 = ['pizza', 'burger', 'French fries'];
Let finalMenu = foodMenu1;
finalMenu.push('Garlic bread');
What is the value of foodMenu1 after the code executes?
A. [ 'pizza','Burger', 'French fires', 'Garlic bread']
B. [ 'Garlicbread']
C. [ 'pizza','Burger', 'French fires']
D. [ 'Garlic bread' , 'pizza','Burger', 'French fires' ]
Answer: (SHOW ANSWER)
NEW QUESTION: 30
A. Letx= arr.filter((a) => ( return a>2 ));
B. Let x= arr.filter (( a) => (a<2));
C. Let x= arr.slice(2);
D. Let x= arr.splice(2,3);
E. Let x = arr.slice(2,3);
Answer: (SHOW ANSWER)
NEW QUESTION: 31
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
A. The line 05 assertion passes.
B. The line 02 assertion fails.
C. The line 05 assertion fails.
D. The line 02 assertion passes.
Answer: (SHOW ANSWER)
NEW QUESTION: 32
A developer creates a simple webpage with an input field. When a user enters text in the input
field and clicks the button, the actual value of the field must be displayedin the console.
Here is the HTML file content:
<input type =" text" value="Hello" name ="input">
<button type ="button" >Display </button> The developer wrote the javascript code below:
Const button = document.querySelector('button');
button.addEvenListener('click', () => (
Const input = document.querySelector('input');
console.log(input.getAttribute('value'));
When the user clicks the button, the output is always "Hello".
What needs to be done to make this code work as expected?
A. Replace line 03 with const input = document.getElementByName('input');
B. Replace line 02 with button.addCallback("click", function() {
C. Replace line 04 with console.log(input .value);
D. Replace line 02 with button.addEventListener("onclick", function() {
Answer: (SHOW ANSWER)
NEW QUESTION: 33
A developer has two ways to write a function:
Option A:
function Monster() {
This.growl = () => {
Console.log ("Grr!");
}
}
Option B:
function Monster() {};
Monster.prototype.growl =() => {
console.log("Grr!");
}
After deciding on an option, the developer creates 1000 monster objects.
How many growl methods are created with Option A Option B?
A. 1 growl method is created for Option A.1000 growl methods are created for Option B.
B. 1 growl method is created regardless of whichoption is used.
C. 1000 growl method is created for Option A. 1 growl methods are created for Option B.
D. 1000 growl methods are created regardless of which option is used.
Answer: (SHOW ANSWER)
NEW QUESTION: 34
Refer to the HTML below:
Which JavaScript statement results in changing " The Lion."?
A. document.querySelector('$main li.Tony').innerHTML = '" The Lion ';
B. document.querySelector('$main li:second-child').innerHTML = "The Lion ';
C. document.querySelector('$main li:nth-child(2)'),innerHTML = " The Lion. ';
D. document.querySelectorAll('$main $TONY').innerHTML = '" The Lion
Answer: (SHOW ANSWER)
NEW QUESTION: 35
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 number in the array, The test passes:
Let res = sum2([1, 2, 3 ]) ;
console.assert(res === 6 );
Res = sum3([ 1, 2, 3, 4]);
console.assert(res=== 6);
A different developer made changes to the behavior of sum3 to instead sum all of the numbers
present in the array. The test passes:
Which two results occur when running the test on the updated sum3 function ?
Choose 2 answers
A. The line 02 assertion passes.
B. The line 02 assertion fails
C. The line 05 assertion fails.
D. The line 05 assertion passes.
Answer: (SHOW ANSWER)
NEW QUESTION: 36
A developer is setting up a Node,js server and is creating a script at the root of the source code,
index,js, that will start the server when executed. The developer declares a variable that needsthe
folder location that the code executes from.
Which global variable can be used in the script?
A. _filename
B. this.path
C. _dirname
D. window.location
Answer: (SHOW ANSWER)
NEW QUESTION: 37
Given HTML below:
<div>
<div id ="row-uc"> UniversalContainer</div>
<div id ="row-aa">Applied Shipping</div>
<div id ="row-bt"> Burlington Textiles </div>
</div>
Which statement adds the priority = account CSS class to the universal Containers row ?
A. Document .querySelector('#row-uc').classList.add('priority-account');
B. Document .querySelectorALL('#row-uc').classList.add('priority-account');
C. Document .querySelector('#row-uc').classes.push('priority-account');
D. Document .queryElementById('row-uc').addclass('priority-account');
Answer: (SHOW ANSWER)
NEW QUESTION: 38
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;
B. Let arr2 = Array.from(arr1);
C. Let arr2 = arr1.sort();
D. Let arr2 = arr1.slice(0, 5);
Answer: (SHOW ANSWER)
NEW QUESTION: 39
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?
A. 0 1 2 2
B. 0 0 1 2
C. 0 1 2 3
D. 0 1 1 2
Answer: (SHOW ANSWER)
NEW QUESTION: 40
A. Class ClothingItem implements Item{
B. Class ClothingItem super Item {
C. Class ClothingItem {
D. Class ClothingItem extends Item {
Answer: (SHOW ANSWER)
NEW QUESTION: 41
A developer implements and calls the following code when an application state change occurs:
Const onStateChange =innerPageState) => {
window.history.pushState(newPageState, ' ', null);
}
If the back button is clicked after this method is executed, what can a developer expect?
A. A popstate event is fired with a state property that details the application's last state.
B. The page reloads and all Javascript is reinitialized.
C. A navigate event is fired with a state property that details the previous application state.
D. The page isnavigated away from and the previous page in the browser's history is loaded.
Answer: (SHOW ANSWER)
NEW QUESTION: 42
A class was written to represent items for purchase in an online store, and a secondclass
Representing items that are on sale at a discounted price. THe constructor sets the name to the
first value passed in. The pseudocode is below:
Class Item {
constructor(name, price) {
... // Constructor Implementation
}
}
Class SaleItem extends Item {
constructor (name, price, discount) {
...//Constructor Implementation
}
}
There is a new requirement for a developer to implement a description method that will return a
brief description for Item and SaleItem.
Let regItem =new Item('Scarf', 55);
Let saleItem = new SaleItem('Shirt' 80, -1);
Item.prototype.description = function () { return 'This is a ' + this.name;
console.log(regItem.description()); console.log(saleItem.description());
SaleItem.prototype.description = function () { return 'This is a discounted ' + this.name; }
console.log(regItem.description()); console.log(saleItem.description()); What is the output when
executing the code above ?
A. This is a ScarfThis is a ShirtThis is a discounted ScarfThis is a discounted Shirt
B. This is a ScarfUncaught TypeError: saleItem.description is not a functionThis is aScarfThis is a
discounted Shirt
C. This is a ScarfThis is a ShirtThis is a ScarfThis is a discounted Shirt
D. This is aScarfUncaught TypeError: saleItem.description is not a functionThis is a ShirtThis is a
did counted Shirt
Answer: (SHOW ANSWER)
NEW QUESTION: 43
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?
A. e.nodeTarget ==this
B. Event.clicked
C. button.addEventListener('click')
D. event.target.nodeName == 'BUTTON'
Answer: (SHOW ANSWER)
NEW QUESTION: 44
Which option is a core Node,js module?
A. Ios
B. Path
C. Memory
D. locate
Answer: (SHOW ANSWER)
NEW QUESTION: 45
Given the following code:
NEW QUESTION: 46
Refer to the expression below:
Let x = ('1' + 2) == (6 * 2);
How should this expression be modified to ensure that evaluates to false?
A. Let x = (1+ 2 ) == ( 6 / 2);
B. Let x = ('1' + 2) == ( 6 * 2);
C. Let x = ('1' + ' 2') == ( 6 * 2);
D. Let x = (1 + 2) == ( '6' / 2);
Answer: B (LEAVE A REPLY)
NEW QUESTION: 47
Which three statements are true about promises ?
Choose 3 answers
A. The executor of a new Promise runs automatically.
B. A Promise has a .then() method.
C. A settled promise can become resolved.
D. A fulfilled or rejected promise will not change states .
E. A pending promise canbecome fulfilled, settled, or rejected.
Answer: (SHOW ANSWER)
NEW QUESTION: 48
A developer is leading the creation of a new browser application that will serve a single page
application. The team wants to use a new web framework Minimalsit.js.The Lead developer wants
to advocate for a more seasoned web framework that already has a community around it.
Which two frameworks should the lead developer advocate for?
Choose 2 answers
A. Koa
B. Angular
C. Vue
D. Express
Answer: (SHOW ANSWER)
NEW QUESTION: 49
Refer to the code below?
Let searchString = ' look for this ';
Which two options remove the whitespace from the beginning of searchString?
Choose 2 answers
A. trimStart(searchString);
B. searchString.trimStart();
C. searchString.trimEnd();
D. searchString.replace(/*\s\s*/, '');
Answer: (SHOW ANSWER)
NEW QUESTION: 50
A developer has the function, shown below, that is called when a page loads.
Where can the developer see the log statement after loading the page in the browser?
A. On the browser JavaScriptconsole
B. On the terminal console running the web server
C. In the browser performance tools log
D. On the webpage console log
Answer: (SHOW ANSWER)
NEW QUESTION: 51
A developer wrote a fizzbuzz function thatwhen 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.
Whichtwo test cases will properly test scenarios for the fizzbuzz function?
Choose 2 answers
A. let res = fizzbuzz(5);console.assert ( res === ' ' );
B. let res = fizzbuzz(15);console.assert ( res === ' fizzbuzz ' )
C. let res = fizzbuzz(Infinity);console.assert ( res === ' ' )
D. let res = fizzbuzz(3);console.assert ( res === ' buzz ' )
Answer: B,C,D (LEAVE A REPLY)
NEW QUESTION: 52
Refer to the following array:
Let arr = [1, 2, 3, 4, 5];
Which three options result in x evaluating as [1,2]?
Choose 3 answer
A. let x =arr.splice(0, 2);
B. let x = arr. slice (2);
C. let x arr.filter((a) => (return a <= 2 });
D. let x = arr.filter ((a) => 2 }) ;
E. let x = arr. slice (0, 2);
Answer: (SHOW ANSWER)
NEW QUESTION: 53
A developer creates a simple webpage with an input field. When a user enters text in the
inputfield and clicks the button, the actual value of the field must be displayed in the console.
Here is the HTML file content:
<input type =" text" value="Hello" name ="input">
<button type ="button" >Display </button>
The developer wrote the javascript codebelow:
Const button = document.querySelector('button');
button.addEvenListener('click', () => (
Const input = document.querySelector('input');
console.log(input.getAttribute('value'));
When the user clicks the button, the output is always "Hello".
What needs to be done make this code work as expected?
A. Replace line 04 with console.log(input .value);
B. Replace line 02 with button.addEventListener("onclick", function() {
C. Replace line 03 with const input = document.getElementByName('input');
D. Replace line 02 with button.addCallback("click", function() {
Answer: (SHOW ANSWER)
NEW QUESTION: 54
Which two console logs output NaN?
Choose 2 answers | |
A. console.loeg(10 / 'five');
B. console.log(10 / Number('5) ) ;
C. console.log(parseInt ' ("two')) ;
D. console.log(10 / 0);
Answer: B,C (LEAVE A REPLY)
NEW QUESTION: 55
Why would a developerspecify a package.jason as a developed forge instead of a dependency ?
A. Other required packages depend on it for development.
B. It is only needed for local development and testing.
C. It should be bundled when the package is published.
D. It is required by the application in production.
Answer: (SHOW ANSWER)
NEW QUESTION: 56
After user acceptance testing, the developer is asked to change the webpage background based
on user's location. This change was implemented and deployed for testing.
The tester reports that the background is not changing, however it works as required when
viewing on the developer's computer.
Which two actions will help determine accurate results?
Choose 2 answers
A. The tester should dear their browser cache.
B. The developer should rework the code.
C. The tester should disable their browser cache.
D. The developer should inspect their browser refresh settings.
Answer: (SHOW ANSWER)
NEW QUESTION: 57
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 ?
A. productSKU = productSKU .padStart (16. '0').padstart(19, 'sku');
B. productSKU = productSKU .padEnd (16. '0').padstart('sku');
C. productSKU = productSKU .padStart (19. '0').padstart('sku');
D. productSKU = productSKU .padEnd (16. '0').padstart(19, 'sku');
Answer: (SHOW ANSWER)
NEW QUESTION: 58
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?
A. StartEndSuccess
B. SuccessStartEnd
C. StartSuccessEnd
D. EndStartSuccess
Answer: (SHOW ANSWER)
NEW QUESTION: 59
Refer to the following code:
01 function Tiger(){
02this.Type = 'Cat';
03 this.size = 'large';
04 }
05
06 let tony = new Tiger();
07 tony.roar = () =>{
08 console.log('They\'re great1');
09 };
10
11 function Lion(){
12 this.type = 'Cat';
13 this.size = 'large';
14 }
15
16 let leo = new Lion();
17 //Insertcode here
18 leo.roar();
Which two statements could be inserted at line 17 to enable the function call on line 18?
Choose 2 answers.
A. Object.assign(leo,Tiger);
B. Object.assign(leo,tony);
C. Leo.prototype.roar = () => { console.log('They\'re pretty good:'); };
D. Leo.roar = () => { console.log('They\'re pretty good:'); };
Answer: (SHOW ANSWER)
NEW QUESTION: 60
A. Performs a static analysis on code before execution to look for runtime errors.
B. Executes server-side JavaScript code to avoid learning a new language.
C. Ensures stabilitywith one major release every few years.
D. Uses non-blocking functionality for performant requesthandling .
E. Installs with its own package manager to install and manage third-party libraries.
Answer: (SHOW ANSWER)
NEW QUESTION: 61
Which statement accurately describes the behaviour of the async/ await keyworks ?
A. The associated sometimes returns a promise.
B. The associated class contains some asynchronous functions.
C. The associated function will always return a promise
D. Theassociated function can only be called via asynchronous methods
Answer: (SHOW ANSWER)
NEW QUESTION: 62
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. NODE_DEBUG =http, https node server.js
B. DEBUG = http, https node server.js
C. NODE_DEBUG =true node server.js
D. DEBUG =true node server.js
Answer: (SHOW ANSWER)
NEW QUESTION: 63
Given the following code:
NEW QUESTION: 64
Given the code below:
Setcurrent URL ();
console.log('The current URL is: ' +url );
functionsetCurrentUrl() {
Url = window.location.href:
What happens when the code executes?
A. The url variable has local scope and line 02 executes correctly.
B. The url variable has local scope and line 02 throws an error.
C. The url variable has global scope and line 02 throws an error.
D. The url variable has global scope and line 02 executes correctly.
Answer: (SHOW ANSWER)
NEW QUESTION: 65
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
A. sum(10) ()
B. Sum () (20)
C. sum(5)(5)
D. sum() (5, 5)
E. Sum (5, 5) ()
Answer: (SHOW ANSWER)
NEW QUESTION: 66
Referto the following code:
Which two statement could be inserted at line 17 to enable the function call on line 18?
Choose 2 answers
A. Object.assign (leo. Tiger);
B. leo.roar = () => { console.log('They\'re pretty good!'); );
C. leo.prototype.roar = ( ) =>( console.log('They\'re pretty good!'); };
D. Object.assign (leo, tony);
Answer: (SHOW ANSWER)
NEW QUESTION: 67
A developer is asked to fix some bugs reported by users. To do that, the developer adds
abreakpoint for debugging.
Function Car (maxSpeed, color){
This.maxspeed =masSpeed;
This.color = color;
Let carSpeed = document.getElementById(' CarSpeed');
Debugger;
Let fourWheels =new Car (carSpeed.value, 'red');
When the code execution stops at the breakpoint on line 06, which two types of information are
available in the browser console ?
Choose 2 answers:
A. A variable displaying the number of instances created for the Car Object.
B. The style, event listeners and other attributes applied to the carSpeed DOM element
C. The values of the carSpeed and fourWheels variables
D. The information stored in the window.localStorage property
Answer: (SHOW ANSWER)
NEW QUESTION: 68
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.
Answer: (SHOW ANSWER)
NEW QUESTION: 69
Refer to the code below:
01 const server = require('server');
02 /* Insert code here */
A developer imports a library that creates a web server. Theimported library uses events and
callbacks to start the servers Which code should be inserted at the line 03 to set up an event and
start the web server ?
A. server()
B. serve(( port) => (
C. Server.start ();
D. server.on(' connect ' , ( port) => {console.log('Listening on ' , port) ;})
E. console.log( 'Listening on ', port) ;
Answer: (SHOW ANSWER)
NEW QUESTION: 70
Refer to the code below:
NEW QUESTION: 71
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 fora button with
class= "blue". The test fails because no such button is found.
Which type of test category describes this test?
A. True negative
B. False negative
C. True positive
D. False positive
Answer: (SHOW ANSWER)
NEW QUESTION: 72
A developer copied a JavaScript object:
NEW QUESTION: 73
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."?
A. document.querySelector('$main li.Tony').innerHTML = ' Mr. T. ';
B. document.querySelector('$main li:nth-child(2)'),innerHTML =' Mr. T. ';
C. document.querySelectorAll('$main $TONY').innerHTML = ' Mr. T. ';
D. document.querySelector('$main li:second-child').innerHTML = ' Mr. T. ';
Answer: (SHOW ANSWER)
NEW QUESTION: 74
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 notneed to verify how many times the method has been called.
Which two test approaches describe the requirement?
Choose 2 answers
A. Substitution
B. Black box
C. Stubbing
D. White box
Answer: A,D (LEAVE A REPLY)
NEW QUESTION: 75
Refer to the code below:
NEW QUESTION: 76
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:
A. When thesearch string changes, enqueue the request within a setTimeout.
B. If there is an existing setTimeout and the search string changes, cancel the existingsetTimeout
using thepersisted timerId and replace it with a new setTimeout.
C. Store the timeId of the setTimeout last enqueued by the search string change handle.
D. Ensure that the network request has the property debounce set to true.
E. If there is an existing setTimeout and the search string change, allow the existingsetTimeout to
finish, and do not enqueue a new setTimeout.
Answer: (SHOW ANSWER)
NEW QUESTION: 77
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 the array after the code executes?
A. [1, 2, 3, 4, 4, 5, 4]
B. [1, 2, 3, 4, 5, 4]
C. [1, 2, 3, 4, 5, 4, 4]
D. [1, 2, 3, 5]
Answer: (SHOW ANSWER)
NEW QUESTION: 78
A developer has the following array of hourly wages:
Let arr = (8, 5, 9, 75, 11, 25, 7, 75, , 13, 25);
For workers making less than $10 an hour rate should be multiple by 1.25 and returned in a new
array.
How should the developer implement the request?
A. let arrl = arr.filterBy((val) => val < 10 ).aapBy<(num) -> num = ..25 );
B. let arrl = arr.filter((val) => val < 10).map((num) -> num = 1.25);
C. let arrl = arr .rr.acArray ((val) => ( val < 10 )) ,map((num) => { num * 1.25 ));
D. let arrl = arr-map((num) => { return ran * 1.25 }).filter((val) -> { return val < 10));
Answer: (SHOW ANSWER)
NEW QUESTION: 79
A developer wrote the following code:
01 let X = object.value;
02
03 try {
04 handleObjectValue(X);
05 } catch (error) {
06 handleError(error);
07 }
Thedeveloper 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?
A. 03 try{04 handleObjectValue(x);05 }catch(error){06 handleError(error);07 } then {08
getNextValue();09 }
B. 03 try{04 handleObjectValue(x);05 } catch(error){06 handleError(error);07 }08 getNextValue();
C. 03 try{04 handleObjectValue(x);05 } catch(error){06 handleError(error);07 } finally {08
getNextValue();10 }
D. 03 try {04 handleObjectValue(x)05 ........................
Answer: (SHOW ANSWER)
NEW QUESTION: 80
A. windows,addEventListener('DOMContent Loaded ', personalizeWebsiteContent);
B. windows,addEventListener('load', personalizeWebsiteContent);
C. windows,addEventListener('onDOMCContentLoaded', personalizeWebsiteContent);
D. windows,addEventListener('onload', personalizeWebsiteContent);
Answer: (SHOW ANSWER)
NEW QUESTION: 81
A developer is leading the creation of a new web server for their team that will fulfill API requests
from an existing client.
The team wants a web server that runs on Node.Js, and they want to use the new web framework
Minimalist.Js. The lead developer wants to advocate for a more seasoned back-end framework
that already has a community around it.
Which two frameworks could the lead developer advocate for?
Choose 2 answers
A. Express
B. Angular
C. Gatsby
D. Koa
Answer: (SHOW ANSWER)
NEW QUESTION: 82
Refer to the code below:
let timeFunction =() => {
console.log('Timer called.");
};
let timerId = setTimeout (timedFunction, 1000);
Which statement allows a developer to cancel the scheduled timed function?
A. clearTimeout(timerId);
B. removeTimeout(timerId);
C. removeTimeout(timedFunction);
D. clearTimeout(timedFunction);
Answer: A (LEAVE A REPLY)
NEW QUESTION: 83
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?
A. 1 2 5 3 4
B. 2 1 4 3 5
C. 2 5 1 3 4
D. 1 2 43 5
Answer: (SHOW ANSWER)
NEW QUESTION: 84
Given the code below:
const delay = sync delay => {
Return new Promise((resolve, reject) => {
setTimeout (resolve,delay);});};
const callDelay =async () =>{
const yup =await delay(1000);
console.log(1);
What is logged to the console?
A. 1 2 3
B. 1 3 2
C. 2 3 1
D. 2 1 3
Answer: (SHOW ANSWER)
NEW QUESTION: 85
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?
A. 5
B. Nan
C. 10
D. Undefined
Answer: (SHOW ANSWER)
NEW QUESTION: 86
A developer receives a comment from the Tech Lead that the code given below has error:
const monthName = 'July';
const year = 2019;
if(year === 2019) {
monthName ='June';
}
Which line edit should be made to make this code run?
A. 02 let year =2019;
B. 03 if (year == 2019) {
C. 02 const year = 2020;
D. 01 let monthName ='July';
Answer: (SHOW ANSWER)
NEW QUESTION: 87
Refer to the following code:
Which statement should be added to line 09 for the code to display. The boat has a capacity of 10
people?
A. super.size = size;
B. this.size = size;
C. super (size);
D. ship.size size;
Answer: (SHOW ANSWER)
NEW QUESTION: 88
Refer to the code below:
Line 05 causes an error.
What are the values of greeting and salutation once code completes?
A. Greeting is Hello and salutation is I say hello.
B. Greeting is Goodbye and salutation is Hello, Hello.
C. Greeting is Goodbye and salutation is I say Hello.
D. Greeting is Hello and salutation is Hello, Hello.
Answer: (SHOW ANSWER)
NEW QUESTION: 89
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 theserver 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. ws.on ('connect', ( ) => {console.log('connected to client'); ws.on('error', (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. try{ws.connect (( ) => {console.log('connected to client'); });} catch(error)
{ console.log('ERROR',error); };}
Answer: (SHOW ANSWER)
NEW QUESTION: 90
Refer to the following object.
How can a developer access the fullName property for dog?
A. Dog.fullName ( )
B. Dog, function, fullName
C. Dog.fullName
D. Dog, get,fullName
Answer: (SHOW ANSWER)
NEW QUESTION: 91
A developer wants to use a module called DataPrettyPrint. This module exports one default
functioncalled printDate ().
How can a developer import and use the printDate() function?
A.
B.
C.
D.
Answer: (SHOW ANSWER)
NEW QUESTION: 92
Given the followingcode, what is the value of x?
let x = '15' + (10 * 2);
A. 50
B. 3020
C. 35
D. 1520
Answer: (SHOW ANSWER)
NEW QUESTION: 93
There is a new requirement for a developer to implement a currPrice method that will return the
current price of the item or sales..
NEW QUESTION: 94
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?
A. ["foo:1","bar:2"]
B. ["bar","foo"]
C. [1,2]
D. ["foo","bar"]
Answer: (SHOW ANSWER)
NEW QUESTION: 95
Given the expressionsvar1 and var2, what are two valid ways to return the concatenation of the
two expressions and ensure it is string? Choose 2 answers
A. string.concat (var1 +var2)
B. String (var1) .concat (var2)
C. var1.toString ( ) var2.toString ( )
D. var1 + var2
Answer: (SHOW ANSWER)
NEW QUESTION: 96
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 ?
A. First is who and second is where
B. First is Who and second is When
C. First is why and second is where
D. First is why and second is when
Answer: (SHOW ANSWER)
NEW QUESTION: 97
Refer to the code snippet:
Function getAvailabilityMessage(item) {
If (getAvailability(item)){
Var msg ="Username available";
}
Return msg;
}
A developer writes this code to return a message to user attempting to register a new username.
If the username is available, variable.
What is the return value of msg hen getAvailabilityMessage ("newUserName" ) is executed and
getAvailability("newUserName") returns false?
A. undefined
B. "Username available"
C. "Msg is not defined"
D. "newUserName"
Answer: (SHOW ANSWER)
NEW QUESTION: 98
A developer has an ErrorHandler module that contains multiple functions.
What kind of export be leverages so that multiple functions can beused?
A. Default
B. Multi
C. All
D. Named
Answer: (SHOW ANSWER)
NEW QUESTION: 99
Refer to the following code:
<html lang="en">
<body>
<divonclick = "console.log('Outer message') ;">
<button id ="myButton">CLick me<button>
</div>
</body>
<script>
function displayMessage(ev) {
ev.stopPropagation();
console.log('Inner message.');
}
const elem = document.getElementById('myButton');
elem.addEventListener('click' , displayMessage);
</script>
</html>
What will the console show when the button is clicked?
A. Inner messageOuter message
B. Outer message
C. Inner message
D. Outer messageInner message
Answer: (SHOW ANSWER)
Which code should replace the placeholder comment on line 06 to hide accounts that do not
match the search string?
A. 'None' : 'block'
B. 'Hidden, visible
C. 'Block' : 'none'
D. 'Visible : 'hidden'
Answer: (SHOW ANSWER)