Chapter 9
1. A True BASIC program file is a sequential text file.
2. The pair of non-printing characters, carriage return and
line feed, is used as a delimiter to separate lines of text
in a text file.
3. You can start to read a file at the beginning, but not in
the middle.
4. You can start to write on an existing file at the end, but
not at the beginning or in the middle.
5. When a new file has been opened but nothing has been
written on it, the file pointer is at the beginning (or the end,
they are the same).
6. The default value of the ACCESS mode is OUTIN.
7. The PC allows 5 files fewer than the DOS limit (set in the
CONFIG.SYS file) to be open at the same time; the Mac allows
25 files to be open at the same time.
8. If the first file is opened as #1, the next file opened does
not have to be #2, it can have any file number up to 1000.
9. File numbers must be between 1 and 1000.
(a) File #9 is allowed.
(b) File #-9 is not allowed.
(c) File #990 is allowed.
(d) File #1900 is not allowed.
10. When a file is opened, it is assigned a file number. You
cannot write on a file that has not been opened.
11. The default value of the CREATE action is OLD.
12. An ORGANIZATION type of TEXT is assumed when a new file
is opened and a line of text is written on it.
13. (a) The statement SET #3: POINTER END or RESET #3: END
places the file pointer at the end of file #3.
(b) The statement SET #4: POINTER BEGIN or RESET #4: BEGIN
places the file pointer at the beginning of file #4.
14. If more than one variable is placed in a PRINT statement
that is used to write information on a file, the individual
variable values will all be on the same line in the file, not
on separate lines.
15. If a file has been opened as file #1, you must execute the
statement CLOSE #1 before you can open another file as file #1.
16. You cannot read information from a file that has been
opened with an ACCESS mode of OUTPUT.
17. The advantage of the LINE INPUT statement, when reading
lines of text from a file, is that it reads all characters up
to the end of the line. The INPUT statement, on the other hand,
stops reading at the first comma it encounters in a line.
18. If each line in file #1 represents a numeric value, you can
use the statement INPUT #1: Number to read a value and assign it
to the variable Number.
19. (a) If file #1 is not empty and the file pointer is at the
beginning of the file, the value of END #1 is false.
(b) If the file pointer is at the end of the file, the value
of END #1 is true.
20. File numbers can be passed as parameters to external
subroutines, but not to external functions.
21. A file opened in an external function is closed before
control returns to the calling unit.
22. A file specified as file #1 in the CALL statement of an
external subroutine can be specified by any legal file number
in the heading statement of the subroutine.
23. If END #1 has a value of true, the function MORE #1 has a
value of false.
24. A file opened with the statement "OPEN #1: name "PROB07",
create new" has a DOS file name of PROB07.TRU.
25. If a DOS file name of HOMEWORK is to be assigned to the
variable FileName$ for use in an OPEN statment, the value
HOMEWORK. (with a trailing period) must be used. The assignment
statement would be "LET FileName$ = "HOMEWORK.", assuming
that
the file is in the current directory of the current disk.