This page was exported from Actual Test Materials [ http://blog.actualtests4sure.com ] Export date:Fri Nov 15 20:31:39 2024 / +0000 GMT ___________________________________________________ Title: [2022] JavaScript-Developer-I PDF Questions - Perfect Prospect To Go With Actualtests4sure Practice Exam [Q34-Q54] --------------------------------------------------- [2022] JavaScript-Developer-I PDF Questions - Perfect Prospect To Go With Actualtests4sure Practice Exam Salesforce JavaScript-Developer-I Pdf Questions - Outstanding Practice To your Exam NO.34 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.”?  document.querySelectorAll(‘$main $TONY’).innerHTML = ‘ Mr. T. ‘;  document.querySelector(‘$main li:second-child’).innerHTML = ‘ Mr. T. ‘;  document.querySelector(‘$main li.Tony’).innerHTML = ‘ Mr. T. ‘;  document.querySelector(‘$main li:nth-child(2)’),innerHTML = ‘ Mr. T. ‘; NO.35 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  let res = fizzbuzz(5);console.assert ( res === ‘ ‘ );  let res = fizzbuzz(15);console.assert ( res === ‘ fizzbuzz ‘ )  let res = fizzbuzz(Infinity);console.assert ( res === ‘ ‘ )  let res = fizzbuzz(3);console.assert ( res === ‘ buzz ‘ ) NO.36 A developer publishes a new version of a package with new feature that do not break backward compatibility. The previous version number was 1.1.3.Following semantic versioning format, what should the new package version number be?  2.0.0  1.2.3  1.1.4  1.2.0 NO.37 Which JavaScript method can be used to serialize an object into a string and deserialize a JSON string into an object, respectively?  JSON,serialize and JSON,desrialize  JSON.encode and JSON decode  JSON.parse and JSON deserialize  JSON.Stringify and JSON.parse NO.38 Refer to the code below:new Promise((resolve, reject) => {const fraction = Math.random();if( fraction >0.5) reject(“fraction > 0.5, ” + fraction);resolve(fraction);}).then(() =>console.log(“resolved”)).catch((error) => console.error(error)).finally(() => console.log(” when am I called?”));When does Promise.finally on line 08 get called?  When rejected  When resolved and settled  WHen resolved  When resolved or rejected NO.39 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:There is a new requirement for a developer to implement a description method that will retrun a brief description for item and saleitem.What is the out when executing the code above?  This is a ScarfUnicaught TypeError: saleitem, description is not a functionThis is a ScarfThis is a discounted Shirt  This is a ScarfThis is a ShirtThis is a ScarfThis is a discounted Shirt  This is a ScarfThis is a ShirtThis is a discounted ScardThis is a discounted Shirt  This is a ScafUncaught TypeError: saleItem, description is not a functionThis is a ShirtThis is a discounted Shirt NO.40 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 tocorrectly determine that a button on page is clicked?  Event.clicked  e.nodeTarget ==this  event.target.nodeName == ‘BUTTON’  button.addEventListener(‘click’) NO.41 Refer to the code below:new Promise((resolve, reject) => {const fraction = Math.random();if( fraction >0.5) reject(“fraction > 0.5, ” + fraction);resolve(fraction);}).then(() =>console.log(“resolved”)).catch((error) => console.error(error)).finally(() => console.log(” when am I called?”));When does Promise.finally on line 08 get called?  When rejected  When resolved and settled  WHen resolved  When resolved or rejected NO.42 Refer to the code snippet:A developer writes this code to return a message to a user attempting to register a new username. If the username is available, a variable named msg is declared and assigned a value on line 03.What is the return of msg when getivelibilityMessage (” bewUserName’) is executed and getAvailability (”newUserName”) returns false?  ”Username available”  ”newUsername”  ”msg is not defined”  undefined NO.43 A developer creates a new web server that uses Node.js. It imports a server 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 boot time with an event?A)B)C)D)  Option A  Option B  Option C  Option D NO.44 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.  Use the DOM inspector to prevent the load event to be fired.  Use the browser to execute a script that removes all the element containing the class ad-library-item.  Use the DOM inspector to remove all the elements containing the class ad-library-item.  Use the browser console to execute a script that prevents the load event to be fired. NO.45 Refer to the code below:Let searchString = ‘ Look for this ‘;Which two options remove the whitespace from the beginning of searchString? Choose 2 answers  searchString. trimEnd ( ) ;  searchString. trimstart ( ) ;  trimStart (searchString) ;  searchString. Replace (/^aa’/’ ‘ ‘) ; NO.46 Refer to the code below:What is the output after the code executes?  ReferenceError: eyeColor is not defined  ReferenceError: assignment to undeclared variable ”Person”  Developer  undefined NO.47 A developer is asked to fix some bugs reported by users. To do that, the developer addsa 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 areavailable in the browser console ?Choose 2 answers:  The values of the carSpeed and fourWheels variables  A variable displaying the number of instances created for the Car Object.  The style, event listeners and other attributes applied to the carSpeed DOM element  The information stored in the window.localStorage property NO.48 A developer needs to test this functions:Which two assert statements are valid tests for this function?  Console.assert(sum3((1, ‘2’ ]) 12 );  Console.assert(sum3([0]) 0) ;  Console.assert(sum3 ([-3, 2]) -1) ;  Console.assert(sum3 ([‘hello’ 2, 3, 4]) NaN); NO.49 Universal Containers recently launched its new landing page to host a crowd-fundingcampaign. The page uses an external library to display some third-party ads. Once the page isfully loaded, it creates more than 50 new HTML items placed randomly inside the DOM, like theone 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.  Use the DOM inspector to prevent the load event to be fired.  Use the browser to execute a script that removes all the element containing the class ad-library-item.  Use the DOM inspector to remove all the elements containing the class ad-library-item.  Use the browser console to execute a script that prevents the load event to be fired. NO.50 Refer to the code below:Which code change should be made for the console to log only Row log when ‘Click mel’ is clicking?  Add event,stopPropagation (); to window,onLoad event hadler.  Add event,stopPropagation (); to printMessage function.  Add event,stopPropagation (); to window.onLoad event hadler.  Add event,stopPropagation (); to printMessage function. NO.51 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?  01 let monthName =’July’;  02 let year =2019;  02 const year = 2020;  03 if (year == 2019) { NO.52 Refer to the code below:<html lang=”en”><table onclick=”console.log(Table log’);”><tr id=”row1″><td>Click me!</td></tr><table><script>function printMessage(event) {console.log(‘Row log’);}Let elem = document.getElementById(‘row1’);elem.addEventListener(‘click’, printMessage, false);</script></html>Which code change should be made for the console to log only Row log when ‘Click me! ‘ is clicked?  Add.event.stopPropagation(); to window.onLoad event handler.  Add event.stopPropagation(); to printMessage function.  Add event.removeEventListener(); to window.onLoad event handler.  Add event.removeEventListener(); toprintMessage function. NO.53 A developer is asked to fix some bugs reported by users. To do that, the developer adds a breakpoint for debugging.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  The value of the carSpeed and fourWheel variables  A variable’s displaying the number of instances created for the Car object.  The style, event listeners and other attributes applied to the carSpeed DOM element.  The information stored in the window.localStorage property. NO.54 A developer is setting up a new Node.js server with a client library that is built using events and callbacks.The library:* Will establish a web socket connection and handle receipt of messages to the server* Will be imported with require, and made available with a variable called ws.The developer also wants to add error logging if a connection fails.Given this information, which code segment show the correct way to set up a client two events that listen at execution time?A)B)C)D)  Option A  Option B  Option C  Option D  Loading … Online Questions - Outstanding Practice To your JavaScript-Developer-I Exam: https://www.actualtests4sure.com/JavaScript-Developer-I-test-questions.html --------------------------------------------------- Images: https://blog.actualtests4sure.com/wp-content/plugins/watu/loading.gif https://blog.actualtests4sure.com/wp-content/plugins/watu/loading.gif --------------------------------------------------- --------------------------------------------------- Post date: 2022-04-02 18:48:12 Post date GMT: 2022-04-02 18:48:12 Post modified date: 2022-04-02 18:48:12 Post modified date GMT: 2022-04-02 18:48:12