Professional Documents
Culture Documents
JavaScript The Web Warrior Series 6th Edition Vodnik Test Bank 1
JavaScript The Web Warrior Series 6th Edition Vodnik Test Bank 1
Solution Manual for JavaScript The Web Warrior Series 6th Edition
Vodnik Gosselin 1305078446 9781305078444
Full download link at:
Solution manual: https://testbankpack.com/p/solution-manual-for-javascript-the-web-
warrior-series-6th-edition-vodnik-gosselin-1305078446-9781305078444/
Test bank: https://testbankpack.com/p/test-bank-for-javascript-the-web-warrior-series-
6th-edition-vodnik-gosselin-1305078446-9781305078444/
True / False
1. Each time a program calls a procedure, the procedure is added to the top of the call stack, and then removed after it
finishes executing.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 259
2. Syntax refers to the order in which various parts of a program run, or execute.
a. True
b. False
ANSWER: False
POINTS: 1
REFERENCES: 213
3. For each error encountered, a browser's console displays a line number and a description of the error.
a. True
b. False
ANSWER: True
POINTS: 1
REFERENCES: 218
5. A breakpoint is a designation added to a specific statement in a program that causes program execution to pause when it
reaches that statement.
a. True
b. False
ANSWER: True
Cengage Learning Testing, Powered by Cognero Page 1
Name: Class: Date:
POINTS: 1
REFERENCES: 245
246
Multiple Choice
7. A ____ error occurs when the JavaScript interpreter encounters a problem while a program is executing.
a. run-time b. syntax
c. logic d. browser
ANSWER: a
POINTS: 1
REFERENCES: 214
8. A ____ error is a flaw in a program’s design that prevents the program from running as you anticipate.
a. compile-time b. syntax
c. logic d. run-time
ANSWER: c
POINTS: 1
REFERENCES: 215
9. When using the console.log() method to trace bugs, it can be helpful to use a ____ program.
a. script b. hub
c. tracing d. driver
ANSWER: d
POINTS: 1
REFERENCES: 232
10. The ____ is the ordered list maintained by a JavaScript processor containing all the procedures that have been called
but have not yet finished processing.
a. call queue b. call heap
c. call stack d. methods list
ANSWER: c
POINTS: 1
REFERENCES: 259
11. ____ allows programs to handle errors as they occur in the execution of a program.
a. Error coding b. Form validation
12. You enclose code that may contain an exception in a ____ statement.
a. throw b. catch
c. throws d. try
ANSWER: d
POINTS: 1
REFERENCES: 263
13. You use a ____ statement within a try block to specify an error message.
a. catch b. call
c. throw d. throws
ANSWER: c
POINTS: 1
REFERENCES: 264
14. After you throw an error, you use a ____ statement to handle the error.
a. try b. catch
c. handle d. capture
ANSWER: b
POINTS: 1
REFERENCES: 264
16. A program's ____ is the order in which various parts of the program run, or execute.
a. logic b. syntax
c. call stack d. console
ANSWER: a
POINTS: 1
REFERENCES: 213
POINTS: 1
REFERENCES: 231
19. The debugging tools built into modern browsers are especially useful in tracking down ____.
a. compile-time errors b. syntax errors
c. run-time errors d. logic errors
ANSWER: d
POINTS: 1
REFERENCES: 242
20. ____ is the temporary suspension of program execution so you can monitor values and trace program execution.
a. The call stack b. Break mode
c. Debugging d. Tracing
ANSWER: b
POINTS: 1
REFERENCES: 245
21. After you evaluate code for exceptions, you can use a ____ statement to perform cleanup or necessary tasks.
a. try b. throw
c. catch d. finally
ANSWER: d
POINTS: 1
REFERENCES: 265
23. Which of the following JavaScript statements requests that processors remove some features from the language and
require more stringent syntax for other features?
a. break; b. "use strict";
c. debugger; d. console.log();
ANSWER: b
POINTS: 1
Cengage Learning Testing, Powered by Cognero Page 4
Name: Class: Date:
REFERENCES: 276
Completion
27. The term ____________________ refers to the temporary suspension of program execution so that you can monitor
values and trace program execution.
ANSWER: break mode
POINTS: 1
REFERENCES: 245
28. You implement custom error handling using the ____________________ event.
ANSWER: error
onerror
POINTS: 1
REFERENCES: 270
29. In ____________________ mode, some features are removed from the language, while other features require more
stringent syntax.
ANSWER: strict
POINTS: 1
REFERENCES: 276
Matching
31. A list of expressions whose values are displayed and updated throughout the execution of a program
ANSWER: h
POINTS: 1
32. A statement in the code at which program execution enters break mode
ANSWER: e
POINTS: 1
34. Displays all local variables within the currently executing function, regardless of whether they have been initialized
ANSWER: g
POINTS: 1
35. Identifying lines you think maybe causing problems and transforming them into comments
ANSWER: j
POINTS: 1
38. Caused by incorrect use of JavaScript code or references to objects, methods, and variables that do not exist
ANSWER: a
POINTS: 1
40. A JavaScript program that contains only the code you are testing
ANSWER: d
POINTS: 1
41. What is the difference between syntax errors and run-time errors?
ANSWER: Run-time errors differ from syntax errors in that they do not necessarily represent JavaScript language
errors. Instead, run-time errors occur when the interpreter encounters code that it cannot execute. For
example, consider the statement createRecommendation();, which calls a custom JavaScript
function. This statement does not generate a syntax error, because it is legal (and usually necessary) to
create and then call custom functions in a JavaScript program. However, if your program includes the
call statement but does not include code that creates the function in the first place, your program
generates a run-time error. The error occurs when the interpreter attempts to call the function and is
unable to find it.
POINTS: 1
REFERENCES: 214
42. Briefly explain how to use comments to locate bugs with JavaScript.
ANSWER: Another method of locating bugs in a JavaScript program is to identify lines that you think may be
causing problems and transform them into comments. To do so, you simply add // to the start of a
single line, or /* to the start of a block and */ to the end of the block, just as you would to create any
other comment. This process is known as commenting out code. This technique can help you isolate a
particular statement that may be causing an error. In some cases, you may choose to comment out
individual lines that may be causing an error, or you may choose to comment out all lines except the
lines that you know work. When you first receive an error message, you can start by commenting out
only the statement specified by the line number in the error message. You can then save the document,
and then open it again in your browser to see if you receive another error. If you receive additional
error messages, you comment out those statements as well. Once you eliminate the error messages, you
can examine the commented out statements for the cause of the bug.
POINTS: 1
REFERENCES: 236
237
43. Explain the three stepping options found in the debugging tools in modern browsers.
Cengage Learning Testing, Powered by Cognero Page 7
Name: Class: Date:
ANSWER: The debugging tools in all three browsers include a set of alternative options known as stepping options,
which allow you to continue program execution after you enter break mode. The first, known as stepping
in or stepping into, executes an individual line of code and then pauses until you instruct the debugger to
continue. This feature gives you an opportunity to evaluate program flow and structure as code is being
executed.
As you use the Step Into button to move through code, the debuggers stop at each line within every
function of the JavaScript program. However, when stepping through a program to trace a logical error,
it is convenient to be able to skip functions that you know are functioning correctly. The second option,
known as stepping over, allows you to skip function calls. The program still executes each function that
you step over, but it appears in each debugger as if a single statement executes.
The final option, stepping out, executes all remaining code in the current function. If the current function
was called from another function, all remaining code in the current function executes and the debugger
stops at the next statement in the calling function.
POINTS: 1
REFERENCES: 251
POINTS: 1
REFERENCES: 259
260
46. Name two tools you can use to analyze your HTML code for errors, and describe how to use them for this task.
ANSWER: One tool is an editor specialized for web development, such as Notepad++, Aptana Studio, or
KomodoEdit. These editors, and others like them, automatically highlight syntax errors in HTML, CSS,
and JavaScript code as you type. This means that rather than needing to scrutinize each line of code, you
can count on the editor to draw your attention visually to any errors it identifies—often even before you
test your code.
Another tool for automatically examining your code is the W3C Markup Validation
Service (http://validator.w3.org). Many validation errors also cause problems in the browser, so
validating your HTML and fixing any issues the validator identifies can help you remove bugs in your
HTML code, while at the same time helping you ensure that your HTML works across browsers.
POINTS: 1
Cengage Learning Testing, Powered by Cognero Page 8
Name: Class: Date:
REFERENCES: 272
POINTS: 1
REFERENCES: 276
POINTS: 1
REFERENCES: 241
50. What is the difference between a variables list and a watch list in browser debugging tools?
ANSWER: The debugging tools in all browsers display lists of local variables within the currently
executing function, regardless of whether they have been initialized. The variables lists help you see how
different values in the currently executing function affect program execution. In addition, each browser
lets you create a watch list, which is a list of expressions whose values are displayed and updated
throughout the execution of the program.
POINTS: 1
REFERENCES: 253