Quiz 9
Select all that apply. Which statements are true about the append mode that is available in most programming languages?
Data written to the file will be written to the end of the file's contents.
All types of files can be viewed correctly in a simple text editor.
False
Control break logic is used when the programmer wants a program to terminate immediately.
False
In current gaming software, it is rare for data files to be needed.
False
It is possible to manipulate data in a file directly without saving its contents to an array or anywhere else in a program.
False
Sequential access files are easy to work with because you can immediately jump to the to any piece of data without reading all the data before it.
False
The data saved in a file will remain there after the program ends but will be erased when the computer is turned off.
False
The term "output file" describes a file that data is read from.
False
In order to process the data in a file, first you must ________ the file and then ________ the data into memory.
Open, Read
________ access files are easy to work with and can be used to gain an understanding of basic file operations.
Sequential
In the pseudocode of the textbook, what does the following statement indicate? Write itemsOrdered "widgets"
The string "widgets" will be written to the file associated with itemsOrdered.
A file specification document describes the fields that are used in a file and is used to help programmers understand how the data is organized before they begin writing programs to manipulate that data.
True
In a file a record is a complete set of data about an item and a field is an individual piece of data within a record.
True
In a text file, all data is stored as a series of characters.
True
The use of a buffer increases the system's performance because writing data to memory is faster than writing data to a disk.
True
When an input file is opened, the read position is initially set to the first item in the file.
True
The eof function ________.
accepts a file's internal name as an argument and returns True if the end of the file has been reached
Which type of file cannot be viewed in a text editor such as Notepad?
binary file
The ________ is a small holding section in memory.
buffer
When a program ________ a file, it disconnects the file from the program.
closes
When a web page is visited, the browser may store a small file on the user's computer. This file is known as a ________.
cookie
A character or set of characters that marks the end of a piece of data is known as a(n) ________.
delimiter
When using ________ access, the code can access any piece of data without reading all the data that came before it in the file.
direct
The EOF marker indicates where a file's content ________.
ends
Which of the following expressions is equivalent to the pseudocode shown here?
eof(myStuff) == False
In most programming languages, if a file with a specified external name already exists when the file is opened by the program, the contents of the existing file will be ________.
erased
The filename ________ usually indicates the type of data stored in the file.
extension
When a program needs to save data for later use, it writes the data to a(n) ________.
file
Opening a(n) ________ file creates a file on disk and allows the program to write data to it.
input
Given the following pseudocode, what is the name of the file on disk? Declare String item Declare Integer numOrdered Declare InputFile stuffBought Open stuffBought "inventory.dat" Display "Your orders: " While NOT eof(stuffBought) Read stuffBought item, numOrdered Display item, ": ", numOrdered End While Close stuffBought
inventory.dat
In the pseudocode of the textbook, what does the following statement indicate? Declare OutputFile itemsOrdered
itemsOrdered is the internal name used to work with the contents of a file.
Select all that apply. Given the following pseudocode, what is(are) the fields? Declare String item Declare Integer numOrdered Declare InputFile stuffBought Open stuffBought "inventory.dat" Display "Your orders: " While NOT eof(stuffBought) Read stuffBought item, numOrdered Display item, ": ", numOrdered End While Close stuffBought
numOrdered
To create a connection between a file and a program, the file must be ________.
opened
The file that data is written to is the ________ file.
output
In a flowchart, the ________ symbol is used to read data from a file.
parallelogram
In the ________ step, the data is either written to the file or read from the file.
processing
A direct access file is also known as a(n) ________ access file.
random
When a program retrieves data from a file, this process is known as ________ data from the file.
reading
Data in a file is organized in ________ where each one is a complete set of data about an item.
records
When using ________ access, access to the data starts at the beginning of the file and proceeds through all the records to the end of the file.
sequential
Given the following pseudocode, what is the internal name used to work with the file on disk? Declare String item Declare Integer numOrdered Declare InputFile stuffBought Open stuffBought "inventory.dat" Display "Your orders: " While NOT eof(stuffBought) Read stuffBought item, numOrdered Display item, ": ", numOrdered End While Close stuffBought
stuffBought
There are always ________ steps that must be taken when a file is used by a program.
three
Select all that apply. Which of the following software packages store data in files?
web browsers
Programmers usually refer to the process of saving data to a file as ________ to a file.
writing