Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please I need \"ALL ANSWERS DO NOT SKIP PLEASE THANKS\" 1) To execute the code t

ID: 3638099 • Letter: P

Question

Please I need "ALL ANSWERS DO NOT SKIP PLEASE THANKS"


1) To execute the code that's stored in a function when the user clicks on a button, you create an event handler for the __________________ event of the button.

2) Which call statement will get the right result if the subtotal is $1000, the tax rate is 8%, and the value that's returned by the function should be stored in a numeric variable?
var calculateTax = function ( subtotal, taxRate )
{
var tax = subtotal * taxRate;
tax = parseFloat( tax.toFixed(2) );
return tax;
}
Choose one answer.
a. var tax = calculateTax( $1000, 8% );
b. var tax = calculateTax( 1000, 8 );
c. var tax = calculateTax( 1000, .08 );
d. calculateTax( subtotal, taxRate );

3) The order of precedence for arithmetic expressions causes
Choose one answer.
a. multiplication operations to be performed before addition operations
b. division operations to be performed after subtraction operations
c. increment operations to be performed after modulus operations
d. addition operations to be performed before subtraction operations

4) The code that follows is an example of __________________________.
document.getElementById("emailAddress").value.toLowerCase();

5) If totalMonths has a string value of "13",
what does the if statement that follows display?

var years = parseInt ( totalMonths / 12 );
var months = totalMonths % 12;

if ( years == 0 )
{
alert ( months + " months.");
}
else if ( months == 0 )
{
alert ( years + " years");
}
else
{
alert ( years + " years, and " + months + " months.";
}
Choose one answer.
a. 1 years, and 1 months
b. 1 year, and 1 month
c. 1 years
d. 1 year

6) To start a/an __________________________ comment, you code //.

7) A JavaScript identifier

a. isn't case-sensitive
b. can't start with a $ sign
c. can't start with a number
d. can't be more than 128 characters long

8) Which of the following is a valid statement for declaring and initializing a variable named length to a starting value of 120?
Choose one answer.
a. length = 120;
b. int length = 120;
c. var length = 120;
d. num length = 120;

9) You use the _____________ escape sequence to start a new line in a string variable.

10) If there's an error in your JavaScript code when you're using Firefox, you can view the error message in the Error Console by selection the appropriate command from the
Choose one answer.
a. File menu
b. View menu
c. Tools menu
d. Error menu

11) To create a function, you code the keyword function followed by a set of parentheses that contains any parameters, followed by a set of ______________________ that contains the statements that are to be executed when the function is called.

12) When the statement that follows is executed, the message is displayed if the value in userEntry

if ( isNaN(userEntry) || userEntry <= 0 )
{
alert ("Message - Your entry is bogus.");
}
Choose one answer.
a. isn't a number or the value in userEntry is less than or equal to zero
b. isn't a number and the value in userEntry is less than or equal to zero
c. is a number or the value in userEntry is less than or equal to zero
d. is a number and the value in userEntry is less than or equal to zero

13) The toFixed method of a number object returns a/an __________________________ that contains the value of the object rounded to the number of decimal places in the parameter.

14) The condition for a while loop is tested ______________ the statements in the loop are executed.

15) Assume userName equals "Tom" and userAge equals 22. What is displayed in a dialog box when the following statement is executed?
alert(userAge + " is " + userName + "'s age.");
Choose one answer.
a. 22 is Tom's age.
b. 22
is Tom's age.
c. 22 is Tom's age.
d. 22
is Tom's age.

16) JavaScript will automatically attempt to insert a semicolon at the end of a line when you split a statement across multiple lines
a. after the = operator
b. after an opening brace
c. after the return statement
d. after the + operator

17) What does the code in the third function do?

var $ = function ( id ) {
return document.getElementById( id );
}
var display_name_click = function () {
$("name_text_box").value = "Mike";
}
window.onload = function () {
$("display_button").onclick = display_name_click;
}
Choose one answer.
a. Assign an event handler named display_button to the click event of a button.
b. Assign an event handler named display_name_click to the click event of a button.
c. Create an event handler named display_button.
d. Create a function named display_button.


18) When the statement that follows is executed, JavaScript
var rate = parseFloat(document.getElementById("rate").value);
Choose one answer.
a. executes the getElementById method, executes the value method of the resulting object, and executes the parseFloat method on that value
b. executes the getElementById method, gets the value property of the resulting object, and executes the parseFloat method on that value
c. executes the parseFloat method, executes the getElementById method, and executes the value method of the resulting object
d. executes the parseFloat method, executes the getElementById method, and gets the value property of the resulting object


19) How many times will the while loop that follows be executed?

var months = 5;
var i = 1;

while (i < months)
{
futureValue = futureValue * (1 + monthlyInterestRate);
i = i+1;
}
Choose one answer.
a. 0
b. 4
c. 5
d. 6

20) After the code that follows is executed, okFlag contains a value of ___________________.
var okFlag = !isNaN("12.345");

21) In the code that follows, getElementById is a/an ____________________________.

document.getElementById("emailAddress");

22) After the statements that follow are executed,
var firstName = "Ray", lastName = "Harris";
var fullName = lastName;
fullName += ", ";
fullName += firstName;
Choose one answer.
a. firstName is "Harris"
b. firstname is "Ray Harris"
c. fullName is "Ray"
d. fullName is "Harris, Ray"

Explanation / Answer

2)a. var tax = calculateTax( $1000, 8% );
3)c. increment operations to be performed after modulus operations
4)Importing; Modules & Scripts .
5)c. 1 years
6)escape sequence to start a new line in a string variable
7)c. can't start with a number
8)d. num length = 120;
10)a. File menu
11)Can contain letters, digits, and underscores in any combination .
12)d. is a number and the value in userEntry is less than or equal to zero
13) The toFixed() method returns a string representation of a number
14) it just tests a condition and executes the loop for as long
15)22
is Tom's age.
16)a. after the = operator
17)b. Assign an event handler named display_name_click to the click event of a button.
18)d. executes the parseFloat method, executes the getElementById method, and gets the value property of the resulting object
19)b. 4
20)okFlag contain
21) method returns the element with the specified ID
22)c. fullName is "Ray"

pls rate