CMIN 203 (Chapters 6,7,8 & 9)
When a loop rejects any input except the strings "yes" and "no" then it is performing a case-________ comparison.
sensitive
The ________ function accepts an argument and returns the square root of the argument.
sqrt
The ________ function does the same thing as using the mathematical ^ operator.
sqrt
A function is a group of ________ that perform a specific task.
statements
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.
time measurement
Which of the following library functions could be used to simplify the process of string validation?
toUpper
After the string is read it is determined if it can be converted to the desired data type in a ________ error.
type mismatch
When ________ data is entered by the user, the program should at least ask the user to confirm that he or she intended to enter it.
unreasonable
Which of the following statements is true after the execution of the following statement? y = abs(x)
y contains the absolute value of the value in x
In programming, the characters in a string are each identified by its position number, and the first character is in position number ________.
zero
The variable r would contain the value ________ after the execution of the following statement. Declare Integer i = 12 Declare Real r Set r = toReal (i)
12.0
Most programming languages allow you to write ________ functions, which return either True or False.
Boolean
Using a ________ function many times would simplify the long compound Boolean expression that is used by a validation loop.
Boolean
In addition to using loops to validate data, ________ can also be used to validate data.
Boolean Function
Which function accepts two strings as arguments, returns "True" if the first string contains the second string, and otherwise returns "False"?
Contains
Accepting February 29 in only a leap year is a check that is done by a ________ check.
Date
Designing a program to avoid common errors is called ________ programming.
Defensive
________ programming is the practice of anticipating errors that can happen while a program is running.
Defensive
________ happens when an input operation attempts to read data, but there is no data to read.
Empty input
________ is sometimes the term used for input validation.
Error trap
True/False: Checking for reasonableness of data is programmatically impossible.
False
True/False: If the user provides bad data as input to a program, the program will correct the data and produce output.
False
True/False: Input validation is not needed if the program is well designed.
False
True/False: Most programming languages do not provide library functions that can be used for input validation.
False
True/False: One of the advantages of two- or more dimensional arrays is that the data values can be of two or more data types.
False
True/False: Programming languages have not yet started to support localization.
False
True/False: The empty read is not an obvious input error and is a difficult one to handle.
False
True/False: The input column in the IPO chart describes the process the function performs on the input data.
False
True/False: The library functions in every programming language have the same function names and accept the same arguments, but their behaviors might differ slightly.
False
True/False: The number of arguments that can be passed to a function are limited in most programming languages.
False
True/False: The toInteger function accepts a real number as its argument and preserves any fractional part in the returned number.
False
A ________ is a module that returns a value back to the part of the program that called it.
Function
The acronym ________ is used by programmers to refer to the fact that computers cannot tell difference between good and bad data.
GIGO
What is the famous saying among computer programmers that refers to the fact that computers cannot tell the difference between good and bad data?
Garbage in, garbage out
The function ________ specifies the return data type, name of the function, and the parameter variable(s).
Header
The ________ chart is a tool that programmers use when designing functions.
IPO
The ________ function accepts two strings as arguments and returns a third string that is created by appending the second string to the end of the first string.
append
Examine the following piece of code and determine the data type of the function's return value. Function Real sum (Integer num1, Integer num2) Declare Integer result Set result = num1 + num2 Return result End Function
Real
If, when asked for a date of birth, the user enters a future date, this error should be caught by a ________ check.
Reasonableness
One of the statements in the function body must be a(n) ________ statement.
Return
What term is used in the ending terminal symbol of a function flowchart?
Return
What is the term used for the number inside the bracket that specifies the number of values that an array can hold?
Size declarator
What type of function can be used to see if the password entered has the minimum number of characters?
String
Which function returns a string within a string?
Substring
Because you do not see the internal workings of library functions, many programmers think of them as ________.
black boxes
The process of appending one string to the end of another string is called ________.
concatenation
True/False: The parameter list that accepts arguments is optional in a function definition.
True
True/False: 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
True/False: The priming read is needed when a pretest loop is executed.
True
True/False: The value that is returned from a function can be used just like any other value.
True
True/False: When a function finishes, it returns a value back to the part of the program that called it.
True
True/False: 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
Which of the following errors occur when a real value is attempted to be assigned to an integer variable?
Type mismatch
Input ________ is commonly done with a loop that iterates as long as an input variable contains bad data.
Validation
All the values in an array must be of the same ________.
data type
You should design your programs in such a way that bad ________ is never accepted.
input
An input validation that accepts strings in mixed case would have incorporated a case- ________ string comparison operation.
insensitive
The ________ function can be used to determine whether a string can be converted to an integer.
isInteger
To validate if the input data is a valid integer, use the ________ library function.
isInteger
Which of the following library functions could be used to validate that the correct data type was input for an amount of money?
isReal
The ________ function accepts a string as its argument and returns the number of characters in the string.
length
The string ________ function plays a role in the string's validity when a minimum number of characters are required to be entered.
length
Which of the following library functions could be used to validate the length of a string?
length
There can be only ________ return value from a function to the called module.
one
The ________ column describes the data that is returned from the function in an IPO chart.
output
When the user enters a U.S. Address, the value entered as the ________ should be checked to verify that it is both valid and in the correct format.
ZIP code
In a flowchart of a function, the starting terminal symbol states the name of the function, along with any ________ that the function has.
parameters
A ________ loop could be used to validate input instead of using the priming read.
posttest
Programs that contain a priming read have a ________ loop.
pretest
The input operation that is performed just before a validation loop is known as the ________.
priming read
Examine the following piece of code and state the return value of the function. Function Integer product (Integer num1, Integer num2) Declare Real result Set result = num1 + num2 Return result End Function
result
A(n) ________ statement specifies the value that is returned from the function when the function ends.
return
Random numbers are commonly used in which type of program?
All of the above
Which of the following statements is true after the execution of the following statement? Set needANumber = random(5, 10)
All of the above
Which of the following is not a check for data accuracy?
All of the above are checks for data accuracy
Which of the following is not an input validation error type?
All of the above are input validation error types
The priming read is placed ________ the loop.
Before
The term ________ is used to describe any mechanism that accepts input, performs some operation that cannot be seen on the input, and produces output.
Black box
The function ________ comprises one or more statements that are executed when the function is called.
Body
In the IPO chart, the ________ column describes the data that is passed to the function as arguments.
Input
What is the data type of the value returned by the random library function?
Integer
________ is the process where a program can be configured for a specific country.
Localization
Which of the following is optional when writing a function definition?
None of the above
The purpose of the ________ is to get the first input value for the validation of a loop.
Priming read
What is the first step to use in detecting data type mismatch errors?
Read the input as a string
Which of the following statements is true about this Boolean expression? score < 0 AND score > 100
This expression would never be true.
True/False: An input validation loop is sometimes called an error handler.
True
True/False: Checking for accuracy of data, even when the user provides the right type of data, is part of input validation.
True
True/False: Library functions are built into the programming language, and can be called any time they are needed.
True
True/False: Most programming languages let you assign an integer value to a real variable without causing an error.
True
True/False: Often a Boolean function can be used to validate data.
True
True/False: Programs should be designed such that all input is inspected before it is processed and bad data is discarded.
True
True/False: Random numbers are useful in simulation programs where the computer must randomly decide how an object will behave.
True
True/False: Subscripts are used to identify specific elements in an array.
True
True/False: The first step in calculating the average of the values in an array is to get the total of the values.
True
True/False: The function body follows the function header in a function definition.
True
The ________ occurs when the user presses the enter key without typing a value for an input operation.
empty input
When a function is called, it is ________.
executed
An error trap can be performed by a(n) ________ validation loop.
input
The integrity of a program's output is only as good as the integrity of the program's ________.
input