Salesforce Prepare for your JavaScript Developer I Certification CRT-600 Exam Questions

Page: 1 / 14
Total 224 questions
Question 1

Refer to the code below:

What is the output of this function when called with an empty array?



Answer : B


Question 2

developer uses the code below to format a date.

After executing, what is the value of formattedDate?



Answer : B


Question 3

At Universal Containers, every team has its own way of copying JavaScript objects. The

code

Snippet shows an implementation from one team:

Function Person() {

this.firstName = ''John'';

this.lastName = 'Doe';

This.name =() => (

console.log('Hello $(this.firstName) $(this.firstName)');

)}

Const john = new Person ();

Const dan = JSON.parse(JSON.stringify(john));

dan.firstName ='Dan';

dan.name();

What is the Output of the code execution?



Answer : C


Question 4

A developer is debugging a web server that uses Node.js The server hits a runtimeerror

every third request to an important endpoint on the web server.

The developer added a break point to the start script, that is at index.js at he root of the

server's source code. The developer wants to make use of chrome DevTools to debug.

Which command can be run to access DevTools and make sure the breakdown is hit ?



Answer : D


Question 5

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



Answer : B


Question 6

Refer to the code snippet below:

Let array = [1, 2, 3, 4, 4, 5, 4, 4];

For (let i =0; i < array.length; i++){

if (array[i] === 4) {

array.splice(i, 1);

}

}

What is the value of the array after the code executes?



Answer : C


Question 7

The developer wants to test this code:

Const toNumber =(strOrNum) => strOrNum;

Which two tests are most accurate for this code?

Choose 2 answers



Answer : A, C


Question 8

Refer to the following code that imports a module named utils:

import (foo, bar) from '/path/Utils.js';

foo() ;

bar() ;

Which two implementations of Utils.js export foo and bar such that the code above runs without

error?

Choose 2 answers



Answer : B, C


Question 9

Which javascript methods can be used to serialize an object into a string and deserialize

a JSON string into an object, respectively?



Answer : A


Question 10

Consider type coercion, what does the following expression evaluate to?

True + 3 + '100' + null



Answer : D


Question 11

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?



Answer : B


Question 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?



Answer : B


Question 13

Refer to the code below:

const event = new CustomEvent(

//Missing Code

);

obj.dispatchEvent(event);

A developer needs to dispatch a custom event called update to send information about

recordId.

Which two options could a developer insert at the placeholder in line 02 to achieve this?

Choose 2 answers



Answer : A, D


Question 14

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)



Answer : A


Question 15

Refer to the code below:

let timeFunction =() => {

console.log('Timer called.'');

};

let timerId = setTimeout (timedFunction, 1000);

Which statement allows a developer to cancel the scheduled timed function?



Answer : C


Question 16

A developer wants to leverage a module to print a price in pretty format, and has imported a method as shown below:

Import printPrice from '/path/PricePrettyPrint.js';

Based on the code, what must be true about the printPrice function of the PricePrettyPrint module for this import to work ?



Answer : C


Question 17

Refer to the code below:

Considering that JavaScript is single-threaded, what is the output of line 08 after the code executes?



Answer : B


Question 18

Refer to the code below:

let sayHello = () => {

console.log ('Hello, world!');

};

Which code executes sayHello once, two minutes from now?



Answer : A


Question 19

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.



Answer : C


Question 20

Refer to the following code:

What is the output of line 11?



Answer : D


Question 21

Given the code below:

const copy = JSON.stringify([ new String(' false '), new Bollean( false ), undefined ]);

What is the value of copy?



Answer : D


Question 22

Which option is a core Node,js module?



Answer : A


Question 23

Consider type coercion, what does the following expression evaluate to?

True + 3 + '100' + null



Answer : D


Question 24

A developer has the following array of student test grades:

Let arr = [ 7, 8, 5, 8, 9 ];

The Teacher wants to double each score and then see an array of the students

who scored more than 15 points.

How should the developer implement the request?



Answer : C


Question 25

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?



Answer : B


Question 26

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?



Answer : A


Question 27

Given the code below:

What is logged to the console'



Answer : D


Question 28

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



Answer : A, C


Question 29

developer removes the HTML class attribute from the checkout button, so now it is

simply:

.

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?



Answer : D


Question 30

Refer to the code below:

Async funct on functionUnderTest(isOK) {

If (isOK) return 'OK' ;

Throw new Error('not OK');

)

Which assertion accurately tests the above code?



Answer : D


Question 31

Refer to the code below:

Let foodMenu1 = ['pizza', 'burger', 'French fries'];

Let finalMenu = foodMenu1;

finalMenu.push('Garlic bread');

What is the value of foodMenu1 after the code executes?



Answer : B


Question 32

Refer to code below:

Function muFunction(reassign){

Let x = 1;

var y = 1;

if( reassign ) {

Let x= 2;

Var y = 2;

console.log(x);

console.log(y);}

console.log(x);

console.log(y);}

What is displayed when myFunction(true) is called?



Answer : C


Question 33

Refer to the code:

Given the code above, which three properties are set pet1?

Choose 3 answers:



Answer : B, C, E


Question 34

Refer to code below:

Let a ='a';

Let b;

// b = a;

console.log(b);

What is displayed when the code executes?



Answer : C


Question 35

Which three browser specific APIs are available for developers to persist data between page loads ?

Choose 3 answers



Answer : A, B, E


Question 36

Refer to the code snippet below:

Let array = [1, 2, 3, 4, 4, 5, 4, 4];

For (let i =0; i < array.length; i++){

if (array[i] === 4) {

array.splice(i, 1);

}

}

What is the value of the array after the code executes?



Answer : C


Question 37

Refer to the following code that performs a basic mathematical operation on a provided

input:

function calculate(num) {

Return (num +10) / 3;

}

How should line 02 be written to ensure that x evaluates to 6 in the line below?

Let x = calculate (8);



Answer : B


Question 38

Refer to code below:

Const objBook = {

Title: 'Javascript',

};

Object.preventExtensions(objBook);

Const newObjBook = objBook;

newObjectBook.author = 'Robert';

What are the values of objBook and newObjBook respectively ?



Answer : A


Question 39

Refer to the code below:

What is the value of result after line 10 executes?



Answer : B


Question 40

Given the requirement to refactor the code above to JavaScript class format, which class

definition is correct?

A)

B)

C)

D)



Answer : A


Question 41

A developer has an ErrorHandler module that contains multiple functions.

What kind of export should be leveraged so that multiple functions can be used?



Answer : B


Question 42

A developer needs to debug a Node.js web server because a runtime error keeps occurring at one of the endpoints.

The developer wants to test the endpoint on a local machine and make the request against a local server to look at the behavior. In the source code, the server, js file will start the server. the developer wants to debug the Node.js server only using the terminal.

Which command can the developer use to open the CLI debugger in their current terminal window?



Answer : B


Question 43

Which statement phrases successfully?



Answer : D


Question 44

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?



Answer : D


Question 45

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?



Answer : D


Question 46

Refer to the code below:

Function changeValue(obj) {

Obj.value = obj.value/2;

}

Const objA = (value: 10);

Const objB = objA;

changeValue(objB);

Const result = objA.value;

What is the value of result after the code executes?



Answer : C


Question 47

Refer to the following code:

Let sampleText = 'The quick brown fox jumps';

A developer needs to determine if a certain substring is part of a string.

Which three expressions return true for the given substring ?

Choose 3 answers



Answer : B, D, E


Question 48

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



Answer : A


Question 49

Which statement can a developer apply to increment the browser's navigation history without a page refresh?

Which statement can a developer apply to increment the browser's navigation history without a page refresh?



Answer : C


Question 50

A developer creates a class that represents a blog post based on the requirement that a

Post should have a body author and view count.

The Code shown Below:

Class Post {

// Insert code here

This.body =body

This.author = author;

this.viewCount = viewCount;

}

}

Which statement should be inserted in the placeholder on line 02 to allow for a variable to be set

to a new instanceof a Post with the three attributes correctly populated?



Answer : C


Question 51

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



Answer : B, D


Question 52

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?



Answer : A


Question 53

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?



Answer : A


Question 54

Refer to the code below:

Let textValue = '1984';

Which code assignment shows a correct way to convert this string to an integer?



Answer : A


Question 55

Considering the implications of 'use strict' on line 04, which three statements describe the execution of the code?

Choose 3 answers



Answer : A, C, E


Question 56

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 are used to address this ?

Choose 2 answers



Answer : B


Question 57

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?



Answer : A


Question 58

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



Answer : B


Question 59

Refer to the following code:

Which two statement could be inserted at line 17 to enable the function call on line 18?

Choose 2 answers



Answer : A, C


Question 60

A developer wants to leverage a module to print a price in pretty format, and has imported a method as shown below:

Import printPrice from '/path/PricePrettyPrint.js';

Based on the code, what must be true about the printPrice function of the PricePrettyPrint module for this import to work ?



Answer : C


Question 61

Refer to HTML below:

The current status of an Order: In Progress

.

Which JavaScript statement changes the text 'In Progress' to 'Completed' ?



Answer : C


Question 62

Refer to following code:

class Vehicle {

constructor(plate) {

This.plate =plate;

}

}

Class Truck extends Vehicle {

constructor(plate, weight) {

//Missing code

This.weight = weight;

}

displayWeight() {

console.log('The truck ${this.plate} has a weight of ${this.weight} lb.');}}

Let myTruck = new Truck('123AB', 5000);

myTruck.displayWeight();

Which statement should be added to line 09 for the code to display 'The truck 123AB has a

weight of 5000lb.'?



Answer : B


Question 63

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

The developer also wants to add error logging if a connection fails.

Given this info, which code segment shows the correct way to set up a client with two events that listen at execution time?



Answer : C


Question 64

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 ?



Answer : B


Question 65

A developer is setting up a Node,js server and is creating a script at the root of the source code, index,js, that will start the server when executed. The developer declares a variable that needs the folder location that the code executes from.

Which global variable can be used in the script?



Answer : B


Question 66

Refer to code below:

Const objBook = {

Title: 'Javascript',

};

Object.preventExtensions(objBook);

Const newObjBook = objBook;

newObjectBook.author = 'Robert';

What are the values of objBook and newObjBook respectively ?



Answer : A


Question 67

A developer creates a generic function to log custom messages in the console. To do this,

the function below is implemented.

01 function logStatus(status){

02 console./*Answer goes here*/{'Item status is: %s', status};

03 }

Which three console logging methods allow the use of string substitution in line 02?



Answer : B, D, E


Question 68

Refer to the following object:

const cat ={

firstName: 'Fancy',

lastName: ' Whiskers',

Get fullName() {

return this.firstName + ' ' + this.lastName;

}

};

How can a developer access the fullName property for cat?



Answer : A


Question 69

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?



Answer : D


Question 70

A developer has the following array of hourly wages:

Let arr = (8, 5, 9, 75, 11, 25, 7, 75, , 13, 25);

For workers making less than $10 an hour rate should be multiple by 1.25 and returned in a new array.

How should the developer implement the request?



Answer : C


Question 71

A developer needs to debug a Node.js web server because a runtime error keeps occurring at one of the endpoints.

The developer wants to test the endpoint on a local machine and make the request against a local server to look at the behavior. In the source code, the server, js file will start the server. the developer wants to debug the Node.js server only using the terminal.

Which command can the developer use to open the CLI debugger in their current terminal window?



Answer : B


Question 72

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?



Answer : D


Question 73

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?



Answer : B, C


Question 74

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?



Answer : A


Question 75

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?



Answer : A, B


Question 76

Refer to the code below:

Let str = 'javascript';

Str[0] = 'J';

Str[4] = 'S';

After changing the string index values, the value of str is 'javascript'. What is the reason

for this value:



Answer : D


Question 77

Refer to code below:

Let productSKU = '8675309' ;

A developer has a requirement to generate SKU numbers that are always 19 characters lon,

starting with 'sku', and padded with zeros.

Which statement assigns the values sku0000000008675309 ?



Answer : D


Question 78

Given the following code:

What will be the first four numbers logged?



Answer : B


Question 79

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?



Answer : D


Question 80

Which option is true about the strict mode in imported modules?



Answer : B


Question 81

A developer has the function, shown below, that is called when a page loads.

function onload() {

console.log(''Page has loaded!'');

}

Where can the developer see the log statement after loading the page in the browser?



Answer : C


Question 82

Refer to the code snippet below:

Let array = [1, 2, 3, 4, 4, 5, 4, 4];

For (let i =0; i < array.length; i++){

if (array[i] === 4) {

array.splice(i, 1);

}

}

What is the value of the array after the code executes?



Answer : C


Question 83

Which statement phrases successfully?



Answer : D


Question 84

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?



Answer : A


Question 85

A developer initiates a server with the file server,js and adds dependencies in the source codes package,json that are required to run the server.

Which command should the developer run to start the server locally?



Answer : C


Question 86

Given the code below:

Function myFunction(){

A =5;

Var b =1;

}

myFunction();

console.log(a);

console.log(b);

What is the expected output?



Answer : B


Question 87

developer publishes a new version of a package with new features 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?



Answer : D


Question 88

Refer to the following code:

Which two statement could be inserted at line 17 to enable the function call on line 18?

Choose 2 answers



Answer : A, C


Question 89

A developer creates a simple webpage with an input field. When a user enters text in the input field and clicks the button, the actual value of the field must be displayed in the console.

Here is the HTML file content:

The developer wrote the javascript code below:

Const button = document.querySelector('button');

button.addEvenListener('click', () => (

Const input = document.querySelector('input');

console.log(input.getAttribute('value'));

When the user clicks the button, the output is always ''Hello''.

What needs to be done to make this code work as expected?



Answer : A


Question 90

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?



Answer : B


Question 91

A developer is leading the creation of a new web server for their team that will fulfill API requests from an existing client.

The team wants a web server that runs on Node.Js, and they want to use the new web framework Minimalist.Js. The lead developer wants to advocate for a more seasoned back-end framework that already has a community around it.

Which two frameworks could the lead developer advocate for?

Choose 2 answers



Answer : B, C


Question 92

A developer wants to iterate through an array of objects and count the objects and count

the objects whose property value, name, starts with the letter N.

Const arrObj = [{''name'' : ''Zach''} , {''name'' : ''Kate''},{''name'' : ''Alise''},{''name'' : ''Bob''},{''name'' :

''Natham''},{''name'' : ''nathaniel''}

Refer to the code snippet below:

01 arrObj.reduce(( acc, curr) => {

02 //missing line 02

02 //missing line 03

04 ). 0);

Which missing lines 02 and 03 return the correct count?



Answer : B


Question 93

The developer wants to test this code:

Const toNumber =(strOrNum) => strOrNum;

Which two tests are most accurate for this code?

Choose 2 answers



Answer : A, C


Question 94

A developer implements a function that adds a few values.

Function sum(num) {

If (num == undefined) {

Num =0;

}

Return function( num2, num3){

If (num3 === undefined) {

Num3 =0 ;

}

Return num + num2 + num3;

}

}

Which three options can the developer invoke for this function to get a return value of 10 ?

Choose 3 answers



Answer : C, D


Question 95

Refer to the following code:

What is the value of output on line 11?



Answer : D


Question 96

Given the code below:

01 function GameConsole (name) {

02 this.name = name;

03 }

04

05 GameConsole.prototype.load = function(gamename) {

06 console.log( ` $(this.name) is loading a game : $(gamename) ...`);

07 )

08 function Console 16 Bit (name) {

09 GameConsole.call(this, name) ;

10 }

11 Console16bit.prototype = Object.create ( GameConsole.prototype) ;

12 //insert code here

13 console.log( ` $(this.name) is loading a cartridge game : $(gamename) ...`);

14 }

15 const console16bit = new Console16bit(' SNEGeneziz ');

16 console16bit.load(' Super Nonic 3x Force ');

What should a developer insert at line 15 to output the following message using the

method ?

> SNEGeneziz is loading a cartridge game: Super Monic 3x Force . . .



Answer : B


Question 97

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



Answer : C, D


Question 98

A developer wants to leverage a module to print a price in pretty format, and has imported a method as shown below:

Import printPrice from '/path/PricePrettyPrint.js';

Based on the code, what must be true about the printPrice function of the PricePrettyPrint module for this import to work ?



Answer : C


Question 99

Which code change should be done for the console to log the following when 'Click me!' is clicked'

> Row log

> Table log



Answer : B


Question 100

Given the code below:

const copy = JSON.stringify([ new String(' false '), new Bollean( false ), undefined ]);

What is the value of copy?



Answer : D


Question 101

Refer to the code below:

Let inArray =[ [ 1, 2 ] , [ 3, 4, 5 ] ];

Which two statements result in the array [1, 2, 3, 4, 5] ?

Choose 2 answers



Answer : A, B


Question 102

Which code statement correctly retrieves and returns an object from localStorage?



Answer : C


Question 103

A developer initiates a server with the file server,js and adds dependencies in the source codes package,json that are required to run the server.

Which command should the developer run to start the server locally?



Answer : C


Question 104

Refer to the code below:

Let str = 'javascript';

Str[0] = 'J';

Str[4] = 'S';

After changing the string index values, the value of str is 'javascript'. What is the reason

for this value:



Answer : D


Question 105

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?



Answer : A


Question 106

Refer to the code below?

Let searchString = ' look for this ';

Which two options remove the whitespace from the beginning of searchString?

Choose 2 answers



Answer : B, D


Question 107

A developer implements a function that adds a few values.

Function sum(num) {

If (num == undefined) {

Num =0;

}

Return function( num2, num3){

If (num3 === undefined) {

Num3 =0 ;

}

Return num + num2 + num3;

}

}

Which three options can the developer invoke for this function to get a return value of 10 ?

Choose 3 answers



Answer : C, D


Question 108

Refer to the following array:

Let arr = [ 1,2, 3, 4, 5];

Which three options result in x evaluating as [3, 4, 5] ?

Choose 3 answers.



Answer : B, C, D


Question 109

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



Answer : A, D


Question 110

Which code change should be done for the console to log the following when 'Click me!' is clicked'

> Row log

> Table log



Answer : B


Question 111

Given the following code:

Let x =null;

console.log(typeof x);

What is the output of the line 02?



Answer : C


Question 112

Refer to code below:

Let first = 'who';

Let second = 'what';

Try{

Try{

Throw new error('Sad trombone');

}catch (err){

First ='Why';

}finally {

Second ='when';

} catch (err) {

Second ='Where';

}

What are the values for first and second once the code executes ?



Answer : D


Question 113

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



Answer : B


Question 114

Which statement can a developer apply to increment the browser's navigation history without a page refresh?

Which statement can a developer apply to increment the browser's navigation history without a page refresh?



Answer : C


Question 115

Refer to following code:

class Vehicle {

constructor(plate) {

This.plate =plate;

}

}

Class Truck extends Vehicle {

constructor(plate, weight) {

//Missing code

This.weight = weight;

}

displayWeight() {

console.log('The truck ${this.plate} has a weight of ${this.weight} lb.');}}

Let myTruck = new Truck('123AB', 5000);

myTruck.displayWeight();

Which statement should be added to line 09 for the code to display 'The truck 123AB has a

weight of 5000lb.'?



Answer : B


Question 116

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.



Answer : C


Question 117

Given the following code:

Let x =null;

console.log(typeof x);

What is the output of the line 02?



Answer : C


Question 118

Refer to the code below:

let sayHello = () => {

console.log ('Hello, world!');

};

Which code executes sayHello once, two minutes from now?



Answer : A


Question 119

Refer to the code below:

function foo () {

const a =2;

function bat() {

console.log(a);

}

return bar;

}

Why does the function bar have access to variable a ?



Answer : C


Question 120

In which situation should a developer include a try .. catch block around their function call ?



Answer : C


Question 121

Refer to the following code that imports a module named utils:

import (foo, bar) from '/path/Utils.js';

foo() ;

bar() ;

Which two implementations of Utils.js export foo and bar such that the code above runs without

error?

Choose 2 answers



Answer : B, C


Question 122

Refer to the HTML below:

  • Leo
  • Tony
  • Tiger

Which JavaScript statement results in changing '' Tony'' to ''Mr. T.''?



Answer : D


Question 123

Given the code below:

01 function GameConsole (name) {

02 this.name = name;

03 }

04

05 GameConsole.prototype.load = function(gamename) {

06 console.log( ` $(this.name) is loading a game : $(gamename) ...`);

07 )

08 function Console 16 Bit (name) {

09 GameConsole.call(this, name) ;

10 }

11 Console16bit.prototype = Object.create ( GameConsole.prototype) ;

12 //insert code here

13 console.log( ` $(this.name) is loading a cartridge game : $(gamename) ...`);

14 }

15 const console16bit = new Console16bit(' SNEGeneziz ');

16 console16bit.load(' Super Nonic 3x Force ');

What should a developer insert at line 15 to output the following message using the

method ?

> SNEGeneziz is loading a cartridge game: Super Monic 3x Force . . .



Answer : B


Question 124

Given the code below:

Which three code segments result in a correct conversion from number to string? Choose 3 answers



Answer : A, B, D


Question 125

Refer to the following object.

How can a developer access the fullName property for dog?



Answer : A


Question 126

Given HTML below:

Universal Container

Applied Shipping

Burlington Textiles

Which statement adds the priority = account CSS class to the universal Containers row ?



Answer : B


Question 127

Refer to the code below:

What is the value of result when the code executes?



Answer : A


Question 128

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?



Answer : A


Question 129

Which statement can a developer apply to increment the browser's navigation history without a page refresh?

Which statement can a developer apply to increment the browser's navigation history without a page refresh?



Answer : C


Question 130

developer uses the code below to format a date.

After executing, what is the value of formattedDate?



Answer : B


Question 131

Which code change should be done for the console to log the following when 'Click me!' is clicked'

> Row log

> Table log



Answer : B


Question 132

Refer of the string below:

Const str = 'sa;esforce'=;

Which two statement result in the word 'Sale'?

Choose 2 answers



Answer : A, B


Question 133

Which two console logs output NaN?

Choose 2 answers | |



Answer : A, B


Question 134

Refer to the code below:

Line 05 causes an error.

What are the values of greeting and salutation once code completes?



Answer : A


Question 135

Refer to the following code:

What will the console show when the button is clicked?



Answer : D


Question 136

A developer has the function, shown below, that is called when a page loads.

function onload() {

console.log(''Page has loaded!'');

}

Where can the developer see the log statement after loading the page in the browser?



Answer : C


Question 137

Refer to the code below:

let sayHello = () => {

console.log ('Hello, world!');

};

Which code executes sayHello once, two minutes from now?



Answer : A


Question 138

Given the code below:

Function myFunction(){

A =5;

Var b =1;

}

myFunction();

console.log(a);

console.log(b);

What is the expected output?



Answer : B


Question 139

Universal Containers (UC) notices that its application that allows users to search for

accounts makes a network request each time a key is pressed. This results in too many

requests for the server to handle.

Address this problem, UC decides to implement a debounce function on string change

handler.

What are three key steps to implement this debounce function?

Choose 3 answers:



Answer : A, B, C


Question 140

Which code statement correctly retrieves and returns an object from localStorage?



Answer : C


Question 141

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?



Answer : D


Question 142

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?



Answer : D


Question 143

Refer to the code below:

console.log(''start);

Promise.resolve('Success') .then(function(value){

console.log('Success');

});

console.log('End');

What is the output after the code executes successfully?



Answer : C


Question 144

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?



Answer : A, B


Question 145

Refer to the code below:

Let str = 'javascript';

Str[0] = 'J';

Str[4] = 'S';

After changing the string index values, the value of str is 'javascript'. What is the reason

for this value:



Answer : D


Question 146

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?



Answer : D


Question 147

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



Answer : A, D


Question 148

Given the following code:

is the output of line 02?



Answer : C


Question 149

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

The developer also wants to add error logging if a connection fails.

Given this info, which code segment shows the correct way to set up a client with two events that listen at execution time?



Answer : C


Question 150

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?



Answer : A


Question 151

Refer to following code block:

Let array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,];

Let output =0;

For (let num of array){

if (output >0){

Break;

}

if(num % 2 == 0){

Continue;

}

Output +=num;

What is the value of output after the code executes?



Answer : A


Question 152

A developer creates a generic function to log custom messages in the console. To do this,

the function below is implemented.

01 function logStatus(status){

02 console./*Answer goes here*/{'Item status is: %s', status};

03 }

Which three console logging methods allow the use of string substitution in line 02?



Answer : B, D, E


Question 153

A developer is leading the creation of a new web server for their team that will fulfill API requests from an existing client.

The team wants a web server that runs on Node.Js, and they want to use the new web framework Minimalist.Js. The lead developer wants to advocate for a more seasoned back-end framework that already has a community around it.

Which two frameworks could the lead developer advocate for?

Choose 2 answers



Answer : B, C


Question 154

Refer to the following code:

function test (val) {

If (val === undefined) {

return 'Undefined values!' ;

}

if (val === null) {

return 'Null value! ';

}

return val;

}

Let x;

test(x);

What is returned by the function call on line 13?



Answer : C


Question 155

Which two code snippets show working examples of a recursive function?

Choose 2 answers



Answer : A, D


Question 156

Given the following code:

Let x =('15' + 10)*2;

What is the value of a?



Answer : A


Question 157

In which situation should a developer include a try .. catch block around their function call ?



Answer : C


Question 158

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 ?



Answer : A


Question 159

Refer to the code below:

console.log(''start);

Promise.resolve('Success') .then(function(value){

console.log('Success');

});

console.log('End');

What is the output after the code executes successfully?



Answer : C


Question 160

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



Answer : A


Question 161

Considering type coercion, what does the following expression evaluate to?

True + '13' + NaN



Answer : D


Question 162

Refer to the following array:

Let arr = [1, 2, 3, 4, 5];

Which three options result in x evaluating as [1, 2]?

Choose 3 answer



Answer : B, C, E


Question 163

Which option is true about the strict mode in imported modules?



Answer : B


Question 164

A developer at Universal Containers is creating their new landing page based on HTML, CSS, and JavaScript. The website includes multiple external resources that are loaded when the page is opened.

To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to be executed when the webpage Is loaded and there Is no need to wait for the resources to be available.

Which statement should be used to call personalizeWebsiteContent based on the above business requirement?



Answer : A


Question 165

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?



Answer : D


Question 166

Which three statements are true about promises ?

Choose 3 answers



Answer : B, C, E


Question 167

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



Answer : A, D


Question 168

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



Answer : A, D


Question 169

Refer to the code below:

function foo () {

const a =2;

function bat() {

console.log(a);

}

return bar;

}

Why does the function bar have access to variable a ?



Answer : C


Question 170

A developer is setting up a Node,js server and is creating a script at the root of the source code, index,js, that will start the server when executed. The developer declares a variable that needs the folder location that the code executes from.

Which global variable can be used in the script?



Answer : B


Question 171

Refer to code below:

Function muFunction(reassign){

Let x = 1;

var y = 1;

if( reassign ) {

Let x= 2;

Var y = 2;

console.log(x);

console.log(y);}

console.log(x);

console.log(y);}

What is displayed when myFunction(true) is called?



Answer : C


Question 172

Refer to the code below:

Which value can a developer expect when referencing country,capital,cityString?



Answer : D


Question 173

Refer to the code below:

What is the value of result after line 10 executes?



Answer : B


Question 174

Which two options are core Node.js modules?

Choose 2 answers



Answer : B, D


Question 175

A developer copied a JavaScript object:

How does the developer access dan's forstName,lastName? Choose 2 answers



Answer : C, D


Question 176

Refer to code below:

Const objBook = {

Title: 'Javascript',

};

Object.preventExtensions(objBook);

Const newObjBook = objBook;

newObjectBook.author = 'Robert';

What are the values of objBook and newObjBook respectively ?



Answer : A


Question 177

Refer to the code below:

console.log(''start);

Promise.resolve('Success') .then(function(value){

console.log('Success');

});

console.log('End');

What is the output after the code executes successfully?



Answer : C


Question 178

Refer to the code:

Given the code above, which three properties are set pet1?

Choose 3 answers:



Answer : B, C, E


Question 179

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?



Answer : C


Question 180

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

let x = '15' + (10 * 2);



Answer : C


Question 181

Refer to the code below:

function foo () {

const a =2;

function bat() {

console.log(a);

}

return bar;

}

Why does the function bar have access to variable a ?



Answer : C


Question 182

Refer to the code below:

Async funct on functionUnderTest(isOK) {

If (isOK) return 'OK' ;

Throw new Error('not OK');

)

Which assertion accurately tests the above code?



Answer : D


Question 183

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?



Answer : A


Question 184

Given the following code:

is the output of line 02?



Answer : C


Question 185

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?



Answer : D


Page:    1 / 14   
Total 224 questions