Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#1 Which of the following is NOT one of the three testing phases of a JavaScript application? a.trying to make the application fail b.using the

#1 Which of the following is NOT one of the three testing phases of a JavaScript application?

a.trying to make the application fail

b.using the W3C Markup Validation Service to validate the HTML

c.testing the application with valid data

d.testing the application with invalid data

#2 Code Example 5-1

1. var getResult = function() { 2. var num1 = 54.95; 3. var num2 = .1; 4. var result = parseFloat(prompt("What is " + num1 + " * " + num2 + "?")); 5. if (result != (num1 * num2)) { 6. alert("Incorrect"); 7. } 8. else { 9. alert("Correct!"); 10. } 11. };

(Refer to Code Example 5-1) Which of the following would fix the error in the code example?

a. Change the prompt on line 4 to read: "What is " + num1 + " * " + num2 + ", rounded to 3 decimal places?"

b.change the condition of the if statement on line 5 to: if (result != (num1 * num2).toFixed(3))

c.change the if statement (lines 5 - 10) to read:

if (result == (num1 * num2)) { alert("Correct!"); } else { alert("Incorrect"); }

d. change the condition of the if statement on line 5 to: (result != parseFloat(num1 * num2)

#3 When you view the source code for a page thats displayed in a browser, you see

a. Only the initial HTML for the page.

b.The initial HTML for the page, along with the JavaScript if its stored in the HTML file.

c. HTML for the page that reflects changes made to the DOM by the JavaScript.

d. HTML that reflects changes made to the DOM by the JavaScript, along with the JavaScript if its stored in the HTML file.

#4 Which of the following types of errors will cause an application to stop executing?

a. runtime error

b. logic error

c. syntax error

d. JavaScript engine error

#5 To avoid potential errors caused by using variables that are not properly declared, you should

a. make sure you always assign values to your variables

b. use strict mode

c. make all variables global

d. make all variables local

#6 What will be displayed in the user's browser after the following code executes if the user enters 87 at the prompt? "use strict" var getInfo = function() { grade = parseInt(prompt("What's your score on the test?")); var newGrade = getResult(grade); alert("Your grade, curved, is " + newGrade); }; var getResult = function(grade) { var newGrade = grade + 5; return (newGrade); };

a. an alert will display: Your grade, curved, is 92

b. an alert will display: Your grade, curved, is NaN

c. nothing will display; grade is an undeclared variable

d. nothing will display; newGrade cannot be declared twice

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Development For Dummies

Authors: Allen G. Taylor

1st Edition

978-0764507526

More Books

Students also viewed these Databases questions