0% found this document useful (0 votes)
110 views16 pages

Salesforce Certified JavaScript Developer Exam Practice Questions

Salesforce Certified JavaScript Developer Exam Practice Questions
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
110 views16 pages

Salesforce Certified JavaScript Developer Exam Practice Questions

Salesforce Certified JavaScript Developer Exam Practice Questions
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

This PDF contains a set of carefully selected practice questions for the

Salesforce Certified JavaScript Developer exam. These questions are


designed to reflect the structure, difficulty, and topics covered in the
actual exam, helping you reinforce your understanding and identify
areas for improvement.

What's Inside:

1. Topic-focused questions based on the latest exam objectives


2. Accurate answer keys to support self-review
3. Designed to simulate the real test environment
4. Ideal for final review or daily practice

Important Note:

This material is for personal study purposes only. Please do not


redistribute or use for commercial purposes without permission.

For full access to the complete question bank and topic-wise explanations, visit:
CertQuestionsBank.com

Our YouTube: https://www.youtube.com/@CertQuestionsBank

FB page: https://www.facebook.com/certquestionsbank
Share some Salesforce Certified JavaScript Developer exam online
questions below.
1.Refer to the code below:
const car = {
price:100,
getPrice:function(){
return this.price;
}
};
const customCar = Object.create(car);
customCar.price = 70;
delete customCar.price;const result = customCar.getPrice(); Whatis the value of result after the code
executes?
A. 100
B. undefined
C. null
D. 70
Answer: A

2.Which three options show valid methods for creating a fat arrow function?
Choose 3 answers
A. x => (console.log(‘ executed ’) ; )
B. [ ] => (console.log(‘ executed ’) ;)
C. () => (console.log(‘ executed ’) ;)
D. X,y,z => (console.log(‘ executed ’) ;)
E. (x,y,z) => (console.log(‘ executed ’) ;)
Answer: A,E

3.Refer tothe code below:


What is the value of result after line 10 executes?
A. Error: myFather.job is not a function
B. John Developer
C. undefined Developer
D. John undefined
Answer: B

4.Which two code snippets show working examples of a recursive function? Choose 2 answers
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 );
};
Answer: A,D

5.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. 1000 growl method is created for Option
A. 1 growl methods are created for Option B.
C. 1000 growl methods are created regardless of which option is used.
D. 1 growl method is created regardless of which option is used.
Answer: B

6.Given the JavaScript below:

Which code should replace the placeholder comment on line 05 to highlight accounts that match the
search string'
A. 'yellow': null
B. null: 'yellow’
C. 'none1: "yellow’
D. 'yellow: 'none'
Answer: D

7.In the browser, the window object is often used to assign variables that require the broadest scope
in an application Node.js application does not have access to the window object by default.
Which two methods areused to address this? Choose 2 answers
A. Use the document object instead of the window object.
B. Assign variables to the global object.
C. Create a new window object in the root file.
D. Assign variables to module.exports and require them as needed.
Answer: B

8.Given the following code:

What is the output of line 02?


A. "null"
B. "x-
C. "undefined" 0
D. 'object"
Answer: D

9.A developer wants to define a function log to be used a few times on a single-file JavaScript script.
01 // Line 1 replacement
02 console.log('"LOG:', logInput);
03 }
Which two options can correctly replaceline 01 and declare the function for use? Choose 2 answers
A. function leg(logInput) {
B. const log(loginInput) {
C. const log = (logInput) => {
D. function log = (logInput) {
Answer: A,C

10.Which statement phrases successfully?


A. JSON.parse (‘ foo ’ );
B. JSON.parse (“ foo ” );
C. JSON.parse( “ ‘ foo ’ ” );
D. JSON.parse(‘ “ foo ” ’);
Answer: D

11.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. [1,2]
B. [“bar”,”foo”]
C. [“foo”,”bar”]
D. [“foo:1”,”bar:2”]
Answer: C

12.There is a new requirement for a developer to implement a currPrice method that will return the
current price of the item or sales..

What is the output when executing the code above


A. 50
Uncaught TypeError: saleItem,desrcription is not a function
50
80
B. 50
80
50
72
C. 50
80
72
D. 50
80
Uncaught Reference Error:this,discount is undefined 72
Answer: B

13.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?
A. aPromise and bPromise run sequentially.
B. Neither aPromise or bPromise runs.
C. aPromise and bPromise run in parallel.
D. Only aPromise runs.
Answer: B

14. Works in both the browser and Node.js.


Which meet the requirements?
A. assert (number % 2 === 0);
B. console.error(number % 2 === 0);
C. console.debug(number % 2 === 0);
D. console.assert(number % 2 === 0);
Answer: B

15.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)

A. Option
B. Option
C. Option
D. Option
Answer: A

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


A. const setLocalStorage = (storageKey, jsObject) => {window.localStorage.setItem(storageKey,
JSON.stringify(jsObject));}
B. const setLocalStorage = (jsObject) => {window.localStorage.connectObject(jsObject));}
C. const setLocalStorage= (jsObject) => {window.localStorage.setItem(jsObject);}
D. const setLocalStorage = (storageKey, jsObject) => {window.localStorage.persist(storageKey,
jsObject);}
Answer: A

17.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?
A. Using the debugger command on line 05.
B. Using the debugger command on line 03
C. Calling the console.trace (total) method on line 03.
D. Wrapping findSubtotal in a console.log() method.
Answer: A

18.Universal Container (UC) just launched a new landing page, but users complain that the website is
slow. A developer found some functions that cause this problem.
To verify this, the developer decides to do everything and log the time each of these three suspicious
functions consumes.
console.time(‘Performance’);
maybeAHeavyFunction();
thisCouldTakeTooLong();
orMaybeThisOne();
console.endTime(‘Performance’);
Which function can the developer use to obtain the time spent by every one of the three functions?
A. console.timeLog()
B. console.getTime()
C. console.trace()
D. console.timeStamp()
Answer: A

19.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. 01 let monthName =’July’;
B. 02 let year =2019;
C. 02 const year = 2020;
D. 03 if (year == 2019) {
Answer: A

20.Which statement can a developer apply to increment the browser's navigation history without a
page refresh?
A. window.history.pushState(newStateObject);
B. window.history.pushStare(newStateObject, ' ', null);
C. window.history.replaceState(newStateObject,'', null);
D. window.history.state.push(newStateObject);
Answer: C

21.A developer writes the code below to calculate the factorial of a given number function
sum(number) {return number * sum(number-1);
}
sum (3);
What is the result of executing the code.
A. 0
B. 6
C. Error
D. -Infinity
Answer: C

22.Refer to the following code:

A. Option A
B. Option B
C. Option C
D. Option D
Answer: A

23.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. Vue
B. Angular
C. Koa
D. Express
Answer: B,D

24.is below:
<input type=”file” onchange=”previewFile()”>
<img src=”” height=”200” alt=”Image Preview…”/>
The JavaScript portion is:
01 functionpreviewFile(){
02 const preview = document.querySelector(‘img’);
3 const file = document.querySelector(‘input[type=file]’).files[0];
4 //line 4 code
5 reader.addEventListener(“load”, () => {
6 preview.src = reader.result;
7 },false);
08 //line 8 code
09 }
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?
A. 04 const reader = new File();08 if (file) URL.createObjectURL(file);
B. 04 const reader = new FileReader();08if (file) URL.createObjectURL(file);
C. 04 const reader = new File();08 if (file) reader.readAsDataURL(file);
D. 04 const reader = new FileReader();08 if (file) reader.readAsDataURL(file);
Answer: D

25.Refer to the code below:


What is the result when the Promise in the execute function is rejected?
A. Resolved1 Resolved2 Resolved3Resolved4
B. Rejected
C. Rejected Resolved
D. Rejected1 Rejected2 Rejected3 Rejected Rejected Rejected4
Answer: C

26.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 = function(num1){
return num1 + num2;
}
C. const addBy = (num1) => num1 + num2 ;
D. const addBY = (num1) => (num2) => num1 + num2;
Answer: A, D

27.A developer wants to create an object from a function in the browser using the code below.
What happens due to the lack of the mm keyword on line 02?
A. window.name is assigned to 'hello' and the variable = remains undefined.
B. window.m Is assigned the correct object.
C. The m variable is assigned the correct object but this.name remains undefined.
D. The m variable is assigned the correct object.
Answer: A

28.Given the code below:


FunctionmyFunction(){
A =5; Var b =1;
}
myFunction();
console.log(a);
console.log(b);
What is the expected output?
A. Both lines 08 and 09 are executed, and the variables are outputted.
B. Line 08 outputs the variable, but line 09 throws an error.
C. Line 08thrones an error, therefore line 09 is never executed.
D. Both lines 08 and 09 are executed, but values outputted are undefined.
Answer: B

29.Whichthree actions can be using the JavaScript browser console? Choose 3 answers:
A. View and change DOM the page.
B. Display a report showing the performance of a page.
C. Run code that is not related to page.
D. view, change, and debug the JavaScript code of the page.
E. View and change security cookies.
Answer: A,C,D

30.then(value => (
07 let result = $(value) the race. `;
08 ))

31.Refer to the code:


Given the code above, which three properties are set pet1? Choose 3 answers:
A. Name
B. canTalk
C. Type
D. Owner
E. Size
Answer: B,C,E

32.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?
A. The z variable is assigned the correct object.
B. The z variable is assigned the correct object but this.name remains undefined.
C. Window.name is assigned to ‘hello’ and the variable z remains undefined.
D. Window.m is assigned the correct object.
Answer: C

33.What are two unique features of functions defined with a fat arrow as compared to normal function
definition? Choose 2 answers
A. The function generated its own this making it useful for separating the function’s scope from its
enclosing scope.
B. The function receives an argument that is always in scope, called parent This, which is the
enclosing lexical scope.
C. If the function has a single expression in the function body, the expression will be evaluated and
implicit returned.
C. The function uses the this from the enclosing scope.
Answer: A,B

34.Refer to the following code:

What is the value of output on line 11?


A. [1, 2]
B. [‘’foo’’, ‘’bar’’]
C. [‘’foo’’:1, ‘’bar’’:2’’]
D. An error will occur due to the incorrect usage of the for…of statement on line 07.
Answer: D

35.Refer to the code below:


letsayHello = () => {
console.log (‘Hello, world!’);
};
Which code executes say Hello once, two minutes from now?
A. setTimeout(sayHello, 12000);
B. setInterval(sayHello, 12000);
C. setTimeout(sayHello(), 12000);
D. delay(sayHello, 12000);
Answer: A

36.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?
A. 03 try{
4 handleObjectValue(x);
5 } catch(error){
6 handleError(error);
7 } then {
8 getNextValue();
9}
B. 03 try{
4 handleObjectValue(x);
5 } catch(error){
6 handleError(error);
7 } finally {
8 getNextValue();
10 }
C. 03 try{
4 handleObjectValue(x);
5 } catch(error){
6 handleError(error);
07 }
8 getNextValue();
D. 03 try {
4 handleObjectValue(x)
5 ……………………
Answer: D

Get Salesforce Certified JavaScript Developer


exam dumps full version.

Powered by TCPDF (www.tcpdf.org)

You might also like