CHS Web Design Track

JavaScript for Web Warriors, 7eChapter 1: Introduction to JavaScript

Chapter Reinforcement

MULTIPLE CHOICE

  1. Using client-side scripting to handle light processing tasks such as data validation _____.
    1. minimizes transfer times across the Internet, making web applications faster
    2. confines processing to fewer hardware devices, limiting processing power
    3. increases server resource requirements and the related infrastructure costs
    4. is not possible, as you must use server-side scripting to validate forms
  2. Which element of the JavaScript expression document.write(“<p>The current time in “ + cityName + “ is “ + currentTime + “.</p>”); is a literal?
    1. cityName
    2. “<p>The current time in “
    3. document
    4. write
  3. Server-side scripting is used to _____.
    1. access or manipulate the user's web browser
    2. directly access a database on a system's back end
    3. handle the processing needed to display a user interface
    4. translate a request from a client into HTML
  4. Which of the following lines of code correctly uses an event handler attribute to display a dialog box when the webpage user clicks or taps a submit button?
    1. <select type=”submit” onclick=”window.alert(Welcome!)” />
    2. <input type=”submit” onclick=window.alert(“Welcome!”) />
    3. <input type=”submit” onclick=”window.alert(‘Welcome!')” />
    4. <input type=”submit” onblur=”window.alert(‘Welcome!')” />
  5. Which of the following languages is used for server-side scripting?
    1. HTML
    2. JavaScript
    3. Ruby
    4. Java
  6. When a variable is declared and initialized with the statement var velocity = 32;, this means that _____.
    1. it has a somewhat different scope than if it were declared using the let keyword
    2. it stores a constant value that cannot be changed
    3. the variable velocity can only hold a numerical value, not a text string
    4. the variable velocity was declared and initialized without using an assignment operator
  7. Which statement about the BOM is correct?
    1. JavaScript does not directly interact with the BOM.
    2. A formal set of standards for the BOM is maintained by the W3C.
    3. The BOM describes how to access a web page's contents.
    4. The BOM is largely the same among the various browsers currently available.
  8. JavaScript _____.
    1. was once supported by Internet Explorer only in a different form called JScript
    2. was developed by the European Computer Manufacturers Association
    3. has benefited from a single set of governing standards since it was introduced
    4. was not supported by major browsers for the first 11 years that it existed
  9. Which JavaScript statement assigns the value 3.49 to the price property of the hotChocolate object?
    1. hotChocolate.write(price, 3.49);
    2. hotChocolate.price=3.49;
    3. hotChocolate.price(3.49);
    4. price.hotChocolate=3.49
  10. What code lines would you place before and after a set of JavaScript statements to embed them in an HTML file?
    1. <script> and </script>
    2. script.execute; { and }
    3. <javascript> and </javascript>
    4. /* and */

TRUE FALSE

  1. Enclosing embedded JavaScript statements within a script element of an XHTML document in a CDATA section causes them to be treated as parsed character data, which will invalidate the XHTML document.
  2. 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.
  3. 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.
  4. When you insert several JavaScript scripts into an HTML file, you must repeat statements declaring and initializing variables in each script because the statements in one script are unavailable to other scripts in the file.
  5. Programmers are not required to end JavaScript statements with semicolons, but it is considered good practice to do so.
  6. 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>
  7. An HTML document that is well formed and correctly written according to the element definitions in HTML's specific language definition is considered a valid document.
  8. JavaScript programmers must include code to respond to the complete set of trigger events in each script because all events occur with all devices that run browser applications.
  9. The operands in the JavaScript expression “ABC” + 123 + doReMe are: “ABC”, 123, and doReMe.
  10. 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.