Q: 11
Which two console logs outputs NaN ?
Choose 2 answers
Options
Discussion
D tbh, I picked D and B based on similar practice sets from the official guide.
B. C. Only those will actually log NaN, pretty sure. If you disagree let me know.
Be respectful. No spam.
Q: 12
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:
1. Does require an import
2. Logs an error when the boolean statement evaluates to false
3. Works in both the browser and Node.js
Which meet the requirements?
Options
Discussion
Makes sense to go with D here.
console.assert is built in, works on both environments, and only logs when the condition fails, which matches what they're asking. That import requirement seems odd though. Anyone disagree?Option D
Had something like this in a mock exam, went with B.
D . People might pick A thinking assert needs import, but console.assert fits requirements for logging errors and cross-environment use.
Be respectful. No spam.
Q: 13
A developer is working on an ecommerce website where the delivery date is dynamically
calculated based on the current day. The code line below is responsible for this calculation.
Const deliveryDate = new Date ();
Due to changes in the business requirements, the delivery date must now be today’s
date + 9 days.
Which code meets this new requirement?
Options
Discussion
Probably A, seen similar in practice tests and it matches how setDate works for adding days. Handy example, question is clear.
Be respectful. No spam.
Q: 14
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?
Options
Discussion
D or C? I usually go with http for a basic server, so D felt right but not sure if that's secure out of the box. Maybe C for TLS if it’s about security. Someone clarify if I'm missing something.
D imo
Be respectful. No spam.
Q: 15
developer wants to use a module named universalContainersLib and them call functions
from it.
How should a developer import every function from the module and then call the fuctions foo
and bar ?
Options
Discussion
A works despite the typo. The use of
import * as lib is the ES6 way to import everything, then calling lib.foo() and lib.bar() fits. Pretty sure that's what they're after, even though “ad” should be “as”.C or D? Both seem off, but A has that 'ad' typo. Not sure which one the exam wants here.
A tbh
Nice, this one is worded really clearly. A matches what I've seen on other practice sets.
Be respectful. No spam.
Q: 16
Refer the code below.
x=3.14;
function myfunction() {
"use strict";
y=x;
}
z=x;
myFunction();
Your Answer
Discussion
REFERENCEERROR
Really clear code snippet for testing case sensitivity in JS.
Anyone else seen similar case-sensitive function name questions on their exam? Looks like ReferenceError would be triggered here due to the naming mismatch.
REFERENCEERROR
Pretty common mistake in JS exams. Since the function name is called with a capital F but defined lowercase, you get a ReferenceError. Official docs and sample practice tests show similar examples.
Oops, I thought it would be a TypeError because of the strict mode assignment. But actually the function call's case is wrong, so ReferenceError comes first. Did anyone else miss that detail at first?
Be respectful. No spam.
Q: 17
Refer to the string below.
Const str=’Salesforce’;
Which two statements results in the word 'Sales'?
Your Answer
Discussion
slice(0,5) or substring(0,5) both work. Official JS docs and hands-on coding labs cover this type of string method question a lot.
Yep, both str.slice(0,5) and str.substring(0,5) pull out 'Sales'.
Nah, using substr(0,5) would work but it's kind of outdated compared to slice(0,5) or substring(0,5). This question wants the modern two methods, not substr which is a common trap.
Makes sense, but I remember using substr(0,5) too. Is that still valid here?
Be respectful. No spam.
Q: 18
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?
Options
Discussion
Yeah, it’s B here.
B, not A
Saw something like this in practice questions, it's B.
Be respectful. No spam.
Q: 19
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?
Which two lines of code result in a second array, arr2 being created such that arr2 is not
a reference to arr1?Options
Discussion
A and B for sure. Had something like this in a mock before, slice() and Array.from() both return new arrays so arr2 isn't just referencing arr1. C's just a pointer copy, and D actually mutates arr1 itself. Pretty confident but open to correction.
B tbh. A looks like a decoy here since I thought slice could still reference parts of the original if not careful.
My pick: option D works too since sort() creates a new array, right? I know C just points to the same reference, but isn’t D making a separate one? Let me know if I’m missing something about how sort() behaves.
A and B imo. Both slice(0,5) and Array.from(arr1) give you a new array, not just a reference. C just copies the reference and D mutates the original. If I'm off let me know.
Not C, A and B. Not 100% sure because I get confused with how slice works, can someone confirm?
Be respectful. No spam.
Q: 20
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
Options
Discussion
Option A and D. Clearing the cache makes sense, and checking refresh settings might help if the page isn't updating right away.
A, D
Its B and D, not A-refresh settings alone won’t fix caching like disabling or clearing cache will.
Be respectful. No spam.
Question 11 of 20 · Page 2 / 2