1/78
Final Exam Review
A _______________ expression has one of two values: true or false.
Boolean
A trivial Boolean expression is one that _______________.
always has the same value |
In a selection, the statements in an else clause execute _______________.
when the tested condition is false
An expression that uses a greater-than operator evaluates as true when _______________.
the left operand is greater than the right operand
When you use a range check, you always compare a variable to _______________ value in the range.
either the lowest or highest
The structure that allows you to write one set of instructions that operates on multiple, separate sets of data is the _______________.
loop
The loop that frequently appears in a program's mainline logic _______________.
works correctly based on the same logic as other loops
Which of the following is not a step that must occur with every correctly working loop?
Set the loop control value equal to a sentinel during each iteration.
The statements executed within a loop are known collectively as the _______________.
loop body
A counter keeps track of _______________.
the number of times an event has occurred
Adding 1 to a variable is also called _______________ it.
incrementing
Which of the following is a definite loop?
a loop that executes 1,000 times
Which of the following is an indefinite loop?
a loop that asks the user whether to continue during each iteration
When two loops are nested, the loop that is contained by the other is the _______________ loop
inner
When loops are nested, _______________.
the inner loop ends before the outer loop
Most programmers use a for loop _______________.
when they know the exact number of times a loop will repeat
A report that lists only totals, with no details about individual records, is a(n) _______________ report.
summary
Typically, the value added to a counter variable is
1
Typically, the value added to an accumulator variable is
different in each iteration
After an accumulator or counter variable is displayed at the end of a program, it is best to
do nothing to the variable's value
When you _______________, you make sure data items are the correct type and fall within the correct range.
validate data
Overriding a user's entered value by setting it to a predetermined value is known as
forcing
To ensure that a user's entry is the correct data type, frequently you
use a module built into the programming language
A variable cannot hold an incorrect value when it is
A variable might always hold an incorrect value.
A do-while loop _______________.
can be replaced by a sequence and a while loop
A subscript is a(n)
number that indicates the position of an array element
Each element in an array must have the same _______________as the others.
data type
Suppose that you have declared a numeric array named values that has 13 elements. Which of the following must be true?
values[13] is out of bounds
The subscripts of any array are always
integers
Suppose that you have declared a numeric array named numbers, and two of its elements are numbers[1] and numbers[4]. You know that _______________.
there are exactly two elements between those two elements
Suppose that you have declared a numeric array named numbers, and two of its elements are numbers[1] and numbers[4]. You know that _______________.
the array has at least five elements
A program contains a seven-element array that holds the names of the days of the week. At the start of the program, you display the day names using a subscript named dayNum. You display the same array values again at the end of the program, where you _______________ as a subscript to the array.
can use dayNum, but can also use another numeric value
Filling an array with values during a program's execution is known as _______________ the array.
populating
A _______________ is a variable that can be set to indicate whether some event has occurred.
flag
Two arrays in which each element in one array is associated with the element in the same relative position are _______________.
parallel
In most modern programming languages, the highest subscript you should use with a 12-element array is
11
The values stored in parallel arrays
frequently have an indirect relationship
Each element in a seven-element array can hold _______________ value(s).
one
When you use a subscript value that is negative or higher than the number of elements in an array, _______________.
the resulting action depends on the programming language used
In every array, a subscript is out of bounds when it is
negative
You can access every element of an array using
either a while loop or a for loop
Random access memory is _
volatile
Text files usually contain __
data that can be read in a text editor
Every file on a storage device
has a size
Which of the following is true regarding the data hierarchy?
Files contain records
The process of _______________ a file locates it on a storage device and associates a variable name within your program with the file.
opening
When you write to a file, you
copy data from memory to a storage device
Unlike when you print a report or display information on a screen, when a program's output is a data file, you do not
include explanations or formatting such as dollar signs
When you close a file, it _
is no longer available to the program
A file in which records are stored one after another in order based on the contents of a field is a(n) _______________ file.
sequential
When you combine two or more sorted files while maintaining their sequential order based on a field, you are _______________ the files.
merging
A control break occurs when a program
pauses to perform special processing based on the value of a field
Which of the following is an example of a control break report?
. a list of all customers of a business in zip code order, with a count of the number of customers who reside in each zip code
A control break field _______________.
causes special processing to occur
Whenever a control break occurs during record processing in any control break program, you must _______________.
update the value in the control break field
When you merge records from two or more sequential files, the usual case is that the records in the files
have the same format
A file that holds more permanent data than a transaction file is a(n) _______________ file.
primary
A transaction file is often used to _______________ another file.
update
The saved version of a file that does not contain the most recently applied transactions is known as a _______________ file.
parent
Random access files are used most frequently in all of the following except _______________.
batch processing
Employee records stored in order from highest-paid to lowest-paid have been sorted in _______________ order.
descending
Student records stored in alphabetical order by last name have been sorted in _______________ order.
ascending
When computers sort data, they always _______________.
use numeric values when making comparisons
Which type of sort compares list items in pairs, swapping any two adjacent values that are out of order?
bubble sort
To sort a list of 15 values using a bubble sort, the greatest number of times you would have to pass through the list making comparisons is
14
To completely sort a list of 10 values using a bubble sort, the greatest possible number of required pair comparisons is
81
When you do not know how many items need to be sorted in a program, you can create an array that has _______________.
at least as many elements as the number you predict you will need
In a bubble sort, on each pass through the list that must be sorted, you can stop making pair comparisons
one comparison sooner
When performing a bubble sort on a list of 10 values, you can stop making passes through the list of values as soon as _______________ on a single pass through the list.
no swaps are made
The bubble sort is _______________.
a relatively easy sort to understand
Data stored in a table that can be accessed using row and column numbers is stored as a _______________ array.
two-dimensional
A two-dimensional array declared as num myArray[6][7] has _______________ columns.
7
In a two-dimensional array declared as num myArray[6][7], the highest row number is
5
If you access a two-dimensional array with the expression output myArray[2][5], the output value will be
impossible to tell from the information given
Three-dimensional arrays
are supported in many modern programming languages
Student records are stored in ID number order but accessed by grade-point average for a report. In this example, grade-point average order is a(n) _______________ order.
logical
When you store a list of key fields paired with the storage address for the corresponding data record, you are creating
an index
When a record in an indexed file is not needed for further processing, _______________.
the record can stay in place physically, but its reference is removed from the index
With a linked list, every record _______________.
contains a field that holds the address of another record