Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Which method of the Document interface retrieves an array of all the elements of the specified type? a. getElementByTagName () b.getElementByClassName () c.getElementByName () d.getElementById

1.Which method of the Document interface retrieves an array of all the elements of the specified type?

a. getElementByTagName ()

b.getElementByClassName ()

c.getElementByName ()

d.getElementById ()

2.To avoid potential errors caused by using variables that are not properly declared, you should?

a.make all variables global

b.use strict mode

c.make sure you always assign values to your variables

d.make all variables local

3.When you test an application with Chromes developer tools and a breakpoint is reached, you can click:

a. the Step Into button to execute the current statement and move to the next statement

b. the Step Over button to skip execution of the next statement

c.the Step Out button to continue normal execution of the application

d.the Continue button to continue stepping through the statements

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

5.Given HTML that includes the element

shipping cost goes here

what will the following code do if the user enters 100 at the prompt?

var getInfo = function() {

var cost = parseFloat(prompt("How much does the item cost?"));

var ship = cost * .06;

document.getElementById("ship").innerHTML="Shipping: $" + ship.toFixed(2);

};

a.It will calculate the value of the ship variable, but the

element will remain unchanged

b.It will display "shipping cost goes here Shipping: $6.00" in the

element

c.It will display NaN in the

element because the starting text in this element is not a number

d.It will replace the text in the

element with "Shipping: $6.00"

6.What event occurs when the user selects a new item from a select list?

a. change

b.select

c.dblclick

d.click

7.What does the following code do?

var userName = $("user").firstChild.nodeValue;

a. It puts the value of the userName variable into the HTML element with "user" as its id attribute

b.It replaces the text of an HTML element with "userName" as its id attribute with value "user"

c.It sets the text of an HTML element with "user" as its id attribute

d.It puts the text of an HTML element with "user" as its id attribute into the userName varieable

8.What method would you use to remove the focus from a control?

a. value()

b. focus()

c. remove()

d. blur()

9.To trace the execution of a JavaScript application so you can view the results when the application ends, you would?

a.insert alert() method calls at key points in the code

b.insert source.write() method calls at key points in the code

c.insert console,log() method calls at key points in the code

d.set breakpoints at key points in the code

10How would you rewrite the statement that follows that uses the DOM Core specification to use the DOM HTML specification?

imageElement.getAttribute(src);

a.imageElement.setAttribute(src);

b. var newImage = img.src;

c.imageElement.src;

d.imageElement.img.src;

11.Prior to ECMAScript 5, what would happen if you declared a variable named firstName and then later refered to it as firstname?

a. Firstname would be treated as a new local variable

b. Firstname would be treated as a new global variable

c.The JavaScript engine would throw an arror

d. The JavaScript enggine would automatically correct the error

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_2

Step: 3

blur-text-image_3

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions