Question
click below
click below
Question
Normal Size Small Size show me how
C Chapter 13
Question | Answer |
---|---|
Getting information from a file is reffered to as "__________"? | reading the file |
Sending information to a file is referred to as "_________"? | writing to the file |
Files to which information is written are called ___ ___ because the files store output produced by a program. | output files |
Files that are read by the computer are called __ ___, because a program uses the information in these files as input. | input files |
You can create three different types of files in C++: ? | sequntial random binary |
The ___ ___ refers to the way the information in the file is accessed. | file type |
The information in a ____ access file is always accessed in consecutive order from the beginning of the file through the end of the file. | sequential |
The information stored in a ___ access file can be accessed either in consecutive order or in random order. | random |
The information in a ___ access file can be accessed by its byte location in the file. | binary |
A ___ ___ __ is often referred to as a text file because it is composed of lines of text. | sequential access file |
The standard input stream object(___) refers to the computer keyboard. | cin |
The standard output stream object(____) refers to the computer screen. | cout |
A program that uses the cin and cout objects must contain the #include___ directive. | iostream |
For a program to create a file object, it must contain the #include ____ directive, which tells the compiler to include the contents of the ___ file in the program. | fstream |
The fstream file contains the definitions of the ___ and ____ class, which allow you to create input and output file objects. | ifstream ofstream |
In addition to the #include <fstream> directive, a program that creates an input file object also should include the ___? | using std::ifstream, using std::ios |
A program that creates an output file oject should include the ___ and ____ statements? | using std::ofstream, using std::ios |
If the file you are creating is an input file, you're filename should start with(but doesn't have to) the letters "__". | in |
If the file you are creating is an output file, you're filename should start with(but doesn't have to) the letters "__". | out |
What is the syntax for creating input/output files? | input = ifstream fileObject or output = ofstream fileObject |
You use the input and output file objects, along with the C++ __ function to open actual files on your computers disk. | open() |
What is the syntax for opening a sequential access file? | fileObject.open(fileName[, mode]) |
The optional ___ argument in the syntax of opening a sequential access file indicates how the file is to be opened. | mode |
The ios::__ mode is used to open a file for input, which allows the computer to read the data stored in the file. | in |
The ios::__ and ios::__ mode on the other hand, are to open output files. Both of these modes allow the computer to write data to the file. | out app |
You use the ios::___ modes when you want to add data to the end of an existing file. | app |
You use the ios::___ mode to open a new, empty file for output. If the file already exists the contents of the file are erased. | out |
The two colons in each mode are called the __ __ ___ and indicate that the in, out, and app keywords are defined in the ios class. | scope resolution operator |
In C++ all files associated with an ifstream file object are opened automatically for input. TRUE/FALSE | TRUE |
All objects in C++ are created from a class and are referred to as ___ of the class. | instances |
If you do not specify a mode when opening an input file, C++ uses the default mode ios::___. | in |
If you do not specify a mode when opening an output file, C++ uses the default mode ios:: __? | out |
In cases where the program needs to add data to the end of the existing data stored in an output file, you need to specify what mode? | app |
After using the open function to open a file, you can use the ___ function to determine whether the file was opened successfully. | is_open() |
The is_open function returns a ___ value. | boolean |
The ! is the __ __ __ in C++ and its purpose is to reverse the truth-value of the condition. | Not logical operator |
What is the syntax for writing information to a sequantial access file? | fileObject << date |
In many programs, a sequential access file is used to store ___ and ___. | fields records |
A ___ is a single item of information about a person, place, or thing. Ex. name, salary, SIN, price. | field |
A __ is a collection of one or more related fields that contains all of the necessary data about a specific person, place or thing.Ex. student record, employee record. | record |
To distinguish one record from another in the file, programmer typically write each record on a seperate line in the file. You do so by including the __ stream manipulator at the end of the statement. | endl |
The endl stream manipulator writes an invisible character- referred to as the ___ character at the end of the record. | newline |
When writing to a file a record that contains more than one field, programmer typically seperate each field with a character literal constant; ___ is most common. | # |
The newline character is designated by the escape sequence: __ | /n |
The __ function determines whether the last character in a file has been read. In other words it determines whether the file pointer is located after the last character in the file. | eof() |
To prevent the loss of data you should close a sequential access file as soon as the program is finished using it. You close a file using the __ function. | close() |