Certification Preparation for Salesforce JavaScript Developer I Exam
Last exam update: Nov 26 ,2024
Page 1 out of 11. Viewing questions 1-15 out of 157
Question 1
developer uses the code below to format a date.
After executing, what is the value of formattedDate?
A.
May 10, 2020
B.
June 10, 2020
C.
October 05, 2020
D.
November 05, 2020
Answer:
A
User Votes:
A
50%
B 1 votes
50%
C
50%
D
50%
Discussions
0/ 1000
Question 2
Refer to the code below:
What is the value of result when the code executes?
A.
10-10
B.
5-5
C.
10-5
D.
5-10
Answer:
A
User Votes:
A 1 votes
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 3
A 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 turnaround 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=true node server.js
B.
DEBUG=http, https node server.js
C.
NODE_DEBUG=http,https node server.js
D.
DEBUG=true node server.js
Answer:
D
User Votes:
A 1 votes
50%
B
50%
C
50%
D 1 votes
50%
Discussions
0/ 1000
Question 4
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 passes.
C.
The line 02 assertion fails.
D.
The line 05 assertion fails.
Answer:
B, D
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 5
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.
console. timeLog ()
B.
console.timeStamp ()
C.
console.trace()
D.
console.getTime ()
Answer:
A
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 6
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 not need to verify how many times the method has been called. Which two test approaches describe the requirement? Choose 2 answers
A.
White box
B.
Stubbing
C.
Black box
D.
Substitution
Answer:
A, D
User Votes:
A
50%
B 1 votes
50%
C
50%
D 1 votes
50%
Discussions
0/ 1000
Alka0111
5 months, 3 weeks ago
Stubbing Stubbing is the correct approach here. It involves replacing a real component with a "stub" that provides predefined responses to method calls. Stubs are typically used in testing to simulate the behavior of components like databases, without focusing on how many times a method is called.
Substitution Substitution can also be a suitable approach in this context. It involves substituting a real component with another component (or object) that behaves in a desired manner for testing purposes. The substituted component (object) provides the necessary functionality without needing to verify the method call counts.
Question 7
Given the following code:
is the output of line 02?
A.
''x''
B.
''null'''
C.
''object''
D.
''undefined''
Answer:
C
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 8
Which statement parses successfully?
A.
JSON. parse (""foo"');
B.
JSON.parse (""foo'");
D.
JSON.parse ("foo");
Answer:
A
User Votes:
A 1 votes
50%
B 1 votes
50%
D
50%
Discussions
0/ 1000
Question 9
A developer has a formatName function that takes two arguments, firstName and lastName and returns a string. They want to schedule the function to run once after five seconds. What is the correct syntax to schedule this function?
A.
setTimeout (formatName(), 5000, "John", "BDoe");
B.
setTimeout (formatName('John', ‘'Doe'), 5000);
C.
setTimout(() => { formatName("John', 'Doe') }, 5000);
D.
setTimeout ('formatName', 5000, 'John", "Doe');
Answer:
D
User Votes:
A
50%
B
50%
C 1 votes
50%
D
50%
Discussions
0/ 1000
Alka0111
5 months, 3 weeks ago
they are using arrow function for calling the function in settimeout. So correct answer is C
Question 10
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)
D.
Option
Answer:
A
User Votes:
D
50%
Discussions
0/ 1000
Question 11
Which two console logs output NaN? Choose 2 answers | |
A.
console.log(10 / Number('5) ) ;
B.
console.log(parseInt ' ("two')) ;
C.
console.log(10 / 0);
D.
console.loeg(10 / 'five');
Answer:
B, D
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 12
A developer wants to use a module named universalContainersLib and then call functions from it. How should a developer import every function from the module and then call the functions foo and bar?
A.
import * from '/path/universalContainersLib.js'; universalContainersLib. foo ()7 universalContainersLib.bar ();
B.
import {foo,bar} from '/path/universalCcontainersLib.js'; foo(): bar()?
C.
import all from '/path/universalContainersLib.js'; universalContainersLib.foo(); universalContainersLib.bar ();
D.
import * as lib from '/path/universalContainersLib.js'; lib.foo(); lib. bar ();
Answer:
D
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 13
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 replace line 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
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 14
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
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 15
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 navigate event is fired with a state property that details the previous application state.
B.
The page is navigated away from and the previous page in the browser’s history is loaded.
C.
The page reloads and all Javascript is reinitialized.
D.
A popstate event is fired with a state property that details the application’s last state.