Preview (3 of 10 pages)

Chapter 8: Advanced Data Handling Concepts
TRUE/FALSE
1. The sorting process is usually reserved for a relatively large number of data items.
Answer: False
2. The most popular computer coding schemes include ASCII, Numeric, and EBCDIC.
Answer: False
3. You can make additional improvements to a bubble sort to reduce unnecessary
comparisons.
Answer: True
4. An insertion sort is another name for a bubble sort.
Answer: False
5. Two-dimensional arrays are never actually required in order to achieve a useful program.
Answer: True
6. Some programming languages allow multidimensional arrays.
Answer: True
7. It is relatively easy for people to keep track of arrays with more than three dimensions.
Answer: False
8. You do not need to determine a record’s exact physical address in order to use it.
Answer: True
9. When a record is removed from an indexed file, it has to be physically removed.
Answer: False
10. Every time you add a new record to a linked list, you search through the list for the
correct logical location of the new record.
Answer: True
MULTIPLE CHOICE
1. When records are in ____ order, they are arranged one after another on the basis of the
value in a particular field.
a. random
b. sequential
c. binary
d. incremental

Answer: B
2. The ____ is often used as a statistic in many cases because it represents a more typical
case.
a. mode
b. mean
c. average
d. median
Answer: D
3. The ____ is skewed by a few very high or low values.
a. mode
b. median
c. mean
d. standard deviation
Answer: C
4. When you store data records, they exist in ____.
a. some type of order
b. the reverse order from how they were entered
c. the same default ordering for all systems
d. ascending order
Answer: A
5. When you create a ____ report, the records must have been sorted in order by a key field.
a. summary
b. control break
c. detail
d. totals
Answer: B
6. When computers sort data, they always use ____ values when making comparisons
between values.
a. numeric
b. alphanumeric
c. alphabetic

d. ascending
Answer: A
7. Because “A” is always less than “B”, alphabetic sorts are ____ sorts.
a. descending
b. reversing
c. ascending
d. downward
Answer: C
8. In a ____, items in a list are compared with each other in pairs.
a. quick sort
b. shell sort
c. bubble sort
d. matrix sort
Answer: C
9. When you learn a method like sorting, programmers say you are learning a(n) ____.
a. matrix
b. addressed location
c. algorithm
d. linked list
Answer: C
10. To correctly swap two values, you create a(n) ____ variable to hold one of the values.
a. per-swap
b. inversion
c. conversion
d. temporary
Answer: D
11. A bubble sort is sometimes called a ____.
a. dropping sort
b. sinking sort
c. compare sort

d. pair sort
Answer: B
12. When using a bubble sort to sort a 10-element array, on the fourth pass through the array
list you detect that no swap has occurred. This indicates ____.
a. the elements in the array were badly out of order
b. all elements in the array are already in the correct order
c. you must make one more pass through the array
d. you must make a total of 10 passes through the array
Answer: B
13. When you sort records, two possible approaches are to place related data items in parallel
arrays and to ____.
a. sort records as a whole
b. sort fields in records individually
c. place unrelated data items in parallel arrays
d. sort data in spreadsheets
Answer: A
14. In a(n) ____, if an element is out of order relative to any of the items earlier in the list,
you move each earlier item down one position and then insert the tested element.
a. selection sort
b. bubble sort
c. sync sort
d. insertion sort
Answer: D
15. An array whose elements you can access using a single subscript is a ____ array.
a. one-dimensional
b. multi-dimensional
c. non-dimensional
d. single-dimensional
Answer: A
16. A two-dimensional array contains two dimensions: ____.
a. size and scope

b. breadth and height
c. height and width
d. depth and width
Answer: C
17. Each element in a two-dimensional array requires ____ subscript(s) to reference it.
a. one
b. two
c. three
d. four
Answer: B
18. When mathematicians use a two-dimensional array, they often call it a ____ or a table.
a. vector
b. matrix
c. square
d. grid
Answer: B
19. ____ are arrays that have more than one dimension.
a. Multidimensional arrays
b. One-dimensional arrays
c. Diverse dimensioned arrays
d. Unary dimensional arrays
Answer: A
20. A record’s ____ field is the field whose contents make the record unique among all
records in a file.
a. primary
b. column
c. secondary
d. key
Answer: D
21. As pages in a book have numbers, computer memory and storage locations have ____.
a. positions

b. pointers
c. addresses
d. references
Answer: C
22. When you ____ records, you store a list of key fields paired with the storage address for
the corresponding data record.
a. store
b. tab
c. reference
d. index
Answer: D
23. When you use an index, you can store records on a ____ storage device.
a. linear-access
b. random-access
c. sequential-access
d. uniform-access
Answer: B
24. One way to access records in a desired order, even though they might not be physically
stored in that order, is to create a(n) ____.
a. linked list
b. array
c. matrix
d. table
Answer: A
25. Every time you add a new record to a linked list, you search through the list for the
correct ____ location of the new record.
a. physical
b. spatial
c. logical
d. key
Answer: C

COMPLETION
1. When you ____________________ values stored in two variables, you exchange their
values.
Answer: swap
2. A(n) ____________________ is a list of instructions that accomplishes a task.
Answer: algorithm
3. If you are performing a(n) ____________________ sort, then after you have made one
pass through the list, the largest value is guaranteed to be in its correct final position at the
bottom of the list.
Answer: ascending
4. A common method of accessing records in logical order is to use a(n)
____________________.
Answer: index
linked list
5. In its simplest form, creating a(n) ____________________ list involves creating one extra
field in every record of stored data.
Answer: linked
MATCHING
Match each term with a statement below.
1. Arranging records one after another based on the value in a particular field a. physical
order
2. Arranging records from lowest to highest value within a field b. ascending order
3. Arranging records from highest to lowest value within a field c. table
4. The value of the middle item when the values are listed in order d. mean
5. The arithmetic average e. descending order
6. Algorithm f. logical order
7. A two-dimensional array g. sequential order
8. A “real” order for storage h. a list of instructions that accomplish a task
9. A virtual order based on any criterion you choose i. median
10. Used to identify computer memory and storage locations j. addresses
1. Answer: G
2. Answer: B

3. Answer: E
4. Answer: I
5. Answer: D
6. Answer: H
7. Answer: C
8. Answer: A
9. Answer: F
10. Answer: J
SHORT ANSWER
1. Give an example of an occasion when you would need to sort records.
Answer: A college stores students’ records in ascending order by student ID number, but the
registrar wants to view the data in descending order by credit hours earned so he can contact
students who are close to graduation.
A department store maintains customer records in ascending order by customer number, but
at the end of a billing period, the credit manager wants to contact customers whose balances
are 90 or more days overdue. The manager wants to list these overdue customers in
descending order by the amount owed, so the customers with the largest debt can be
contacted first.
A sales manager keeps records for her salespeople in alphabetical order by last name, but
needs to list the annual sales figure for each salesperson so she can determine the median
annual sale amount.
2. Why might you never need to write a program that sorts data as a professional
programmer?
Answer: As a professional programmer, you might never have to write a program that sorts
data because organizations can purchase prewritten, or “canned,” sorting programs.
Additionally, many popular language compilers come with built-in methods that can sort data
for you. However, it is beneficial to understand the sorting process so that you can write a
special-purpose sort when needed. Understanding the sorting process also improves your
array-manipulating skills.
3. Describe a bubble sort.
Answer: One of the simplest sorting techniques to understand is a bubble sort. You can use a
bubble sort to arrange records in either ascending or descending order. In a bubble sort, items
in a list are compared with each other in pairs. When an item is out of order, it swaps values
with the item below it. With an ascending bubble sort, after each adjacent pair of items in a
list has been compared once, the largest item in the list will have “sunk” to the bottom. After
many passes through the list, the smallest items rise to the top like bubbles in a carbonated
drink.

4. List and describe the general rules for sorting an array with a bubble sort.
Answer: When you sort the elements in an array this way, you use nested loops—an inner
loop that swaps out-of-order pairs, and an outer loop that goes through the list multiple times.
The general rules are:
The greatest number of pair comparisons you need to make during each loop is one less than
the number of elements in the array. You use an inner loop to make the pair comparisons.
The number of times you need to process the list of values is one less than the number of
elements in the array. You use an outer loop to control the number of times you walk through
the list.
5. Explain why you might want to use a two-dimensional array.
Answer: Sometimes locating a value in an array depends on more than one variable. If you
must represent values in a table or grid that contains rows and columns instead of a single list,
then you might want to use a two-dimensional array. A two-dimensional array contains two
dimensions: height and width. That is, the location of any element depends on two factors.
For example, if an apartment’s rent depends on two variables—both the floor of the building
and the number of bedrooms—then you want to create a two-dimensional array.
6. Describe a one-dimensional array.
Answer: An array whose elements you can access using a single subscript is a onedimensional array or single-dimensional array. The array has only one dimension because its
data can be stored in a table that has just one dimension: height. If you know the vertical
position of a one-dimensional array’s element, you can find its value.
7. Describe a two-dimensional array.
Answer: A two-dimensional array contains two dimensions: height and width. That is, the
location of any element depends on two factors. For example, if an apartment’s rent depends
on two variables—both the floor of the building and the number of bedrooms—then you want
to create a two-dimensional array.
8. Describe the brackets that you use when declaring one-dimensional and two-dimensional
arrays.
Answer: When you declare a one-dimensional array, you type a set of square brackets after
the array type and name. To declare a two-dimensional array, many languages require you to
type two sets of brackets after the array type and name.
9. Discuss how you declare one-dimensional and two-dimensional arrays.
Answer: When you declare a one-dimensional array, you type a set of square brackets after
the array type and name. To declare a two-dimensional array, many languages require you to
type two sets of brackets after the array type and name. For each element in the array, the first
square bracket holds the number of rows, and the second one holds the number of columns.
In other words, the two dimensions represent the array’s height and its width.
10. Describe how you access a two-dimensional array value using two subscripts.

Answer: You access a two-dimensional array value using two subscripts, in which the first
subscript represents the row and the second one represents the column.

Test Bank for Programming Logic and Design
Joyce Farrell
9781111969752, 9788131525906, 9781111825959

Document Details

Related Documents

Close

Send listing report

highlight_off

You already reported this listing

The report is private and won't be shared with the owner

rotate_right
Close
rotate_right
Close

Send Message

image
Close

My favorites

image
Close

Application Form

image
Notifications visibility rotate_right Clear all Close close
image
image
arrow_left
arrow_right