Deck 14: Files and Streams

Full screen (f)
exit full mode
Question
The ____ class provides you with information about directories or folders.

A) Directory
B) File
C) Cabinet
D) Folder
Use Space or
up arrow
down arrow
to flip the card.
Question
A ____ is a collection of fields that contain data about an entity.

A) file
B) character
C) record
D) bit
Question
The File class is contained in the System.IOFile namespace.
Question
When you copy data from a file on a storage device into RAM, you ____.

A) write to the file
B) read from the file
C) copy to the file
D) do not use streams
Question
Most computer users organize their files into ____ or directories.

A) folders
B) bins
C) buckets
D) drawers
Question
The ____ class contains methods that allow you to access information about files.

A) Cabinet
B) File
C) Directory
D) Folder
Question
A CSV file contains values separated by semicolon delimiters.
Question
A C# application ____ by creating an object and associating a stream of bytes with that object.

A) returns a file
B) closes a file
C) opens a file
D) removes a file
Question
A data file is a ____ access file when each record is read in order of its position in the file.

A) sequential
B) random
C) dynamic
D) temporary
Question
Files exist on ____ storage devices, such as hard disks, USB drives, reels of magnetic tape, and optical discs.

A) temporary
B) volatile
C) soft
D) permanent
Question
When you store data in a computer file on a persistent storage device, you ____.

A) read from the file
B) use an input stream
C) write to the file
D) erase data from memory
Question
When you write a program and save it to a disk, you are using temporary storage.
Question
When a C# application ____, the file is no longer available to the application.

A) opens a file
B) returns a file
C) writes to a file
D) closes a file
Question
Because you can erase data from files, some programmers prefer the term ____ storage to permanent storage.

A) volatile
B) temporary
C) transit
D) persistent
Question
Files that store music or images are in ____ format.

A) data
B) binary
C) text
D) information
Question
A ____ is any one of the letters, numbers, or other special symbols (such as punctuation marks) that comprise data.

A) field
B) record
C) delimiter
D) character
Question
When data values in a program are stored in memory, they are lost when the program ends.
Question
The terms directory and folder are used synonymously to refer to an entity that is used to organize files.
Question
Permanent storage is ____.

A) volatile
B) temporal
C) nonvolatile
D) soft storage
Question
When you write a C# program that stores a value in a variable, you are using temporary storage; the value you store is lost when the program ends or the computer loses power. This type of storage is ____.

A) volatile
B) nonvolatile
C) permanent
D) hard
Question
Using a ____ in your programs refers to the bad programming practice of hardcoding numbers (unnamed, literal constants) in code without explanation.

A) constant
B) token
C) magic number
D) character set
Question
The FileStream class has 15 overloaded constructors. What can you tell about the FileStream object named myFile , given the constructor below?
FileStream myFile =
new FileStream("SomeText.txt"), FileMode.Create,
FileAccess.Write);
Question
____ is the process of converting objects into streams of bytes.

A) Deserialization
B) Normalization
C) Streaming
D) Serialization
Question
Write a program that prompts a user for a filename and tests the file's existence. If the file exists, display the file creation time. If it does not exist, display a message.
Question
Temporary storage is usually called computer memory or _________________________.
Question
What is a character?
Question
Some files are ____________________ that contain facts and figures, such as a payroll file that contains employee numbers, names, and salaries.
Question
A file's ____ holds the byte number of the next byte to be read.

A) token
B) file position pointer
C) magic number
D) record token
Question
The ____ method is a member of the String class; it takes a character delimiter parameter and separates a string into substrings at each occurrence of the delimiter.

A) Separate()
B) Split()
C) Delimit()
D) Substring()
Question
The set of all the characters used to represent data on a particular computer is that computer's ____________________.
Question
A program that reads from a sequential access data file creates a FileStream object, and then the FileStream object is passed to a StreamReader object's constructor. Once this has been done, the ReadLine() method can be used to retrieve one line at a time from the data file. Show the sequence of instructions that would create the FileStream and StreamReader needed to access a data file, and then read one line from the file.
Question
When you produce screen output and accept keyboard input, you use the Console class, which provides access to which three standard streams?
Question
When you perform an input operation in an application, you can picture bytes flowing into your program from an input device through a ____, which functions as a pipeline or channel.

A) directory
B) stream
C) root
D) path
Question
What are the disadvantages to writing data to a text file using tokens and delimiters as opposed to writing an entire object to a file at once?
Question
Sometimes it is necessary to process a sequential text file multiple times from the beginning during a program's execution. After the file is processed the first time, the file pointer is at the end of the file. How can you reread the file at this point?
Question
Describe some of the methods of the Directory class.
Question
____ converts streams of bytes back into objects.

A) Deserialization
B) Serialization
C) Normalization
D) Denormalization
Question
What is a record?
Question
Tossing a file into a drawer of a file cabinet without a folder is the equivalent of placing a file in the main or ____________________ of your storage device when storing computer files.
Question
Businesses store data in a relationship known as the data ____________________.
Question
Match between columns
Store music, images, and executable programs
binary files
Store music, images, and executable programs
permanent storage
Store music, images, and executable programs
token
Store music, images, and executable programs
delimiter
Store music, images, and executable programs
field
Store music, images, and executable programs
computer file
Store music, images, and executable programs
path
Store music, images, and executable programs
random access file
Store music, images, and executable programs
key field
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
binary files
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
permanent storage
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
token
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
delimiter
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
field
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
computer file
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
path
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
random access file
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
key field
A character or group of characters that has some meaning
binary files
A character or group of characters that has some meaning
permanent storage
A character or group of characters that has some meaning
token
A character or group of characters that has some meaning
delimiter
A character or group of characters that has some meaning
field
A character or group of characters that has some meaning
computer file
A character or group of characters that has some meaning
path
A character or group of characters that has some meaning
random access file
A character or group of characters that has some meaning
key field
A file in which records are not used in sequence
binary files
A file in which records are not used in sequence
permanent storage
A file in which records are not used in sequence
token
A file in which records are not used in sequence
delimiter
A file in which records are not used in sequence
field
A file in which records are not used in sequence
computer file
A file in which records are not used in sequence
path
A file in which records are not used in sequence
random access file
A file in which records are not used in sequence
key field
A collection of information stored on a nonvolatile device in a computer system
binary files
A collection of information stored on a nonvolatile device in a computer system
permanent storage
A collection of information stored on a nonvolatile device in a computer system
token
A collection of information stored on a nonvolatile device in a computer system
delimiter
A collection of information stored on a nonvolatile device in a computer system
field
A collection of information stored on a nonvolatile device in a computer system
computer file
A collection of information stored on a nonvolatile device in a computer system
path
A collection of information stored on a nonvolatile device in a computer system
random access file
A collection of information stored on a nonvolatile device in a computer system
key field
A field used to uniquely identify each record in a sequential file
binary files
A field used to uniquely identify each record in a sequential file
permanent storage
A field used to uniquely identify each record in a sequential file
token
A field used to uniquely identify each record in a sequential file
delimiter
A field used to uniquely identify each record in a sequential file
field
A field used to uniquely identify each record in a sequential file
computer file
A field used to uniquely identify each record in a sequential file
path
A field used to uniquely identify each record in a sequential file
random access file
A field used to uniquely identify each record in a sequential file
key field
A character used to specify the boundary between data items in text files
binary files
A character used to specify the boundary between data items in text files
permanent storage
A character used to specify the boundary between data items in text files
token
A character used to specify the boundary between data items in text files
delimiter
A character used to specify the boundary between data items in text files
field
A character used to specify the boundary between data items in text files
computer file
A character used to specify the boundary between data items in text files
path
A character used to specify the boundary between data items in text files
random access file
A character used to specify the boundary between data items in text files
key field
Is not lost when a computer loses power
binary files
Is not lost when a computer loses power
permanent storage
Is not lost when a computer loses power
token
Is not lost when a computer loses power
delimiter
Is not lost when a computer loses power
field
Is not lost when a computer loses power
computer file
Is not lost when a computer loses power
path
Is not lost when a computer loses power
random access file
Is not lost when a computer loses power
key field
A block of text within a string that represents an entity or a field
binary files
A block of text within a string that represents an entity or a field
permanent storage
A block of text within a string that represents an entity or a field
token
A block of text within a string that represents an entity or a field
delimiter
A block of text within a string that represents an entity or a field
field
A block of text within a string that represents an entity or a field
computer file
A block of text within a string that represents an entity or a field
path
A block of text within a string that represents an entity or a field
random access file
A block of text within a string that represents an entity or a field
key field
Question
How can you create a class whose objects can be written to and read from data files? Show an example.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/42
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 14: Files and Streams
1
The ____ class provides you with information about directories or folders.

A) Directory
B) File
C) Cabinet
D) Folder
A
2
A ____ is a collection of fields that contain data about an entity.

A) file
B) character
C) record
D) bit
C
3
The File class is contained in the System.IOFile namespace.
False
4
When you copy data from a file on a storage device into RAM, you ____.

A) write to the file
B) read from the file
C) copy to the file
D) do not use streams
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
5
Most computer users organize their files into ____ or directories.

A) folders
B) bins
C) buckets
D) drawers
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
6
The ____ class contains methods that allow you to access information about files.

A) Cabinet
B) File
C) Directory
D) Folder
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
7
A CSV file contains values separated by semicolon delimiters.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
8
A C# application ____ by creating an object and associating a stream of bytes with that object.

A) returns a file
B) closes a file
C) opens a file
D) removes a file
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
9
A data file is a ____ access file when each record is read in order of its position in the file.

A) sequential
B) random
C) dynamic
D) temporary
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
10
Files exist on ____ storage devices, such as hard disks, USB drives, reels of magnetic tape, and optical discs.

A) temporary
B) volatile
C) soft
D) permanent
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
11
When you store data in a computer file on a persistent storage device, you ____.

A) read from the file
B) use an input stream
C) write to the file
D) erase data from memory
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
12
When you write a program and save it to a disk, you are using temporary storage.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
13
When a C# application ____, the file is no longer available to the application.

A) opens a file
B) returns a file
C) writes to a file
D) closes a file
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
14
Because you can erase data from files, some programmers prefer the term ____ storage to permanent storage.

A) volatile
B) temporary
C) transit
D) persistent
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
15
Files that store music or images are in ____ format.

A) data
B) binary
C) text
D) information
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
16
A ____ is any one of the letters, numbers, or other special symbols (such as punctuation marks) that comprise data.

A) field
B) record
C) delimiter
D) character
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
17
When data values in a program are stored in memory, they are lost when the program ends.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
18
The terms directory and folder are used synonymously to refer to an entity that is used to organize files.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
19
Permanent storage is ____.

A) volatile
B) temporal
C) nonvolatile
D) soft storage
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
20
When you write a C# program that stores a value in a variable, you are using temporary storage; the value you store is lost when the program ends or the computer loses power. This type of storage is ____.

A) volatile
B) nonvolatile
C) permanent
D) hard
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
21
Using a ____ in your programs refers to the bad programming practice of hardcoding numbers (unnamed, literal constants) in code without explanation.

A) constant
B) token
C) magic number
D) character set
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
22
The FileStream class has 15 overloaded constructors. What can you tell about the FileStream object named myFile , given the constructor below?
FileStream myFile =
new FileStream("SomeText.txt"), FileMode.Create,
FileAccess.Write);
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
23
____ is the process of converting objects into streams of bytes.

A) Deserialization
B) Normalization
C) Streaming
D) Serialization
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
24
Write a program that prompts a user for a filename and tests the file's existence. If the file exists, display the file creation time. If it does not exist, display a message.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
25
Temporary storage is usually called computer memory or _________________________.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
26
What is a character?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
27
Some files are ____________________ that contain facts and figures, such as a payroll file that contains employee numbers, names, and salaries.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
28
A file's ____ holds the byte number of the next byte to be read.

A) token
B) file position pointer
C) magic number
D) record token
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
29
The ____ method is a member of the String class; it takes a character delimiter parameter and separates a string into substrings at each occurrence of the delimiter.

A) Separate()
B) Split()
C) Delimit()
D) Substring()
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
30
The set of all the characters used to represent data on a particular computer is that computer's ____________________.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
31
A program that reads from a sequential access data file creates a FileStream object, and then the FileStream object is passed to a StreamReader object's constructor. Once this has been done, the ReadLine() method can be used to retrieve one line at a time from the data file. Show the sequence of instructions that would create the FileStream and StreamReader needed to access a data file, and then read one line from the file.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
32
When you produce screen output and accept keyboard input, you use the Console class, which provides access to which three standard streams?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
33
When you perform an input operation in an application, you can picture bytes flowing into your program from an input device through a ____, which functions as a pipeline or channel.

A) directory
B) stream
C) root
D) path
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
34
What are the disadvantages to writing data to a text file using tokens and delimiters as opposed to writing an entire object to a file at once?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
35
Sometimes it is necessary to process a sequential text file multiple times from the beginning during a program's execution. After the file is processed the first time, the file pointer is at the end of the file. How can you reread the file at this point?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
36
Describe some of the methods of the Directory class.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
37
____ converts streams of bytes back into objects.

A) Deserialization
B) Serialization
C) Normalization
D) Denormalization
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
38
What is a record?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
39
Tossing a file into a drawer of a file cabinet without a folder is the equivalent of placing a file in the main or ____________________ of your storage device when storing computer files.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
40
Businesses store data in a relationship known as the data ____________________.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
41
Match between columns
Store music, images, and executable programs
binary files
Store music, images, and executable programs
permanent storage
Store music, images, and executable programs
token
Store music, images, and executable programs
delimiter
Store music, images, and executable programs
field
Store music, images, and executable programs
computer file
Store music, images, and executable programs
path
Store music, images, and executable programs
random access file
Store music, images, and executable programs
key field
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
binary files
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
permanent storage
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
token
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
delimiter
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
field
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
computer file
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
path
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
random access file
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
key field
A character or group of characters that has some meaning
binary files
A character or group of characters that has some meaning
permanent storage
A character or group of characters that has some meaning
token
A character or group of characters that has some meaning
delimiter
A character or group of characters that has some meaning
field
A character or group of characters that has some meaning
computer file
A character or group of characters that has some meaning
path
A character or group of characters that has some meaning
random access file
A character or group of characters that has some meaning
key field
A file in which records are not used in sequence
binary files
A file in which records are not used in sequence
permanent storage
A file in which records are not used in sequence
token
A file in which records are not used in sequence
delimiter
A file in which records are not used in sequence
field
A file in which records are not used in sequence
computer file
A file in which records are not used in sequence
path
A file in which records are not used in sequence
random access file
A file in which records are not used in sequence
key field
A collection of information stored on a nonvolatile device in a computer system
binary files
A collection of information stored on a nonvolatile device in a computer system
permanent storage
A collection of information stored on a nonvolatile device in a computer system
token
A collection of information stored on a nonvolatile device in a computer system
delimiter
A collection of information stored on a nonvolatile device in a computer system
field
A collection of information stored on a nonvolatile device in a computer system
computer file
A collection of information stored on a nonvolatile device in a computer system
path
A collection of information stored on a nonvolatile device in a computer system
random access file
A collection of information stored on a nonvolatile device in a computer system
key field
A field used to uniquely identify each record in a sequential file
binary files
A field used to uniquely identify each record in a sequential file
permanent storage
A field used to uniquely identify each record in a sequential file
token
A field used to uniquely identify each record in a sequential file
delimiter
A field used to uniquely identify each record in a sequential file
field
A field used to uniquely identify each record in a sequential file
computer file
A field used to uniquely identify each record in a sequential file
path
A field used to uniquely identify each record in a sequential file
random access file
A field used to uniquely identify each record in a sequential file
key field
A character used to specify the boundary between data items in text files
binary files
A character used to specify the boundary between data items in text files
permanent storage
A character used to specify the boundary between data items in text files
token
A character used to specify the boundary between data items in text files
delimiter
A character used to specify the boundary between data items in text files
field
A character used to specify the boundary between data items in text files
computer file
A character used to specify the boundary between data items in text files
path
A character used to specify the boundary between data items in text files
random access file
A character used to specify the boundary between data items in text files
key field
Is not lost when a computer loses power
binary files
Is not lost when a computer loses power
permanent storage
Is not lost when a computer loses power
token
Is not lost when a computer loses power
delimiter
Is not lost when a computer loses power
field
Is not lost when a computer loses power
computer file
Is not lost when a computer loses power
path
Is not lost when a computer loses power
random access file
Is not lost when a computer loses power
key field
A block of text within a string that represents an entity or a field
binary files
A block of text within a string that represents an entity or a field
permanent storage
A block of text within a string that represents an entity or a field
token
A block of text within a string that represents an entity or a field
delimiter
A block of text within a string that represents an entity or a field
field
A block of text within a string that represents an entity or a field
computer file
A block of text within a string that represents an entity or a field
path
A block of text within a string that represents an entity or a field
random access file
A block of text within a string that represents an entity or a field
key field
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
42
How can you create a class whose objects can be written to and read from data files? Show an example.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 42 flashcards in this deck.