Deck 7: Input 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
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/44
Play
Full screen (f)
Deck 7: Input Validation
1
Which of the following statements is true about this Boolean expression?
Score < 0 AND score > 100
A)This expression is true for numbers between 0 and 100.
B)This expression is true for numbers greater than 100.
C)This expression is true for numbers less than 0.
D)This expression would never be true.
E)None of the above
Score < 0 AND score > 100
A)This expression is true for numbers between 0 and 100.
B)This expression is true for numbers greater than 100.
C)This expression is true for numbers less than 0.
D)This expression would never be true.
E)None of the above
D
2
The purpose of the __________ is to get the first input value for the validation of a loop.
A)GIGO
B)Read
C)Priming read
D)Write
E)None of the above
A)GIGO
B)Read
C)Priming read
D)Write
E)None of the above
C
3
Input ______________ is commonly done with a loop that iterates as long as an input variable contains bad data.
A)Check
B)Validation
C)Examination
D)Priming
E)None of the above
A)Check
B)Validation
C)Examination
D)Priming
E)None of the above
B
4
What is the first step to use in detecting data type mismatch errors?
A)Read the input as a string
B)Convert to the desired data type
C)Determine whether it can be converted
D)Display error message
E)None of the above
A)Read the input as a string
B)Convert to the desired data type
C)Determine whether it can be converted
D)Display error message
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
5
Accepting February 29 in only a leap year is a check that is done by a ___________ check.
A)Date
B)Day
C)Month
D)Calendar
E)None of the above
A)Date
B)Day
C)Month
D)Calendar
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
6
Which of the following library functions could be used to validate that the correct data type was input for an amount of money?
A)isInteger
B)isString
C)toLower
D)isReal
E)All of the above
A)isInteger
B)isString
C)toLower
D)isReal
E)All of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
7
What is the famous saying among computer programmers that refers to the fact that computers cannot tell the difference between good and bad data?
A)Garbage input, garbage output
B)Garbage in, garbage out
C)Garbage output is from garbage inputted
D)Garbage out is from garbage in
E)None of the above
A)Garbage input, garbage output
B)Garbage in, garbage out
C)Garbage output is from garbage inputted
D)Garbage out is from garbage in
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
8
What type of function can be used to see if the password entered has the minimum number of characters?
A)Mathematical
B)Boolean
C)String
D)Trigonometric
E)None of the above
A)Mathematical
B)Boolean
C)String
D)Trigonometric
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
9
If,when asked for a date of birth,the user enters a future date,this error should be caught by a ____________ check.
A)Date
B)Time
C)Day
D)Reasonableness
E)None of the above
A)Date
B)Time
C)Day
D)Reasonableness
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
10
The priming read is placed _________ the loop.
A)Inside
B)Before
C)Below
D)Inside and before
E)Inside and below
A)Inside
B)Before
C)Below
D)Inside and before
E)Inside and below
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
11
Which of the following is not a check for data accuracy?
A)Salary within the allowable range
B)Time measurements
C)ZIP codes in correct format and valid
D)All of the above are checks for data accuracy
E)None of the above
A)Salary within the allowable range
B)Time measurements
C)ZIP codes in correct format and valid
D)All of the above are checks for data accuracy
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
12
If the user provides bad data as input to a program,the program will correct the data and produce output.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
13
In addition to using loops to validate data,_____________ can also be used to validate data.
A)String Function
B)Real Function
C)Integer Function
D)Boolean Function
E)None of the above
A)String Function
B)Real Function
C)Integer Function
D)Boolean Function
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
14
Which of the following library functions could be used to simplify the process of string validation?
A)length
B)toUpper
C)isReal
D)isInteger
E)None of the above
A)length
B)toUpper
C)isReal
D)isInteger
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
15
_______________ happens when an input operation attempts to read data,but there is no data to read.
A)No data
B)Error reading
C)Input error
D)Empty input
E)None of the above
A)No data
B)Error reading
C)Input error
D)Empty input
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following is not an input validation error type?
A)Empty input
B)Incorrect data type
C)Inaccurate data
D)All of the above are input validation error types
E)None of the above
A)Empty input
B)Incorrect data type
C)Inaccurate data
D)All of the above are input validation error types
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
17
Designing a program to avoid common errors is called _________________ programming.
A)Defensive
B)Direct
C)Defective
D)Detective
E)None of the above
A)Defensive
B)Direct
C)Defective
D)Detective
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
18
_______________ is sometimes the term used for input validation.
A)Input error
B)Error trap
C)Input trap
D)Data error
E)None of the above
A)Input error
B)Error trap
C)Input trap
D)Data error
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
19
An input validation loop is sometimes called an error handler.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
20
Which of the following library functions could be used to validate the length of a string?
A)random
B)isString
C)length
D)toUpper
E)None of the above
A)random
B)isString
C)length
D)toUpper
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
21
The practice of anticipating errors that can happen while a program is running and designing the program to avoid those errors is called defensive programming.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
22
An error trap can be performed by a(n)____________________ validation loop.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
23
Using a ________________ function many times would simplify the long compound Boolean expression that is used by a validation loop.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
24
Often a Boolean function can be used to validate data.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
25
Programs should be designed such that all input is inspected before it is processed and bad data is discarded.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
26
Checking for accuracy of data,even when the user provides the right type of data,is part of input validation.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
27
Input validation is not needed if the program is well designed.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
28
__________ programming is the practice of anticipating errors that can happen while a program is running.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
29
A _________ loop could be used to validate input instead of using the priming read.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
30
The _________________ occurs when the user presses the enter key without typing a value for an input operation.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
31
When using string input validation it is wise to use the library function to convert the input to upper case or lowercase so case-sensitive string comparisons can be made.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
32
Most programming languages do not provide library functions that can be used for input validation.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
33
An input validation that accepts strings in mixed case would have incorporated a case- __________ string comparison operation.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
34
The string _________ function plays a role in the string's validity when a minimum number of characters are required to be entered.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
35
To validate if the input data is a valid integer,use the __________ library function.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
36
The acronym ___________ is used by programmers to refer to the fact that computers cannot tell difference between good and bad data.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
37
Checking for reasonableness of data is programmatically impossible.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
38
The empty read is not an obvious input error and is a difficult one to handle.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
39
The input operation that is performed just before a validation loop is known as the _________.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
40
The priming read is needed when a pretest loop is executed.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
41
Programs that contain a priming read have a _________ loop.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
42
When a loop rejects any input except the strings "yes" and "no" then it is performing a case-___________ comparison.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
43
When a payroll program verifies that no value greater than 168 is entered for the number of hours worked in a week,it is performing a ___________________ check.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
44
After the string is read it is determined if it can be converted to the desired data type in a _____________ error.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck