0% found this document useful (0 votes)
7 views15 pages

JavaScript Developer I Salesforce Exam Practice Questions

This document provides a collection of practice questions for the JavaScript Developer I exam, designed to mirror the exam's structure and topics. It includes various question types, accurate answer keys, and is intended for personal study only. For additional resources, users are directed to CertQuestionsBank.com and related social media platforms.
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)
7 views15 pages

JavaScript Developer I Salesforce Exam Practice Questions

This document provides a collection of practice questions for the JavaScript Developer I exam, designed to mirror the exam's structure and topics. It includes various question types, accurate answer keys, and is intended for personal study only. For additional resources, users are directed to CertQuestionsBank.com and related social media platforms.
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/ 15

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

JavaScript Developer I 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 JavaScript Developer I exam online questions below.
1.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 ’).getBoundingClientRest().width
B. document.getElementById(‘ card-01 ’).style.width
C. document.getElementById(‘ card-01 ’).width
D. document.getElementById(‘ card-01 ’).innerHTML.lenght*e
Answer: A

2. Given the following code:

What will be the first four numbers logged?


A. 0012
B. 0112
C. 0122
D. 0123
Answer: B

3. 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. Event.clicked
B. e.nodeTarget ==this
C. event.target.nodeName == ‘BUTTON’
D. button.addEventListener(‘click’)
Answer: C

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

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

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

7.A developer wrote a fizzbuzz function that when 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.
Which two 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

8. Given the following code, what is the value of x?


let x = ‘15'+ (10 * 2);
A. 35
B. 50
C. 1520
D. 3020
Answer: C

9. 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
A. On line 02, use event.first to test if it is the first execution.
B. On line 04, use event.stopPropagation ( ),
C. On line 04, use button.removeEventListener(‘ click”, listen);
D. On line 06, add an option called once to button.addEventListener().
Answer: C,D

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

11. 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. searchString.trimEnd();
B. searchString.trimStart();
C. trimStart(searchString);
D. searchString.replace(/*\s\s*/, ‘’);
Answer: B,D

12. Teams at Universal Containers (UC) work on multiple JavaScript projects at the same time.
UC is thinking about reusability and how each team can benefit from the work of others.
Going open-source or public is not an option at this time.
Which option is available to UC with npm?
A. Private packages can be scored, and scopes can be associated to a private registries.
B. Private registries are not supported by npm, but packages can be installed via URL.
C. Private packages are not supported, but they can use another package manager like yarn.
D. Private registries are not supported by npm, but packages can be installed via git.
Answer: A

13. Universal Containers recently launched its new landing page to host a crowd-funding campaign.
The page uses an external library to display some third-party ads.
Once the page is fully loaded, it creates more than 50 new HTML items placed randomly inside the
DOM, like the one in the code below:

All the elements includes the same ad-library-item class, They are hidden by default, and they are
randomly displayed while the user navigates through the page.
A. Use the DOM inspector to prevent the load event to be fired.
B. Use the browser to execute a script that removes all the element containing the class ad-library-
item.
C. Use the DOM inspector to remove all the elements containing the class ad-library-item.
D. Use the browser console to execute a script that prevents the load event to be fired.
Answer: C

14. 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?
A. Promise.reject(‘cool error here’).then(error => console.error(error));
B. Promise.reject(‘cool error here’).catch(error => console.error(error));
C. New Promise((resolve, reject) => (throw ‘cool error here’}).catch(error => console.error(error)) ;
D. New Promise(() => (throw ‘cool error here’}).then(null, error => console.error(error)));
Answer: B,C

15. A class was written to represent items for purchase in an online store, and a second class
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 Scarf
Uncaught TypeError: saleItem.description is not a function
This is aScarf
This is a discounted Shirt
B. This is a Scarf
This is a Shirt
This is a Scarf
This is a discounted Shirt
C. This is a Scarf
This is a Shirt
This is a discounted Scarf
This is a discounted Shirt
D. This is aScarf
Uncaught TypeError: saleItem.description is not a function
This is a Shirt
This is a did counted Shirt
Answer: B

16. 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. “Username available”
B. “newUserName”
C. “Msg is not defined”
D. undefined
Answer: D

17. 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 Hello, 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 I say hello.
Answer: A

18.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. ship.size size;
C. super (size);
D. this.size = size;
Answer: D

19.GIven a value, which three options can a developer use to detect if the value is NaN? Choose 3
answers
A. value == NaN
B. Object.is(value, NaN)
C. value === Number.NaN
D. value ! == value
E. Number.isNaN(value)
Answer: A,E

20. 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.querySelectorAll(‘$main $TONY’).innerHTML = ’ Mr. T. ’;
B. document.querySelector(‘$main li:second-child’).innerHTML = ’ Mr. T. ’;
C. document.querySelector(‘$main li.Tony’).innerHTML = ’ Mr. T. ’;
D. document.querySelector(‘$main li:nth-child(2)’),innerHTML = ’ Mr. T. ’;
Answer: D

21. Refer to the code below:


01 let car1 = new promise((_, reject) =>
02 setTimeout(reject, 2000, “Car 1 crashed in”));
03 let car2 = new Promise(resolve => setTimeout(resolve, 1500, “Car 2
completed”));
04 let car3 = new Promise(resolve => setTimeout (resolve, 3000, “Car 3
Completed”));
05 Promise.race([car1, car2, car3])

22.Refer to the following code block:


What is the console output?
A. > Better student Jackie got 70% on test.
B. > Jackie got 70% on test.
C. > Uncaught Reference Error
D. > Better student Jackie got 100% on test.
Answer: D

23. Refer to the code below:


for(let number =2 ; number <= 5 ; number += 1 ) {
// insert code statement here
}
The developer needs to insert a code statement in the location shown.
The code statement has these requirements:

24. 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*/;
6 )};
7}
Which code should replace the placeholder comment on line 05 to hide accounts that do not match
the search string?
A. ‘ name ’ : ‘ block ’
B. ‘ Block ’ : ‘ none ’
C. ‘ visible ’ : ‘ hidden ’
D. ‘ hidden ’ : ‘ visible ’
Answer: B

25. Refer to the following object.

How can a developer access the fullName property for dog?


A. Dog.fullName
B. Dog.fullName ( )
C. Dog, get, fullName
D. Dog, function, fullName
Answer: A

26.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. 2 1 4 3 5
B. 2 5 1 3 4
C. 1 2 4 3 5
D. 1 2 5 3 4
Answer: B

27. Refer to the code below:


Function Person(firstName, lastName, eyecolor) {
this.firstName =firstName;
this.lastName = lastName;
this.eyeColor = eyeColor;
}
Person.job = ‘Developer’;
const myFather = new Person(‘John’, ‘Doe’);
console.log(myFather.job);
What is the output after the code executes?
A. ReferenceError: eyeColor is not defined
B. ReferenceError: assignment to undeclared variable “Person”
C. Developer
D. Undefined
Answer: D

28. 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?
A. const https =require(‘https’);
B. const server =require(‘secure-server’);
C. const tls = require(‘tls’);
D. const http =require(‘http’);
Answer: A

29. 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?
A. True positive
B. True negative
C. False positive
D. False negative
Answer: D

30. 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 passes.
D. The line 05 assertion fails.
Answer: A,D

31.Considering the implications of 'use strict' on line 04, which three statements describe the
execution of the code? Choose 3 answers
A. z is equal to 3.14.
B. 'use strict' is hoisted, so it has an effect on all lines.
C. 'use strict' has an effect only on line 05.
D. 'use strict' has an effect between line 04 and the end of the file.
E. Line 05 throws an error.
Answer: A,C,E

32. 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 0
B. Throws an error
C. Returns 10
D. Returns NaN
Answer: D

33. 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. 11
C. 12
D. 13
Answer: B

Get JavaScript Developer I exam dumps full


version.

Powered by TCPDF (www.tcpdf.org)

You might also like