Deck 8: Io Streams and Data Files

Full screen (f)
exit full mode
Question
Long filenames should be avoided because they take more time to type and can result in typing errors.
Use Space or
up arrow
down arrow
to flip the card.
Question
When a program is executed, the standard input stream cin is connected to the standard input device.
Question
You must specify a C-string s maximum length in brackets immediately after it s declared.
Question
Current versions of UNIX allow 14 characters as the maximum filename length.
Question
The close() function takes one argument.
Question
A(n) ____ is a one-way transmission path between a source and a destination.

A) file
B) object
C) external name
D) stream
Question
In addition to the get() method, all input streams have a set() method for putting the last character read from an input stream back on the stream.
Question
A(n) ____ is a one-way transmission path used to connect a file stored on a physical device, such as a disk or CD, to a program.

A) file stream
B) external stream
C) stream name
D) file name
Question
Input file stream objects are declared to be of type ____.

A) istream
B) iofstream
C) ifstream
D) ofstream
Question
A ____ is a collection of data stored together under a common name, usually on a disk, magnetic tape, USB drive, or CD/DVD.

A) file
B) directory
C) database
D) file stream object
Question
Opening a file connects a file stream object to a specific external filename.
Question
The DOS operating system allows ____ characters plus an optional period and 3-character extension as the maximum filename length.

A) 4
B) 8
C) 16
D) 32
Question
All computer operating systems use the same specification as to the maximum number of characters permitted for an external filename.
Question
The ____ method returns a true value if a file was opened unsuccessfully or a false value if the open succeeded.

A) fail()
B) open()
C) test()
D) close()
Question
A file is a collection of data stored together under a common name, usually on a disk.
Question
C++ supports physical file objects.
Question
The Excel program adds the ____ extension automatically to all spreadsheet files.

A) .xla or .xls
B) .xls or .xlsx
C) .xcl or .xclx
D) .wpx or .wpxl
Question
Each file has a unique filename, referred to as the file s ____.

A) storage ID
B) external ID number
C) storage name
D) external name
Question
A file stream that sends or writes data to a file is an ____.

A) input file stream
B) output file stream
C) external file stream
D) internal file stream
Question
C++ compilers require a program file with the extension ____.

A) .c
B) .ccc
C) .cpp
D) .c++
Question
Output file streams can be formatted in the same manner as the ____ standard output stream.

A) cout
B) cin
C) ccout
D) fout
Question
In declaring and initializing a string variable for use in an open() method, the string is considered a ____.

A) string object
B) C-string
C) c_str
D) c-character
Question
The ____ functions return the file position marker s offset value.

A) offset()
B) where()
C) seek()
D) tell()
Question
The fstream class s ____ function permits character-by-character output to a stream.

A) getline()
B) get()
C) putline()
D) put()
Question
A(n) ____________________ filename is how the operating system knows the file.
Question
C and C++ append the low-value hexadecimal byte ____ as the end-of-file (EOF) sentinel when the file is closed.

A) 0x01
B) 0x10
C) 0x00
D) 0x11
Question
For file streams, the direction, or mode, is defined in relation to the ____________________ and not the file.
Question
A file stream that receives or reads data from a file to a program is a(n) ____________________ file stream.
Question
The ____ method breaks the connection between the file s external name and the file stream object.

A) open()
B) fail()
C) bad()
D) close()
Question
In ____, any character in the opened file can be read without having to sequentially read all characters stored ahead of it first.

A) sequential access
B) sequential organization
C) random access
D) random organization
Question
For each file your program uses, a distinct ____________________ stream object must be created.
Question
Two basic types of files exist: text files, and ____________________ files.
Question
You must check that the ____ method established a connection between a file stream and an external file successfully because this type of call is a request to the OS that can fail for various reasons.

A) connect()
B) conn()
C) open()
D) file()
Question
The ____ function is a request to the operating system to end program execution immediately.

A) end()
B) break()
C) terminate()
D) exit()
Question
All input streams have a ____ function for putting back the last character read from an input stream back on the stream.

A) put()
B) putback()
C) return()
D) sendback()
Question
A(n) ____ file object is a stream that connects a file of logically related data, such as a data file, to a program.

A) external
B) internal
C) physical
D) logical
Question
The term ____ refers to the process of retrieving data from a file.

A) file connection
B) file access
C) stream connection
D) stream access
Question
The fstream class s ____ function is used for character-by-character input from an input stream.

A) get()
B) getline()
C) getchar()
D) next()
Question
The term ____ refers to the way data is stored in a file.

A) file organization
B) file access
C) sequential access
D) database
Question
The standard error stream is represented by ____ in C and C++.

A) cin
B) cout
C) cerr
D) clog
Question
In C and C++, the ___________________ sentinel is never counted as part of the file.
Question
The standard log stream is represented by ____________________ in C and C++.
Question
The ____________________() methods allow the programmer to move to any position in a file.
Question
Reading data from a(n) ___________________-based file is almost identical to reading data from a standard keyboard.
Question
There are two types of file access: sequential access and ____________________ access.
Question
The ___________________() method returns a false value if the file was opened successfully.
Question
To understand file access types, first you need to understand how data is ____________________ in a file.
Question
In using ifstream and ofstream objects, the input or output mode is indicated by the ____________________.
Question
Using the seek() functions in random access, a(n) ____________________ offset means move forward in the file.
Question
A file stream object may be passed to a function as long as the function s formal parameter is defined as a(n) ____________________ to the appropriate stream.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 8: Io Streams and Data Files
1
Long filenames should be avoided because they take more time to type and can result in typing errors.
True
2
When a program is executed, the standard input stream cin is connected to the standard input device.
True
3
You must specify a C-string s maximum length in brackets immediately after it s declared.
True
4
Current versions of UNIX allow 14 characters as the maximum filename length.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
The close() function takes one argument.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
A(n) ____ is a one-way transmission path between a source and a destination.

A) file
B) object
C) external name
D) stream
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
In addition to the get() method, all input streams have a set() method for putting the last character read from an input stream back on the stream.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
A(n) ____ is a one-way transmission path used to connect a file stored on a physical device, such as a disk or CD, to a program.

A) file stream
B) external stream
C) stream name
D) file name
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
Input file stream objects are declared to be of type ____.

A) istream
B) iofstream
C) ifstream
D) ofstream
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
A ____ is a collection of data stored together under a common name, usually on a disk, magnetic tape, USB drive, or CD/DVD.

A) file
B) directory
C) database
D) file stream object
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
Opening a file connects a file stream object to a specific external filename.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
The DOS operating system allows ____ characters plus an optional period and 3-character extension as the maximum filename length.

A) 4
B) 8
C) 16
D) 32
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
All computer operating systems use the same specification as to the maximum number of characters permitted for an external filename.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
The ____ method returns a true value if a file was opened unsuccessfully or a false value if the open succeeded.

A) fail()
B) open()
C) test()
D) close()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
A file is a collection of data stored together under a common name, usually on a disk.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
C++ supports physical file objects.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
The Excel program adds the ____ extension automatically to all spreadsheet files.

A) .xla or .xls
B) .xls or .xlsx
C) .xcl or .xclx
D) .wpx or .wpxl
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
Each file has a unique filename, referred to as the file s ____.

A) storage ID
B) external ID number
C) storage name
D) external name
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
A file stream that sends or writes data to a file is an ____.

A) input file stream
B) output file stream
C) external file stream
D) internal file stream
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
C++ compilers require a program file with the extension ____.

A) .c
B) .ccc
C) .cpp
D) .c++
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
Output file streams can be formatted in the same manner as the ____ standard output stream.

A) cout
B) cin
C) ccout
D) fout
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
In declaring and initializing a string variable for use in an open() method, the string is considered a ____.

A) string object
B) C-string
C) c_str
D) c-character
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
The ____ functions return the file position marker s offset value.

A) offset()
B) where()
C) seek()
D) tell()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
The fstream class s ____ function permits character-by-character output to a stream.

A) getline()
B) get()
C) putline()
D) put()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
A(n) ____________________ filename is how the operating system knows the file.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
C and C++ append the low-value hexadecimal byte ____ as the end-of-file (EOF) sentinel when the file is closed.

A) 0x01
B) 0x10
C) 0x00
D) 0x11
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
For file streams, the direction, or mode, is defined in relation to the ____________________ and not the file.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
A file stream that receives or reads data from a file to a program is a(n) ____________________ file stream.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
The ____ method breaks the connection between the file s external name and the file stream object.

A) open()
B) fail()
C) bad()
D) close()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
In ____, any character in the opened file can be read without having to sequentially read all characters stored ahead of it first.

A) sequential access
B) sequential organization
C) random access
D) random organization
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
For each file your program uses, a distinct ____________________ stream object must be created.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
Two basic types of files exist: text files, and ____________________ files.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
You must check that the ____ method established a connection between a file stream and an external file successfully because this type of call is a request to the OS that can fail for various reasons.

A) connect()
B) conn()
C) open()
D) file()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
The ____ function is a request to the operating system to end program execution immediately.

A) end()
B) break()
C) terminate()
D) exit()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
All input streams have a ____ function for putting back the last character read from an input stream back on the stream.

A) put()
B) putback()
C) return()
D) sendback()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
A(n) ____ file object is a stream that connects a file of logically related data, such as a data file, to a program.

A) external
B) internal
C) physical
D) logical
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
The term ____ refers to the process of retrieving data from a file.

A) file connection
B) file access
C) stream connection
D) stream access
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
The fstream class s ____ function is used for character-by-character input from an input stream.

A) get()
B) getline()
C) getchar()
D) next()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
The term ____ refers to the way data is stored in a file.

A) file organization
B) file access
C) sequential access
D) database
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
The standard error stream is represented by ____ in C and C++.

A) cin
B) cout
C) cerr
D) clog
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
In C and C++, the ___________________ sentinel is never counted as part of the file.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
The standard log stream is represented by ____________________ in C and C++.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
The ____________________() methods allow the programmer to move to any position in a file.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
Reading data from a(n) ___________________-based file is almost identical to reading data from a standard keyboard.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
There are two types of file access: sequential access and ____________________ access.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
The ___________________() method returns a false value if the file was opened successfully.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
To understand file access types, first you need to understand how data is ____________________ in a file.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
In using ifstream and ofstream objects, the input or output mode is indicated by the ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
Using the seek() functions in random access, a(n) ____________________ offset means move forward in the file.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
A file stream object may be passed to a function as long as the function s formal parameter is defined as a(n) ____________________ to the appropriate stream.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 50 flashcards in this deck.