Aindump2go Javascript-Developer-I Vce 2022-Mar-25 by Lawrence 103q Vce
Aindump2go Javascript-Developer-I Vce 2022-Mar-25 by Lawrence 103q Vce
Salesforce
Exam Questions JavaScript-Developer-I
Salesforce Certified JavaScript Developer I
NEW QUESTION 1
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?
Answer: A
NEW QUESTION 2
Refer to the code below:
A. Undefined
B. ‘ new york ’
C. ‘ New York ’
D. An error
Answer: B
NEW QUESTION 3
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:
Answer: D
NEW QUESTION 4
A developer at Universal Containers creates a new landing page based on HTML, CSS, and JavaScript TO ensure that visitors have a good experience, a script
named personaliseContext needs to be executed when the webpage is fully loaded (HTML content and all related files ), in order to do some custom initialization.
Which statement should beused to call personalizeWebsiteContent based on the above business requirement?
A. document.addEventListener(‘’onDOMContextLoaded’, personalizeWebsiteContext);
B. window.addEventListener(‘load’,personalizeWebsiteContext);
C. window.addEventListener(‘onload’, personalizeWebsiteContext);
D. Document.addEventListener(‘‘’DOMContextLoaded’ , personalizeWebsiteContext);
Answer: B
NEW QUESTION 5
A developer creates an object where its properties should be immutable and prevent properties from being added or modified.
Which method shouldbe used to execute this business requirement ?
A. Object.const()
B. Object.eval()
C. Object.lock()
D. Object.freeze()
Answer: D
NEW QUESTION 6
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 isdisplayed when myFunction(true) is called?
A. 2 2 1 1
B. 2 2 undefined undefined
C. 2 2 1 2
D. 2 2 2 2
Answer: C
NEW QUESTION 7
Which function should a developer use to repeatedly execute code at a fixed interval ?
A. setIntervel
B. setTimeout
C. setPeriod
D. setInteria
Answer: A
NEW QUESTION 8
Refer to the code below:
1 let car1 = new promise((_, reject) =>
2 setTimeout(reject, 2000, “Car 1 crashed in”));
3 let car2 = new Promise(resolve => setTimeout(resolve, 1500, “Car 2 completed”));
4 let car3 = new Promise(resolve => setTimeout (resolve, 3000, “Car 3 Completed”));
5 Promise.race([car1, car2, car3]) 06 .then(value => (
07 let result = $(value) the race. `; 08 ))
9 catch( arr => (
10 console.log(“Race is cancelled.”, err); 11 ));
What is the value of result when Promise.race executes?
Answer: C
NEW QUESTION 9
Given the following code: Let x =null; console.log(typeof x);
What is the output of the line 02?
A. “Null”
B. “X”
C. “Object”
D. “undefined”
Answer: C
NEW QUESTION 10
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
Answer: AD
NEW QUESTION 10
Refer to HTML below:
<p> The current status of an Order: <span id =”status”> In Progress </span> </p>.
Which JavaScript statement changes the text ‘In Progress’ to ‘Completed’ ?
A. document.getElementById(“status”).Value = ’Completed’ ;
B. document.getElementById(“#status”).innerHTML = ’Completed’ ;
C. document.getElementById(“status”).innerHTML = ’Completed’ ;
D. document.getElementById(“.status”).innerHTML = ’Completed’ ;
Answer: C
NEW QUESTION 12
The developer wants to test this code:
Const toNumber =(strOrNum) => strOrNum; Which two tests are most accurate for this code? Choose 2 answers
A. console.assert(toNumber(‘2’) ===2);
B. console.assert(Number.isNaN(toNumber()));
C. console.assert(toNumber(‘-3’) < 0);
D. console.assert(toNumber () === NaN);
Answer: AC
NEW QUESTION 14
Which three actions can be using the JavaScript browser console? Choose 3 answers:
Answer: ACD
NEW QUESTION 18
Refer to code below:
Const objBook = { Title: ‘Javascript’,
};
Object.preventExtensions(objBook); ConstnewObjBook = objBook; newObjectBook.author = ‘Robert’;
What are the values of objBook and newObjBook respectively ?
Answer: A
NEW QUESTION 23
Refer to code below:
Answer: D
NEW QUESTION 28
At Universal Containers, every team has its own way of copyingJavaScript objects. The code
Snippet shows an implementation from one team:
Answer: C
NEW QUESTION 30
Refer to the code below:
Which two statements correctly execute the runParallel () function? Choose 2 answers
Answer: BD
NEW QUESTION 32
Given the following code: Let x =(‘15’ + 10)*2;
What is the value of a?
A. 3020
B. 1520
C. 50
D. 35
Answer: A
NEW QUESTION 37
Refer to the code below? LetsearchString = ‘ look for this ’;
Which two options remove the whitespace from the beginning of searchString? Choose 2 answers
A. searchString.trimEnd();
B. searchString.trimStart();
C. trimStart(searchString);
D. searchString.replace(/*\s\s*/, ‘’);
Answer: BD
NEW QUESTION 42
Refer to the following object:
A. cat.fullName
B. cat.fullName()
C. cat.get.fullName
D. cat.function.fullName()
Answer: A
NEW QUESTION 46
Refer to the code below:
What is the output of this function when called with an empty array?
A. Returns 0
B. Throws an error
C. Returns 10
D. Returns NaN
Answer: C
NEW QUESTION 50
developer creates a new web server that uses Node.js. It imports aserver library that uses events and callbacks for handling server functionality.
The server library is imported with require and is made available to the code by a
variable named server. The developer wants to log any issues that the server has while booting up.
Given the code and the information the developer has, which code logs an error at boost with an event?
Answer: C
NEW QUESTION 53
Refer to code below: console.log(0);
setTimeout(() => ( console.log(1);
});
console.log(2); setTimeout(() => { console.log(3);
), 0);
console.log(4);
In which sequence will the numbers be logged?
A. 01234
B. 02431
C. 02413
D. 13024
Answer: C
NEW QUESTION 57
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: ClassPost {
// 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?
Answer: C
NEW QUESTION 61
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?
A. consol
B. timeLog ()
C. console.timeStamp ()
D. console.trace()
E. console.getTime ()
Answer: A
NEW QUESTION 66
A developer is asked to fix some bugs reported by users. Todo that, the developer adds a breakpoint 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:
Answer: CD
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.The imported 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.start ();
B. server.on(‘ connect ’ , ( port) => { console.log(‘Listening on ’ , port);})
C. server()
D. serve(( port) => (
E. console.log( ‘Listening on ’, port) ;
Answer: B
NEW QUESTION 71
Refer to the code below:
Answer: C
NEW QUESTION 73
is below:
<input type=”file” onchange=”previewFile()”>
<img src=”” height=”200” alt=”Image Preview…”/> The JavaScript portion is:
1 function previewFile(){
2 const preview = document.querySelector(‘img’);
3 const file = document.querySelector(‘input[type=file]’).files[0]; 04 //line 4 code
05 reader.addEventListener(“load”, () =>{ 06 preview.src = reader.result;
7 },false);
8 //line 8 code
9}
In lines 04 and 08, which code allows the user to select an image from their local computer , and to display the image in the browser?
Answer: D
NEW QUESTION 76
The developer has a function that prints “Hello” to an input name. To test this, thedeveloper created a function that returns “World”. However the following snippet
does not print “ Hello World”.
What can the developer do to change the code to print “Hello World” ?
A. Changeline 7 to ) () ;
B. Change line 2 to console.log(‘Hello’ , name() );
C. Change line 9 to sayHello(world) ();
D. Change line 5 to function world ( ) {
Answer: B
NEW QUESTION 77
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. 10
B. Nan
C. 5
D. Undefined
Answer: C
NEW QUESTION 81
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 lack of the new keyword on line 02?
Answer: C
NEW QUESTION 84
Refer to the following code:
A. Undefined
B. Line 13 throws an error.
C. ‘Undefined values!’
D. ‘Null value!’
Answer: A
NEW QUESTION 85
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 runningline 05?
Answer: B
NEW QUESTION 90
Which option is a core Node,js module?
A. Path
B. Ios
C. Memory
D. locate
Answer: A
NEW QUESTION 94
A developer has code that calculates a restaurant bill, but generates incorrectanswers 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?
Answer: A
NEW QUESTION 99
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 0 1 2
B. 0 1 2 3
C. 0 1 1 2
D. 0 1 2 2
Answer: C
Which two implementations of Utils.js export foo and bar such that the code above runs without error?
Choose 2 answers
A.
B.
C.
D.
Answer: BC
Answer: D
Answer: D
A. ‘ name ’ : ‘ block ’
B. ‘ Block ’ : ‘ none ’
C. ‘ visible ’ : ‘ hidden ’
D. ‘ hidden ’ : ‘ visible ’
Answer: B
* JavaScript-Developer-I Most Realistic Questions that Guarantee you a Pass on Your FirstTry
* JavaScript-Developer-I Practice Test Questions in Multiple Choice Formats and Updatesfor 1 Year