Programming Ch. 7
Which of the following is not a check for data accuracy? Salary within the allowable range Time measurmetns ZIP codes in correct format and valid All of these are checks for data accuracy None of these
?
Which of the following is not an input validation error type? Empty input Incorrect data type Inaccurate data All of these are input validation error types None of these
All of these are input validation error types
The priming read is placed ________ the loop. Below Before Inside and below Inside and before Inside
Before
In addition to using loops to validate data, ________ can also be used to validate data. String function Real function Integer function Boolean function None of these
Boolean function
What type of function can be used to see if the password entered has the minimum number of characters? Mathematical Boolean String Trigonometric None ofthese
String
Which of the following statements is true about this Boolean expression? score < 0 AND score > 100 This expression is true for numbers between 0 and 100 This expression is true for numbers greater than 100 This expression is true for numbers less than 0 This expression would never be true None of these
This expression would never be true
An input validation loop is sometimes called an error handler. True or False
True
Checking for accuracy of data, even when the user provides the right type of data, is part of input validation. True or False
True
Often a Boolean function can be used to validate data. True or False
True
Programs should be designed such that all input is inspected before it is processed and bad data is discarded. True or False
True
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. True or False
True
The priming read is needed when a pretest loop is executed. True or False
True
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. True or False
True
Input ________ is commonly done with a loop that iterates as long as an input variable contains bad data. Check Validation Examination Priming None of these
Validation
Accepting February 29 in only a leap year is a check that is done by a ________ check. Date Day Month Calendar None of these
Day
Designing a program to avoid common errors is called ________ programming. Defensive Direct Defective Detective None of these
Defensive
________ happens when an input operation attempts to read data, but there is no data to read. No data Error reading Input error Empty input none of these
Empty Input
________ is sometimes the term used for input validation. Input error Error trap Input trap Data error None of these
Error trap
Checking for reasonableness of data is programmatically impossible. True or False
False
If the user provides bad data as input to a program, the program will correct the data and produce output. True or False
False
Input validation is not needed if the program is well designed. True or False
False
Most programming languages do not provide library functions that can be used for input validation. True or False
False
The empty read is not an obvious input error and is a difficult one to handle. True or False
False
What is the famous saying among computer programmers that refers to the fact that computers cannot tell the difference between good and bad data? Hint, Garbage
Garbage in, Garbage out
The purpose of the ________ is to get the first input value for the validation of a loop. GIGO Read Priming read Write None of these
Priming read
What is the first step to use in detecting data type mismatch errors? Read the input as a string Convert to the desired data type Determine whether it can be converted Display error message None of these
Read the input as a string
If, when asked for a date of birth, the user enters a future date, this error should be caught by a ________ check. Date Time Day Reasonableness None of these
Reasonableness
Which of the following library functions could be used to validate that the correct data type was input for an amount of money? isInteger isString toLower isReal All of these
isReal
Which of the following library functions could be used to validate the length of a string? random isString length toUpper None of these
length
Which of the following library functions could be used to simplify the process of string validation? length toUpper isReal isInteger None of these
toUpper