+1 (208) 254-6996 [email protected]

1) Which variable declaration format is correct?

a. favBand let = “Linkin Park”;

Don't use plagiarized sources. Get Your Custom Essay on
Java Programming
Just from $13/Page
Order Essay

b. let favBand = “Linkin Park”;

c. let favBand: “Linkin Park”;

d. favBand let: “Linkin Park”;

2) Which declaration is a constant for minimum wage?

a. let MIN_WAGE;

b. var MIN_WAGE = 10;

c. const MIN_WAGE = 10;

d. const MIN_WAGE;

3) What is rainbow’s data type?

let rainbow = [“red”, “orange”, “green”, “purple”];

a. Array

b. Boolean

c. String

d. Object

4) x = 4 ** 4is the same as _____.

a. x = 44

b. x = 4 * 4

c. x = 4 + 4 + 4 + 4

d. x = 4 * 4 * 4 * 4

5) Which compound assignment operator assigns numbers with 9?

let numbers = 3; numbers _____ 3;

a. +=

b. -=

c. *=

d. /=

6) In JavaScript,5 + “5”evaluates to a _____.

a. string

b. number

c. error

d. object

7) IfparseInt()cannot return a number, _____ is returned.

a. 0

b. isNaN()

c. Error

d. NaN

8) Which if-else statement correctly conveys the following information?

If age is at least 16, “You can learn to drive.” is output.

a. if (age >= 16) { console.log(“You can learn to drive.”); } else { console.log(“You need to wait a little longer.”); }

b. if (age > 16 = true) { console.log(“You can learn to drive.”); } else { console.log(“You need to wait a little longer.”); }

c. if (age = 16) { console.log(“You can learn to drive.”); } else { console.log(“You need to wait a little longer.”); }

d. if (age <= 16) { console.log(“You can learn to drive.”); } else { console.log(“You need to wait a little longer.”); }

9) Which statement evaluates to true?

let score = 10;

a. score == “score”

b. score == “10”

c. score === “10”

d. score === “score”

10) An example of a falsy value is _____.

a. if (“cats”)

b. if (“”)

c. if (5)

d. if (” “)

11) What is output to the console?

num = 5; console.log(num > 10 ? “Iron Man” : “Hulk”);

a. true

b. Iron Man

c. false

d. Hulk

12) What is the last number output by the loop?

i = 5 while (i >= 0) { console.log(i); i–; }

a. 0

b. 1

c. 5

d. 6

13) _____ loops never stop executing.

a. While

b. For

c. Do-while

d. Infinite

14) Which loop executes once before the condition is tested?

a. Infinite

b. While

c. For

d. Do-while

15) What is the correct format for calling the function and using 1 and 2 as arguments?

function multiplyNums(a, b) { return a * b; }

a. multiplyNums(1);multiplyNums(2);

b. function multiplyNums(1, 2);

c. call multiplyNums(1, 2);

d. multiplyNums(1, 2);

16) Which code snippet uses an anonymous function?

a. function subNum(a, b) { return b – a; }

b. let subNum = function(a, b) { return b – a; }

c. let subNum(a, b) { return b – a; }

d. subNum function(a, b) { return b – a; }

17) Which return statement is correct if the return value is “I will make an apple and blueberry pie.”?

let fruitPie = function (a, b) { return _____; } fruitPie(“apple”, “blueberry”);

a. “I will make an ” + “a” + ” and ” + “b” + ” pie.”

b. “I will make an ” + (a, b) + pie.”

c. “I will make an ” + a + ” and ” + b + ” pie.”

d. “I will make an (a) and (b) pie.”

18) Which array is correctly structured?

a. let countries: [“England”, “Brazil”, “Cuba”];

b. countries = [England, Brazil, Cuba];

c. let countries = [“England”, “Brazil”, “Cuba”];

d. countries [“England, Brazil, Cuba”];

19) How does theunshift()method change the following array?

let colors = [“red”, “orange”, “yellow”]; colors.unshift(“blue”);

a. Replaces red with blue

b. Adds blue to end of array

c. Adds blue to beginning of array

d. Replaces yellow with blue

20) What does the following code snippet output to the console?

let names = [“Mike”, “Belinda”, “Jonny”, “Sophie”]; for (i = 0; i < names.length; i++) { console.log(names[i]); }

a. “Mike”, “Belinda”, “Jonny”, “Sophie”

b. 0Mike 1Belinda 2Jonny 3Sophie

c. Mike Belinda Jonny Sophie

d. [“Mike”, “Belinda”, “Jonny”, “Sophie”]

21) Which statement changes the puppy object’s name from Daisy to Darth?

let puppy = { name: “Daisy”, breed: “husky”, color: “black” };

a. puppy = “Darth”;

b. name = “Darth”;

c. puppy name = “Darth”;

d. puppy.name = “Darth”;

22) Which code defines a setter for the breed property, such that assigning toperson1.breedsetsperson1.pet?

let person1 = { firstName: “Sophie”, lastName: “Hernandez”, age: 25, pet: “”, _____ };

a. set breed(value) { this.pet = value; }

b. set breed(value) { this.breed = pet; }

c. set breed(value) { pet = breed; }

d. set breed(value) { breed = pet; }

23) What is output by the following code?

let message = “I choose you!”; console.log(message.charAt(6));

a. e

b. o

c. s

d. e you!

24) What is the final output?

let quote = “Talk and they will listen.”; quote = quote.replace(“talk”, “Speak”); quote = quote.replace(“they”, “I”); quote = quote.replace(“LISTEN”, “be heard”);

a. Talk and I will listen.

b. Speak and I will listen.

c. Talk and I will be heard.

d. Speak and I will be heard.

25) What is output to the console?

let myPhrase = “Are you talking to me?”; console.log(myPhrase.split(“a”));

a. [“re you t”, “lking to me?”]

b. [“Are”, “talking”]

c. [“re you tlking”, “to me?”]

d. [“Are you t”, “lking to me?”]

26) What is the date?

let day = new Date(2020, 9, 30);

a. Mon Nov 30 2020 03:00:00 GMT-0500 (Eastern Standard Time)

b. Sun Aug 30 2020 03:00:00 GMT-0400 (Eastern Daylight Time)

c. Wed Sep 30 2020 03:00:00 GMT-0400 (Eastern Daylight Time)

d. Fri Oct 30 2020 03:00:00 GMT-0400 (Eastern Daylight Time)

27) Which code segment changes the year to 2021?

let changeYear = new Date (2020, 6, 20);

a. changeYear = 2021;

b. changeYear.setYear(2021);

c. changeYear.setFullYear(2021);

d. changeYear = setFullYear(2021);

28) Which method changes 10.2 to 11?

a. Math.abs(10.2);

b. Math.floor(10.2);

c. Math.ceil(10.2);

d. Math.round(10.2);

29) What is output forMath.pow(4,4);?

a. 4

b. 16

c. 8

d. 256

30) What is output?

function findError() { try { let message1 = “No errors here”; message2; } catch (error) { console.log(“There is an error”); } } findError(); console.log(“Done searching”);

a. There is an error

b. No errors here Done searching

c. Done searching

d. There is an error Done searching

31) What is missing to complete the following code segment?

let places = { woods: “Guam”, beach: “PR”, mountains: “Switzerland” }; try { console.log(places.rainforest); _____ “There might be an error”; } catch (error) { console.log(error); } _____ { console.log(places); }

a. throw, error

b. throw, try

c. throw, finally

d. finally, try

32) Which error is thrown by this code block?

let num = 13; console.log(num());

a. Error

b. InternalError

c. RangeError

d. TypeError

33) What default object is used when no object prefix is utilized to access a property or call a method (example: alert method)?

a. document

b. window

c. console

d. navigator

34) What JavaScript object and method is used to write HTML to the web page?

a. document.println()

b. document.writeln()

c. window.write()

d. window.print()

35) How many DOM nodes are created from the paragraph?

<p>Feed the dog.</p>

a. None

b. One for the p element

c. One for the p element and one for the paragraph text

d. One for the p element, one for the paragraph text, and one for the whitespace within the paragraph text

36) Which statement changes the Pinterest link to a YouTube link?

<!DOCTYPE html> <html lang=”en”> <meta charset=”UTF-8″> <title>DOM example</title> <body> <p> <a href=”https://pinterest.com/”>Pinterest</a> </p> <script> let para = document.querySelector(“p”); let link = document.querySelector(“a”); </script> </body> </html>

a. para.href = “https://www.youtube.com/”;

b. link.href = “https://www.youtube.com/”;

c. para.innerHTML = “https://www.youtube.com/”;

d. link.innerHTML = “https://www.youtube.com/”;

37) What is the preferred way to register an event handler that allows multiple handlers for the same event?

a. myButton.addEventListener(“click”, clickHandler);

b. myButton.onclick = clickHandler;

c. <button onclick=”clickHandler()”>Click Me</button>

d. <button onclick=”clickListener”>Click Me</button>

38) An event that occurs when someone enters their name in an input field is a(n) _____ event.

a. click

b. load

c. input

d. submit

39) On a given keypress event, the event object’s _____ property is used to access the object where the keypress event occurred.

a. event

b. click

c. target

d. element

40) The _____ is required to cancel the interval:

let timerId = setInterval(repeatMe, 1000);

a. clearInterval(repeatMe)

b. clearInterval(timerId)

c. stopInterval(timerId)

d. setTimeout(timerId)

41) What code would be used to call a function called repeat every 3 seconds?

a. setTimeout(repeat, 3)

b. setInterval(repeat, 3000);

c. setInterval(repeat, 3);

d. setTimeout(repeat, 3000)

42) How many times isshowMe()called when the following code is executed?

let timerId = setTimeout(showMe, 3000); function showMe() { let div1 = document.getElementById(“div1”); div1.style.display = “block”; alert(“called”); let timerId = setTimeout(showMe, 3000); }

a. indefinitely

b. 1

c. 2

d. 3

43) In the following JSON, the datatype associated with friends is _____.

{“friends”: [{ “name”:”Bobby”}, {“name”:”Celia”},{“name”:”Judy”}]}

a. string

b. object

c. array

d. char

44) How is the age field accessed after the following is executed:

let obj = JSON.parse(‘{“name”:”Bobby”, “age”:20}’);

a. this.age

b. age

c. obj.age

d. obj.name.age

45) What doesstringify()return?

JSON.stringify({“friends”: [{ “name”:”Bobby”}, {“name”:”Celia”},{“name”:”Judy”}]});

a. single string

b. string array

c. JSON object

d. undefined

46) A(n) _____ allows older browsers to function with newer features by providing missing functionality.

a. trifill

b. backfill

c. polyfill

d. altfill

47) A polyfill is engineered to:

a. Use JavaScript to implement a feature whenever possible

b. Replace HTML to implement a feature after checking if a feature exists

c. Use JavaScript to implement a feature after checking if a feature exists

d. Use Ajax to implement a feature whenever possible

48) The _____ website shows what features are supported by major browsers and frequency of use.

a. W3C

b. Tiobe

c. CanIUse

d. W3Schools

49) Which strings match the regex?

let words = [“dapper”, “paper”, “cat”, “flack”]; let re = /pa|ac/;

a. dapper, paper

b. paper, flack

c. flack, cat

d. dapper, flack

50) Which regular expression matches only the words burp, dirt, and right?

let randomWords = [“burp”, “try”, “dirt”, “right”];

a. let re = /[a-i]/

b. let re = /[e-i]/

c. let re = /[i-u]/

d. let re = /[r]/

51) Which string inwordNumsmatches the regex?

let wordNums = [“blahblah!!”, “yea”, “N()P3”, “H!”]; let re = /\wa\S!/;

a. blahblah!!

b. yea

c. N()P3

d. H!

52) Which line of code instantiates Adele and the album 21?

function PlayList(artist, album) { this.artist = artist; this.album = album; };

a. Adele.PlayList = (“Adele”, “21”);

b. Adele = new PlayList(“Adele”, “21”);

c. Adele new PlayList = (“Adele”, “21”);

d. Adele = PlayList (“Adele”, “21”);

53) Which line of code creates a prototype method for PlayList called showCollection?

function PlayList(artist, album) { this.artist = artist; this.album = album; };

a. PlayList.prototype.showCollection = function() { console.log(“My playlist so far: ” + this.artist + ” : ” + this.album); };

b. prototype.PlayList.showCollection = function() { console.log(“My playlist so far: ” + this.artist + ” : ” + this.album); };

c. this.prototype.showCollection = function() { console.log(“My playlist so far: ” + this.artist + ” : ” + this.album); };

d. PlayList.showCollection.prototype = function() { console.log(“My playlist so far: ” + this.artist + ” : ” + this.album); };

54) In strict mode, _____ variables must be declared.

a. most

b. some

c. all

d. no

55) Which function is in strict mode?

a. function abc123() { “restrict”; }

b. function abc123() { “use strict”; }

c. function abc123() { “strict”; }

d. function abc123() { “strict mode”; }

56) http://www.google.com and https://www.google.com are _____.

a. different origins

b. the same

c. data sharers

d. web storage objects

57) Which line of code deletes all data fromlocalStorage?

a. localStorage.clear();

b. localStorage.delete();

c. localStorage.remove();

d. localStorage.clearAll();

58) What does this line of code do?


a. Removes the “name” key and associated value from storage

b. Removes the “name” key from storage

c. Removes all values from storage

d. Deletes a local variable named “name”

Order your essay today and save 10% with the discount code ESSAYHELP