Deck 8: Sequential-Access Files

Full screen (f)
exit full mode
Question
In order to perform file processing in C++, which header files must be included?

A) , and .
B) and .
C) and .
D) and .
Use Space or
up arrow
down arrow
to flip the card.
Question
When used with ofstream objects, operator! is not:

A) Overloaded.
B) Used to determine if the open operation succeeded.
C) Used to close a file explicitly.
D) Used to return a nonzero value if an error occurs.
Question
Which of the following does not have a stream associated with it?

A) cerr.
B) cin.
C) cout.
D) All of the above have streams associated with them.
Question
Which file open mode would be used to write data only to the end of an existing file?

A) ios::app
B) ios::in
C) ios::out
D) ios::trunc
Question
Typically, which of the following contains the most data?

A) A database.
B) A file.
C) A byte.
D) A field.
Question
Which of the following is not a disadvantage of trying to modify a sequential access file?

A) Modifying data can potentially destroy other data.
B) It may be necessary to rewrite every record in the file to make a slight change.
C) Things that are stored in the same number of "raw data" bytes internally may not take up the same amount of space in a file.
D) Overwriting a record with another record of the same size is very difficult.
Question
Select the false statement.

A) C++ imposes no structure on a file.
B) C++ files include information about their structure.
C) The programmer must impose a structure on a file.
D) C++ files do not understand notions such as "records" and "fields."
Question
What is not true about this code segment?
Location = fileObject.tellg);

A) tellg is a member function of fileObject.
B) location is a pointer.
C) The value of location after the segment executes must be less than or equal to the number of bytes in the file attached to fileObject.
D) fileObject is an istream object.
Question
The data hierarchy, arranged from smallest to largest, is:

A) Bit, byte, record, field, file.
B) Byte, bit, field, record, file.
C) Bit, byte, field, record, file.
D) Byte, bit, field, file, record.
Question
Which of the following will not change the file-position pointer to the same position as the others? Assume a 10-byte file size and a current position at byte # 1.

A) fileObject.seekg 2 );
B) fileObject.seekg 1, ios::cur );
C) fileObject.seekg 2, ios::beg );
D) fileObject.seekg 8, ios::end );
Question
Which statement is not true about 0, z , %, * and Q?

A) Each can be represented in terms of 0s and 1s.
B) Each is a character.
C) Only three of the elements listed are in typical character sets.
D) Each can be represented as a byte.
Question
Select the false statement.

A) All data items can eventually be reduced to a sequence of 0s and 1s.
B) A binary digit bit) can store two values simultaneously.
C) It is cumbersome to work with data in bit form.
D) It is easiest to produce electronic devices that can assume one of two stable states.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/12
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 8: Sequential-Access Files
1
In order to perform file processing in C++, which header files must be included?

A) , and .
B) and .
C) and .
D) and .
D
2
When used with ofstream objects, operator! is not:

A) Overloaded.
B) Used to determine if the open operation succeeded.
C) Used to close a file explicitly.
D) Used to return a nonzero value if an error occurs.
C
3
Which of the following does not have a stream associated with it?

A) cerr.
B) cin.
C) cout.
D) All of the above have streams associated with them.
C
4
Which file open mode would be used to write data only to the end of an existing file?

A) ios::app
B) ios::in
C) ios::out
D) ios::trunc
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
5
Typically, which of the following contains the most data?

A) A database.
B) A file.
C) A byte.
D) A field.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
6
Which of the following is not a disadvantage of trying to modify a sequential access file?

A) Modifying data can potentially destroy other data.
B) It may be necessary to rewrite every record in the file to make a slight change.
C) Things that are stored in the same number of "raw data" bytes internally may not take up the same amount of space in a file.
D) Overwriting a record with another record of the same size is very difficult.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
7
Select the false statement.

A) C++ imposes no structure on a file.
B) C++ files include information about their structure.
C) The programmer must impose a structure on a file.
D) C++ files do not understand notions such as "records" and "fields."
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
8
What is not true about this code segment?
Location = fileObject.tellg);

A) tellg is a member function of fileObject.
B) location is a pointer.
C) The value of location after the segment executes must be less than or equal to the number of bytes in the file attached to fileObject.
D) fileObject is an istream object.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
9
The data hierarchy, arranged from smallest to largest, is:

A) Bit, byte, record, field, file.
B) Byte, bit, field, record, file.
C) Bit, byte, field, record, file.
D) Byte, bit, field, file, record.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
10
Which of the following will not change the file-position pointer to the same position as the others? Assume a 10-byte file size and a current position at byte # 1.

A) fileObject.seekg 2 );
B) fileObject.seekg 1, ios::cur );
C) fileObject.seekg 2, ios::beg );
D) fileObject.seekg 8, ios::end );
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
11
Which statement is not true about 0, z , %, * and Q?

A) Each can be represented in terms of 0s and 1s.
B) Each is a character.
C) Only three of the elements listed are in typical character sets.
D) Each can be represented as a byte.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
12
Select the false statement.

A) All data items can eventually be reduced to a sequence of 0s and 1s.
B) A binary digit bit) can store two values simultaneously.
C) It is cumbersome to work with data in bit form.
D) It is easiest to produce electronic devices that can assume one of two stable states.
Unlock Deck
Unlock for access to all 12 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 12 flashcards in this deck.