Exam 14: Files and Streams

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

When you copy data from a file on a storage device into RAM, what are you doing?

Free
(Multiple Choice)
4.7/5
(33)
Correct Answer:
Verified

B

Hardcoding numbers (unnamed, literal constants) in code without explanation is a bad programming practice.What are these hardcoded numbers known as?

Free
(Multiple Choice)
4.9/5
(38)
Correct Answer:
Verified

C

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.

Free
(Essay)
4.8/5
(38)
Correct Answer:
Verified

A program that reads from a sequential access data file contains many similar components to one that writes to a file.For example, a FileStream object is created, as in a program that writes to a file.However, the access must be FileAccess.Read (or ReadWrite), as in the following statement:
FileStream inFile =
new FileStream(FILENAME, FileMode.Open, FileAccess.Read);
Then, as when data is being written, the FileStream object is passed to a StreamReader object's constructor, as in the following statement:
StreamReader reader = new StreamReader(inFile);
After the StreamReader has been defined, the ReadLine() method can be used to retrieve one line at a time from the data file.For example, the following statement gets one line of data from the file and stores it in a string named recordIn:
string recordIn = reader.ReadLine();

What is the process of converting objects into streams of bytes known as?

(Multiple Choice)
4.8/5
(39)

A data file is what type of file when each record is read in order of its position in the file?

(Multiple Choice)
4.8/5
(42)

If you attempt to open a file with the Open file mode, what happens if the file does not exist?

(Multiple Choice)
4.8/5
(34)

What format is used by files that store music or images?

(Multiple Choice)
4.9/5
(46)

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);

(Essay)
4.8/5
(37)

What must be done in order to convert streams of bytes back into objects?

(Multiple Choice)
4.9/5
(40)

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?

(Essay)
4.8/5
(36)

What is a character?

(Essay)
4.9/5
(40)

Most computer users organize their files into directories, which are also known by what term?

(Multiple Choice)
4.8/5
(45)

When you produce screen output and accept keyboard input, you use the Console class, which provides access to which three standard streams?

(Essay)
4.9/5
(36)

When you perform an input operation in an application, the bytes flowing into your program from an input device typically are pictured by programmers as what?

(Multiple Choice)
4.9/5
(34)

Approximately how many bytes are in a gigabyte?

(Multiple Choice)
4.8/5
(42)

Permanent storage that does not lose contents when a computer loses power is known as what type of storage?

(Multiple Choice)
4.8/5
(32)

What file mode is used to open an existing file, and empty the file once opened so that the file is zero bytes in size?

(Multiple Choice)
4.8/5
(37)

Due to the fact that data can be erased from files, what term do programmers generally prefer over permanent storage?

(Multiple Choice)
4.8/5
(40)

What term describes any one of the letters, numbers, or other special symbols (such as punctuation marks) that comprise data.

(Multiple Choice)
4.8/5
(32)

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?

(Essay)
4.8/5
(31)
Showing 1 - 20 of 40
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)