Chapter 1 Review
What would you place in the blank in the following JavaScript code to insert a note for other programmers to read that the interpreter would ignore? script> document.write("Today's stock prices"); _____ </script
// Need to replace with dynamic content
Which of the following is not a valid identifier?
2QInterest Rate
Which of the following is a characteristic of an object used in JavaScript programming?
includes both programming code and data
When you assign a specific value to a variable on its creation, you it.
initialize
A variable used in a program written in JavaScript _____.
is a specific location in the computer's memory
HTTP is important for the web's client/server system because _____.
it is the protocol used for data exchange between the client and server
Which of the following is not a language used by web developers?
machine code
HTML is an example of a:
markup language
Suppose you want to change the source file for the image element with the id value shirtPhoto so that a blue shirt is shown when the webpage user clicks a blue swatch image on the page. The photo's file name is stored in the variable blueShirtImage. What JavaScript event handler could you attach to the swatch image element?
onclick document.getElementById('shirtPhoto').src blueShirtImage
What code lines would you place before and after a set of JavaScript statements to embed them in an HTML file?
script> and </script
A key characteristic that sets scripting languages apart from other programming languages is that _____.
scripting languages are run directly from a program, not compiled
When naming and using variables in JavaScript, you should remember that _____.
shelter and homelesspet are appropriate names for objects
The specifications for the Document Object Model are determined by:
the World Wide Web Consortium (W3C)
What is usually the primary role of a client?
the presentation of an interface to the user
In the context of programming web applications, a user typing in a form field with a keyboard, the occurrence of an error as a browser attempts to load a page, and a user touching a webpage element on a mobile phone screen are all examples of events.
true
JavaScript libraries such as Node.js and jQuery can be downloaded and then utilized to create and manage large web applications more effectively when connected to the HTML file through a script element in the head section.
true
Programmers are not required to end JavaScript statements with semicolons, but it is considered good practice to do so.
true
The JavaScript window.alert() method makes a dialog box appear that contains the literal string passed to it plus an OK button that can be clicked to close the box.
true
When the file magnolia.js is attached to a web page by inserting the following line into its HTML file, the browser will load the HTML and JavaScript files together until the script is loaded, pause loading of the HTML to process the script, then complete loading of the HTML. script src="magnolia.js" async></script
true
A system consisting of a client and a server is known as a .
two-tier system
Which of the following is not a JavaScript keyword used to declare a variable?
variable
Which method displays a dialog box with an OK button?
window.alert()
Which of the following uses the correct case?
document.write()
Code that tells a browser what to do in response to a specific event on a specific element is called a(n) .
event handler
Enclosing embedded JavaScript statements within ascript element of an XHTML document in a CDATA section causes them to be treated as parsed character data, which will invalidate the XHTML document.
false
It is the best practice to place all JavaScript scripts at the beginning of an HTML file so that they will not be run until after the Document Object Model has been created.
false
When the following script element is inserted into an HTML file to instruct the browser to load a JavaScript file, the name and location of the HTML file belong in the blank. script src="_____"></script
false
What is the relationship between JavaScript and ECMAScript?
JavaScript is the most important implementation of ECMAScript.
Which statement is correct?
A markup language called HTML is used to define the content and structure of a web page.
The syntax specifications for JavaScript are defined in:
ECMAScript
JavaScript is built upon:
ECMAScript, the Document Object Model, and the Browser Object Model
What potential problems can occur if you load a script prior to the page being entirely loaded by the browser?
If the JavaScript program attempts to reference a page element prior to that element being loaded by the browser, an error will result.
What is the key difference between a two-tier and a three-tier client/server system?
In a three-tier system, the database is split into a processing tier and a data storage tier.
Which of the following languages is used for server-side scripting?
Ruby
Which statement about the BOM is correct?
The BOM is largely the same among the various browsers currently available.
Which statement about a client/server architecture is correct?
The server fulfills the client's information request.
A programming language like Java requires a:
compiler
A(n) _____ transforms a set of instructions written in a programming language into machine code, which can be understood by a computer.
compiler
Which of the following functions does the processing tier not handle in a three-tier client/server system? processing and calculations
data storage
The Document Object Model _____.
describes how to access the contents of a web page and user actions within that page
Server-side scripting is used to _____.
directly access a database on a system's back end
