Posts

Accounting homework help

 
1) Which variable declaration format is correct?

  1. favBand let = “Linkin Park”;

b.let favBand = “Linkin Park”;

  1. let favBand: “Linkin Park”;
  2. favBand let: “Linkin Park”;

 
2) Which declaration is a constant for minimum wage?

  1. let MIN_WAGE;
  2. var MIN_WAGE = 10;

c.const MIN_WAGE = 10;

  1. const MIN_WAGE;

 
3) What is rainbow’s data type?
let rainbow = [“red”, “orange”, “green”, “purple”];

  1. Array
  2. Boolean
  3. String
  4. Object

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

  1. x = 44
  2. x = 4 * 4
  3. x = 4 + 4 + 4 + 4
  4. x = 4 * 4 * 4 * 4

 
5) Which compound assignment operator assigns numbers with 9?
let numbers = 3;
numbers _____ 3;

  1. +=
  2. -=
  3. *=
  4. /=

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

  1. string
  2. number
  3. error
  4. object

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

  1. 0
  2. isNaN()
  3. Error
  4. NaN

 
8) Which if-else statement correctly conveys the following information?
If age is at least 16, “You can learn to drive.” is output.

  1. if (age >= 16) {
    console.log(“You can learn to drive.”);
    }
    else {
    console.log(“You need to wait a little longer.”);
    }
  2. if (age > 16 = true) {
    console.log(“You can learn to drive.”);
    }
    else {
    console.log(“You need to wait a little longer.”);
    }
  3. if (age = 16) {
    console.log(“You can learn to drive.”);
    }
    else {
    console.log(“You need to wait a little longer.”);
    }
  4. 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;

  1. score == “score”
  2. score == “10”
  3. score === “10”
  4. score === “score”

 
10) An example of a falsy value is _____.

  1. if (“cats”)
  2. if (“”)
  3. if (5)
  4. if (” “)

 
11) What is output to the console?
num = 5;
console.log(num > 10 ? “Iron Man” : “Hulk”);

  1. true
  2. Iron Man
  3. false
  4. Hulk

 
12) What is the last number output by the loop?
i = 5
while (i >= 0) {
console.log(i);
i–;
}

  1. 0
  2. 1
  3. 5
  4. 6

 
13) _____ loops never stop executing.

  1. While
  2. For
  3. Do-while
  4. Infinite

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

  1. Infinite
  2. While
  3. For
  4. 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;
}

  1. multiplyNums(1);multiplyNums(2);
  2. function multiplyNums(1, 2);
  3. call multiplyNums(1, 2);
  4. multiplyNums(1, 2);

 
16) Which code snippet uses an anonymous function?

  1. function subNum(a, b) {
    return b – a;
    }
  2. let subNum = function(a, b) {
    return b – a;
    }
  3. let subNum(a, b) {
    return b – a;
    }
  4. 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”);

  1. “I will make an ” + “a” + ” and ” + “b” + ” pie.”
  2. “I will make an ” + (a, b) + pie.”
  3. “I will make an ” + a + ” and ” + b + ” pie.”
  4. “I will make an (a) and (b) pie.”

 
18) Which array is correctly structured?

  1. let countries: [“England”, “Brazil”, “Cuba”];
  2. countries = [England, Brazil, Cuba];
  3. let countries = [“England”, “Brazil”, “Cuba”];
  4. countries [“England, Brazil, Cuba”];

 
19) How does theunshift()method change the following array?
let colors = [“red”, “orange”, “yellow”];
colors.unshift(“blue”);

  1. Replaces red with blue
  2. Adds blue to end of array
  3. Adds blue to beginning of array
  4. 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]);
}

  1. “Mike”,
    “Belinda”,
    “Jonny”,
    “Sophie”
  2. 0Mike
    1Belinda
    2Jonny
    3Sophie
  3. Mike
    Belinda
    Jonny
    Sophie
  4. [“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”
};

  1. puppy = “Darth”;
  2. name = “Darth”;
  3. puppy name = “Darth”;
  4. 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: “”,
_____
};

  1. set breed(value) {
    this.pet = value;
    }
  2. set breed(value) {
    this.breed = pet;
    }
  3. set breed(value) {
    pet = breed;
    }
  4. set breed(value) {
    breed = pet;
    }

 
23) What is output by the following code?
let message = “I choose you!”;
console.log(message.charAt(6));

  1. e
  2. o
  3. s
  4. 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”);

  1. Talk and I will listen.
  2. Speak and I will listen.
  3. Talk and I will be heard.
  4. 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”));

  1. [“re you t”, “lking to me?”]
  2. [“Are”, “talking”]
  3. [“re you tlking”, “to me?”]
  4. [“Are you t”, “lking to me?”]

 
26) What is the date?
let day = new Date(2020, 9, 30);

  1. Mon Nov 30 2020 03:00:00 GMT-0500 (Eastern Standard Time)
  2. Sun Aug 30 2020 03:00:00 GMT-0400 (Eastern Daylight Time)
  3. Wed Sep 30 2020 03:00:00 GMT-0400 (Eastern Daylight Time)
  4. 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);

  1. changeYear = 2021;
  2. changeYear.setYear(2021);
  3. changeYear.setFullYear(2021);
  4. changeYear = setFullYear(2021);

 
28) Which method changes 10.2 to 11?

  1. Math.abs(10.2);
  2. Math.floor(10.2);
  3. Math.ceil(10.2);
  4. Math.round(10.2);

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

  1. 4
  2. 16
  3. 8
  4. 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”);

  1. There is an error
  2. No errors here
    Done searching
  3. Done searching
  4. 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);
}

  1. throw, error
  2. throw, try
  3. throw, finally
  4. finally, try

 
32) Which error is thrown by this code block?
let num = 13;
console.log(num());

  1. Error
  2. InternalError
  3. RangeError
  4. TypeError

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

  1. document
  2. window
  3. console
  4. navigator

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

  1. document.println()
  2. document.writeln()
  3. window.write()
  4. window.print()

 
35) How many DOM nodes are created from the paragraph?
<p>Feed the dog.</p>

  1. None
  2. One for the p element
  3. One for the p element and one for the paragraph text
  4. 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>

  1. para.href = “https://www.youtube.com/”;
  2. link.href = “https://www.youtube.com/”;
  3. para.innerHTML = “https://www.youtube.com/”;
  4. 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?

  1. myButton.addEventListener(“click”, clickHandler);
  2. myButton.onclick = clickHandler;
  3. <button onclick=”clickHandler()”>Click Me</button>
  4. <button onclick=”clickListener”>Click Me</button>

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

  1. click
  2. load
  3. input
  4. submit

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

  1. event
  2. click
  3. target
  4. element

 
40) The _____  is required to cancel the interval:
let timerId = setInterval(repeatMe, 1000);

  1. clearInterval(repeatMe)
  2. clearInterval(timerId)
  3. stopInterval(timerId)
  4. setTimeout(timerId)

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

  1. setTimeout(repeat, 3)
  2. setInterval(repeat, 3000);
  3. setInterval(repeat, 3);
  4. 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);
}

  1. indefinitely
  2. 1
  3. 2
  4. 3

 
43) In the following JSON, the datatype associated with friends is _____.
{“friends”: [{ “name”:”Bobby”}, {“name”:”Celia”},{“name”:”Judy”}]}

  1. string
  2. object
  3. array
  4. char

 
44) How is the age field accessed after the following is executed:
let obj = JSON.parse(‘{“name”:”Bobby”, “age”:20}’);

  1. this.age
  2. age
  3. obj.age
  4. obj.name.age

 
45) What doesstringify()return?
JSON.stringify({“friends”: [{ “name”:”Bobby”}, {“name”:”Celia”},{“name”:”Judy”}]});

  1. single string
  2. string array
  3. JSON object
  4. undefined

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

  1. trifill
  2. backfill
  3. polyfill
  4. altfill

 
47) A polyfill is engineered to:

  1. Use JavaScript to implement a feature whenever possible
  2. Replace HTML to implement a feature after checking if a feature exists
  3. Use JavaScript to implement a feature after checking if a feature exists
  4. Use Ajax to implement a feature whenever possible

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

  1. W3C
  2. Tiobe
  3. CanIUse
  4. W3Schools

 
49) Which strings match the regex?
let words = [“dapper”, “paper”, “cat”, “flack”];
let re = /pa|ac/;

  1. dapper, paper
  2. paper, flack
  3. flack, cat
  4. dapper, flack

 
50) Which regular expression matches only the words burp, dirt, and right?
let randomWords = [“burp”, “try”, “dirt”, “right”];

  1. let re = /[a-i]/
  2. let re = /[e-i]/
  3. let re = /[i-u]/
  4. let re = /[r]/

 
51) Which string inwordNumsmatches the regex?
let wordNums = [“blahblah!!”, “yea”, “N()P3”, “H!”];
let re = /\wa\S!/;

  1. blahblah!!
  2. yea
  3. N()P3
  4. H!

 
52) Which line of code instantiates Adele and the album 21?
function PlayList(artist, album) {
this.artist = artist;
this.album = album;
};

  1. Adele.PlayList = (“Adele”, “21”);
  2. Adele = new PlayList(“Adele”, “21”);
  3. Adele new PlayList = (“Adele”, “21”);
  4. 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;
};

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

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

  1. most
  2. some
  3. all
  4. no

 
55) Which function is in strict mode?

  1. function abc123() {
    “restrict”;
    }
  2. function abc123() {
    “use strict”;
    }
  3. function abc123() {
    “strict”;
    }
  4. function abc123() {
    “strict mode”;
    }

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

  1. different origins
  2. the same
  3. data sharers
  4. web storage objects

 
57) Which line of code deletes all data fromlocalStorage?

  1. localStorage.clear();
  2. localStorage.delete();
  3. localStorage.remove();
  4. localStorage.clearAll();

 
58) What does this line of code do?
localStorage.removeItem(“name”);

  1. Removes the “name” key and associated value from storage
  2. Removes the “name” key from storage
  3. Removes all values from storage
  4. Deletes a local variable named “name”