Murach Javascript Final Review

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

==

A common error when coding an equals condition in a conditional expression is to code the symbol = instead of __________________.

counter

A for loop depends on the value of a/an _____________________ that is varied during the execution of the loop.

method

A function ________ doesn't have to be coded before the statements that call it

variable

A function expression is called by referring to the name of the _________________________ that it's assigned to.

the web server to the client

An HTTP response is sent from

console.log

An easy way to log the progress of an application in Chrome's Console panel is to insert __________________ methods at critical points in the code.

method

In the code that follows, prompt is a/an ____________________________. window.prompt("Enter your name");

string

The easiest way to create a string object is to declare a variable and assign a ________ to it.

the blur method

To remove the focus from a control, what method do you use?

DOM

To view changes to the ______ while you're using an application, you can use Chrome's elements panel.

moving the mouse pointer over the name of a variable in the Sources panel

When you test an application with Chrome's developer tools and a breakpoint is reached, you can view the current data by

browser

When you use JavaScript to make a change to the Document Object Model for a web page, the page is immediately changed in the __________________________.

node

Which of the following is NOT part of an HTTP URL:

id

A CSS selector can refer to a specific HTML element by specifying the value of the element's ________________________ attribute.

HTTP request

A web application starts when a client sends a/an ______________________ to a server.

form

After the data in a form has passed all of the validity tests, you can submit the form to the server by using the submit method of the ____________________.

the HTML element with "rate" as its id attribute

After the statement that follow is executed, rateText represents

fullName="Harris, Ray"

After the statements that follow are executed, var firstName = "Ray", lastName = "Harris"; var fullName = lastName; fullName += ", "; fullName += firstName;

dynamic

An HTML document that's generated by a web application is a __________ web page.

reserved

An identifier in JavaScript cannot contain ___________________ words.

22 is Tom's age.

Assume userName equals "Tom" and userAge equals 22. What is displayed in a dialog box when the following statement is executed? alert(userAge + " \nis " + userName + "'s age.");

attached to the onchange event of a control with an id of "investment".

For the following code, an event handler named investment_change is var investment_change = function() { var years = parseInt( $("years").value ); alert("Years: " + years); } window.onload = function() { $("investment").onchange = investment_change; }

due_date.setMonth(1);

Given a Date object named due_date, which of the following statements sets the month to February?

Fall through to the next label

If a case label of a switch statement doesn't contain a break statement, what will the code execution do?

integer

If possible, the parseInt method converts the string that's passed to it to a/an

1 years, and 1 months

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."; }

boolean

If you want to store a true or false value in a variable, you use the __________________ data type.

pressing F12 and reviewing the code in the Sources panel

If you're using the Chrome browser and a JavaScript application stops running due to an error in the JavaScript code, you can identify the statement that caused the error by

NaN

In JavaScript, _______ represents a value that isn't a real number.

a

In PHP, which bitwise operation is signified by the pipe (|) character? a. OR b. XOR c. AND d. NOT

assignment

In a simple assignment statement, you use the _____________________ operator.

window

In a web browser, the ____________________ object is the object that's always available to JavaScript so you don't have to code its name when you call one of its methods.

domain name

In an HTTP URL, the ________________________ is coded immediately after the protocol but before the path.

object

In the code that follows, document is a/an

method

In the code that follows, getElementById is a/an

round

One way to resolve the debugging problems that can result from the imprecision of floating-point arithmetic is to _________ the results of your calculations.

a trivial HTML error can cause other types of errors

Sometimes, validating the HTML code for a web page will help you debug an application, because

hasAttribute()

The ____________________ method of the Element interface returns true if the element has the attribute that's specified in the parameter.

while

The ______________________ loop tests its conditional expression at the beginning of the loop.

conditional

The ______________________ operator returns the middle operand if the first operand is true, and the last operand if the first operand is false. It can also be rewritten as an if statement.

id

The ________________________ attribute is used to uniquely identify an HTML element.

an error will occur because salestax hasn't been declared

The code that follows has a bug in it because the second use of the variable named salesTax is spelled with all lowercase letters (salestax). var calculateTax = function(subtotal,taxRate) { var salesTax = subtotal * taxRate; salestax = parseFloat(salesTax.toFixed(2)); return salesTax; } Assuming that there are no other problems and that you're using strict mode, what will happen when this code is executed?

click on the Reload or Refresh button

The easiest way to run a web page that's already in your browser after you've made changes to the code for the page is to

creates a function and stores it in a variable named display_error.

The following code var display_error = function(message) { alert("Error: " + message); }

text

The nodeValue property of a DOM object returns the ________ that's stored in a Text or Attribute node.

"Can vote"

The value of message when the following code executes is ______________________ . var age = 19; var message = ( age >= 18 ) ? "Can vote" : "Cannot vote";

run

To _____________________ a web page, you load the page into a browser.

var

To declare a variable, you code the keyword _____________________ followed by the name of the variable.

alert

To display string or numeric data in a dialog box, you use the JavaScript __________________ method.

use the Open or Open File command in the File menu

To load a web page from a local server into your web browser, you can

Developer Tools

To locate the JavaScript statement that caused an error, you can use Chrome's __________________________.

script

To provide JavaScript in the body of an HTML document, you code an HTML __________________ element that contains the JavaScript.

shim.js

To provide for ECMA script 5 compatibility with older browsers, you can use a file named

index

Unlike a while loop, a for loop provides for varying the value of a/an __________________ each time the loop is executed.

Forbidden

What is displayed when the following code executes?

statement termination

What is the purpose of the semicolon in PHP?

a

What is the purpose of the semicolon in PHP? a. statement termination b. concatenation c. line continuation d. subtraction

An integer between 1 and 10

What is the value of random after the following code executes? var random = Math.floor(Math.random() * 10); random = random + 1;

3.5

What is the value of selected when the following code executes? var num = "3.5"; var selected = num && parseFloat(num) || num || "";

""

What is the value of selected when the following code executes? var num = undefined; var selected = num && parseFloat(num) || num || "";

L:0,L:1,L:2,L:3,L:4,

What is the value of the message variable after the following code executes? var message = ""; for (var i = 0; i < 5; i++ ) { message += "L:" + i + ","; }

The Math.max method

What method of the Math object can be used to return the largest value from the values that are passed to it?

The file is in "C:\My Documents"

What text does the following code display in a dialogue box?

141.95|212.96|312.95|10.95

What will the value of the totalsString variable be after the following is executed?

an application server

When a client requests a dynamic web page, the HTML is generated by

true

When the condition that follows is evaluated, it has a value of ___________________. !isNaN("12.345");

false

When two conditional expresssions are connected by the && operator, the second expression isn't evaluated if the first expression is ____________________.

ignored

When you "comment out" JavaScript code, the code is __________________________ when the page is tested.

top-down

When you build an application with _____________________ coding and testing, you start with a small portion of code and then build on that base by adding an operation or two at a time.

breakpoint

When you're using Chrome's developer tools, you can set a ____________________ and then step through the statements that follow one statement at a time.

b

Which of the following is a PHP function used to declare constants? a. var b. define c. echo d. phpinfo

var length = 120;

Which of the following is a valid statement for declaring and initializing a variable named length to a starting value of 120?

var birthday = "12/2/1978";

Which of the following statements is NOT a valid way to create a date object named birthday?

c

Which of the following statements is false concerning PHP identifiers? a. Identifiers cannot begin with a digit b. Identifiers can be of any length c. Identifiers are case insensitive. d. Identifiers can have the same name as a function

can start with a number

Which of the following statements is false? A JavaScript identifier

the year and month

Which parameters are required when you call the Date constructor with number parameters?

a property and a value

Within a CSS rule set, a rule includes

external

You use a link element in an HTML document to provide an embedded style sheet or to identify an ________ style sheet

checked

for a checkbox, you can use the _______ property to test whether the box is checked

new

to create a Date element, you use the ______ keyword followed by Date().


Kaugnay na mga set ng pag-aaral

Week 8-A: Retail Pricing Decisions - II: Price Setting Methods

View Set