Chapter 11

1. The sorting algorithm used in the book is called the bubble sort
or interchange sort algorithm.

2. (a) "ZY" is larger than "XY"
(b) "John" is larger than "JOHN"
(c) "qe35" is larger than "QE37"
(d) "CBA" is larger than "ABC"
(e) "simplifications" is larger than "simplification"

3. This program fragment swaps or interchanges the values
of Num1 and Num2:

LET Temp = Num1
LET Num1 = Num2
LET Num2 = Temp

4. A list does not need to be in sorted order for a sequential
search, but must be in sorted order for a binary search.

5. (a) In a binary search of an ascending sorted list, if the
target name is greater than the mid-point name, the index value
of the bottom end-point remains unchanged.
(b) The new index value of the top end point is the index of
the mid point plus one.

6. (a) If the preceding list is sorted in descending order,
the index value of the top end point remains unchanged.
(b) The new index value of the bottom end point is the
index of the mid point minus one.

7. The statement "SET #2: record 7" moves the file pointer
to record 7 of file #2.

8. Old information in record 10 of a record file can be over-
written with new information after setting the file pointer to
point at the beginning of record 10.

9. If you try to write a 45-character string on a file record
whose size is 44 bytes, you will get a run-time error because the
string is too long for the record size.

10. If a file is #N, the statement "SET #N: recsize R" establishes
a record size of R bytes.

11. (a) The statement "SET #N: pointer next" or "RESET #N: next"
moves the file pointer to the beginning of the next record of
file #N.
(b) The statement "SET #N: pointer same" or "RESET #N: same"
moves the pointer to the beginning of the same or current
record.

12. The statement "READ #1: Name1$, Name2$" assigns the
value of record 4 to Name1$ if Name2$ is assigned the value of
record 5.

13. The statement "ASK #N: filesize Number" assigns to the
variable Number a value representing the number of records
in file #N.

14. Non-text characters or "garbage" appears on the display
screen if you try to list a record file using the TYPE command
of DOS.

15. The system variable Date$ displays the current date in
YYYYMMDD format.

16. If you are copying all the information from record file #1
to record file #2, stop copying when you reach the end of file #1
or when the value of the END #1 function becomes true.