Deck 9: Menus and Data Validation
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
Play
Full screen (f)
Deck 9: Menus and Data Validation
1
Programs that can handle all kinds of user errors, without allowing damage, and can do it immediately, correctly, and smoothly, are called robust.
False
2
Programs that can handle all kinds of user errors are called elegant.
False
3
A common acronym in the computer field is GIGO, standing for "going in, going out."
False
4
A menu system limits the choices a user can make so that only valid options are processed.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
When prompting users to enter a character, you should allow uppercase or lowercase input.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
When you use a menu system, the most common model is a menu that stays onscreen to use repeatedly, instead of a menu that allows users to make only one choice.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
When creating a menu system, you should display an error message, as a form of data validation, if the user does not enter a valid choice (including the exit choice).
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
To create a menu that is used more than once, a repetition structure that encloses the selection structure is more suitable, and you can also add a choice for the user to exit the menu.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
Consistency is important for good programming design and readability.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
In JavaScript, functions are listed second, in the <body> section of HTML.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
When modules and functions are used as menu-processing choices, you can design a menu system easily by using the top-down method of program design.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
The Case structure is a variation of the If/Else structure.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
Text data (data of the String type) consists of almost anything the user can type at the keyboard.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
isNumeric(str) is a string manipulation function.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
isLetter(str) is a string manipulation function.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
JavaScript converts a number to a string format automatically if the number needs to be displayed as text.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
Function calls start with the function name and are followed by the arguments (which can be constants or variables) in parentheses.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
Method calls start with the method name and are followed by a dot, the object name, and parentheses for enclosing arguments.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
In JavaScript, strings are not considered objects.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
In some programming languages, when a user presses Enter without typing anything, the input variable's value is set to a constant called NULL.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
Typical exception types are "invalid format" and "attempted division by zero."
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
In a do-while loop, the closing brace is followed by the keyword end, the condition, and a semicolon.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
In JavaScript, conditions are enclosed in parentheses.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
Keywords (such as if, else, do, and while) are uppercase in JavaScript.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
One way to validate an e-mail address is to see whether the character @ occurs in the string.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
____ is a method in which data is processed noninteractively, requiring prior data validation.
A) Exception handling
B) Batch processing
C) Validation looping
D) Interactive processing
A) Exception handling
B) Batch processing
C) Validation looping
D) Interactive processing
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
Transaction processing is done immediately, so it is referred to as ____.
A) batch processing
B) coupling
C) short-circuit evaluation
D) interactive processing
A) batch processing
B) coupling
C) short-circuit evaluation
D) interactive processing
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
Interactive processing is also known as ____.
A) batch processing
B) coupling
C) short-circuit evaluation
D) real-time processing
A) batch processing
B) coupling
C) short-circuit evaluation
D) real-time processing
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
A(n) ____ is a pop-up box that requires the user to click OK before proceeding.
A) blue box
B) submenu
C) alert box
D) black box
A) blue box
B) submenu
C) alert box
D) black box
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
In JavaScript, constants are declared in the ____ section before any function definitions so that they're available to the ____ section.
A) <h2>, <h2>
B) <head>, <head>
C) <body>, <body>
D) <form>, <form>
A) <h2>, <h2>
B) <head>, <head>
C) <body>, <body>
D) <form>, <form>
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
In JavaScript, the toUpperCase() function is called by using the ____ format.
A) object.method()
B) alert.object()
C) object.parameter()
D) var.object()
A) object.method()
B) alert.object()
C) object.parameter()
D) var.object()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
A module is sometimes called a ____ because those looking at the module do not need to know what it contains internally, as long as they know the module's purpose and how to use it.
A) blue box
B) red box
C) white box
D) black box
A) blue box
B) red box
C) white box
D) black box
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
A(n) ____ serves as a placeholder in your program until you develop the code.
A) stub
B) array
C) decision table
D) subscript
A) stub
B) array
C) decision table
D) subscript
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
A(n) ____ enables you to test your program so that you can make sure the module is called correctly.
A) stub
B) decision table
C) array
D) subscript
A) stub
B) decision table
C) array
D) subscript
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
A(n) ____ is a loop that checks for valid input and repeats until valid input has been entered.
A) indeterminate loop
B) posttest loop
C) validation loop
D) pretest loop
A) indeterminate loop
B) posttest loop
C) validation loop
D) pretest loop
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
Functions that operate on strings are called ____.
A) validation functions
B) exceptions
C) multilevel functions
D) string manipulation functions
A) validation functions
B) exceptions
C) multilevel functions
D) string manipulation functions
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
The function ____ returns True if the text can be converted to a number.
A) isNumeric(str)
B) numberToString(num)
C) isLetter(str)
D) stringToNumber(str)
A) isNumeric(str)
B) numberToString(num)
C) isLetter(str)
D) stringToNumber(str)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
JavaScript has a function called ____ that returns a True value if a string cannot be converted to a number.
A) isNumeric(str)
B) isNaN()
C) numberToString(num)
D) isLetter(str)
A) isNumeric(str)
B) isNaN()
C) numberToString(num)
D) isLetter(str)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
The ____ returns the number of characters in a string.
A) isNaN()
B) numChars(str)
C) number(str)
D) length(str)
A) isNaN()
B) numChars(str)
C) number(str)
D) length(str)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
The ____ returns a substring of the original string, starting with the position specified by the start argument and including the number of characters specified by numChars.
A) isNaN()
B) substring(str, start, numChars)
C) isNaN().
D) length(str)
A) isNaN()
B) substring(str, start, numChars)
C) isNaN().
D) length(str)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
You can use string manipulation functions to check every character in a string, a process sometimes called ____ a string.
A) traversing
B) interactive processing
C) batch processing
D) exception handling
A) traversing
B) interactive processing
C) batch processing
D) exception handling
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
In object-oriented programming, ____ is a method that allows for errors to be detected without having to write error-checking code at every point of input.
A) exception handling
B) batch processing
C) interactive processing
D) string manipulation
A) exception handling
B) batch processing
C) interactive processing
D) string manipulation
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
In JavaScript, the ____ statement should be accompanied by an error message, which is not enclosed in parentheses.
A) throw
B) case
C) try
D) catch
A) throw
B) case
C) try
D) catch
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
In JavaScript, the ____ block checks to see what the error message is before proceeding.
A) throw
B) case
C) try
D) catch
A) throw
B) case
C) try
D) catch
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
A(n) ____ presents a main menu, and then leads users to submenus.
A) black box
B) object
C) multilevel menu
D) alert box
A) black box
B) object
C) multilevel menu
D) alert box
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
A(n) ____ can be designed without using modules, but top-down design is easier when you use modules as a starting point for designing a menu.
A) black box
B) object
C) multilevel menu
D) alert box
A) black box
B) object
C) multilevel menu
D) alert box
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
A graphical tool called a(n) ____ can help you keep track of which modules call other modules.
A) UML diagram
B) hierarchy chart
C) decision table
D) flowchart
A) UML diagram
B) hierarchy chart
C) decision table
D) flowchart
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
A(n) ____ is useful for seeing a program's overall structure as well as providing a guide for making changes.
A) decision table
B) UML diagram
C) hierarchy chart
D) flowchart
A) decision table
B) UML diagram
C) hierarchy chart
D) flowchart
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49

-The accompanying diagram is known as a ____.
A) hierarchy chart
B) truth table
C) decision table
D) flowchart
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
JavaScript has a built-in method, ____, that takes a character as an argument and returns the position in a string where the character occurs or -1 if the character isn't found.
A) isNaN()
B) indexOf()
C) isNumeric(str)
D) length(str)
A) isNaN()
B) indexOf()
C) isNumeric(str)
D) length(str)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck