Final-Quizes7,8,9,10 Flashcards
textbook chapters 6,7,10, & 14
(7)An input validation loop is sometimes called an ERROR HANDLER(T/F)
True
(7)If a user is asked to enter the number of widgets he or she wants to buy and enters “two”, the program will automatically change the entry to an integer(T/F)
False
(7) If a user is asked to enter the number of widgets he or she wants to buy, the ISINTEGER function can be used to validate this input.(T/F)
True
(7)Programs should be designed to inspect all input before processing that input.(T/F)
True
(7)A priming read is needed when a pretest loop is executed.(T/F)
True
(7) A Boolean function can often be used to validate data(T/F)
True
(7) The most difficult input error to validate is an empty read.(T/F)
False
(7) Defensive programming is the practice of anticipating errors that an happen while a program is running and designing the program to catch and deal with those errors.(T/F)
True
(7) Checking for the accuracy of data, even when the user provides valid input, is part of input validation.(T/F)
True
(7) Checking that input data is reasonable is programmatically impossible.(T/F)
False
(7) Input validation is not needed if the program is well designed.(T/F)
False
(7) A programmer is not permitted to use library functions for input validation.(T/F)
False
(7) What do computer programmers say about the fact that computer can’t tell the difference between good and bad data?
Garbage in, Garbage out
(7-14) The purpose of _________ is to get the first input value for the validation of a loop.
The priming read
(7-15)Designing a program to avoid common errors is called ______________ programming.
defensive
(7)Input __________ is commonly done with a loop that iterates as long as an input variable contains bad data.
validation
(7)A(n) ____________ is another term for input validation.
Error Trap
(7) The priming read is placed __________ the loop.
before
If the user, when asked for his/her date of birth, enters a date in the future, this error should be caught by a ________________ check.
A) date
B) time
C) reasonableness
C) reasonableness
Accepting February 29 for input only in a leap year is a check that should be caught by a ____________ check.
A) date
B) time
C) reasonableness
A) date
(7)Which function could be used to validate an entry for a user’s chosen name that must be between 4 and 12 characters?
legnth
(7-22) Which function could be used to validate that the correct data type was input for an amount of money?
A)isReal
B)isString
C)Legnth
A)isReal
(7) which function could be used to simplify the process of string validation?
A)isReal
B)isString
C)toLower
C) toLower
(7) What would display if the following statements are coded and executed and the user enters 3 twice at the prompts?
Display “Enter your age:”
Input age
Do
Display “Impossible! Enter an age greater than 0:”
Input age
While age <=0
Display “Thank you”
A) Impossible! Enter an age greater than 0:
B) Thank you.
Impossible! Enter an age greater than 0:
C) Impossible! Enter an age greater than 0:
Thank you.
C) Impossible! Enter an age greater than 0:
Thank you.