Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 Which class allows you to use the Read() and ReadLine() methods to re

ID: 3761314 • Letter: Q

Question

Question 1

Which class allows you to use the Read() and ReadLine() methods to retrieve data from a text file?

Select one:

a. BinaryReader

b. FileReader

c. StreamReader

d. File

e. TextReader

Question 2

Which of the following would store an integer in a binary file?

Select one:

a. Write7BitEncodedInt()

b. WriteInt()

c. WriteLine()

d. StoreInt()

e. none of the above

Question 3

Which class allows you to use the Write () and WriteLine () methods to write data to a text file?

Select one:

a. File

b. FileWriter

c. BinaryWriter

d. StreamWriter

e. TextWriter

Question 4

When you are finished processing a text file, you should:

Select one:

a. call the Finished() method

b. call the Close() method

c. reset the file

d. throw an exception

e. erase the file

Question 5

To which namespace does the File class belong?

Select one:

a. System.Object

b. System.FileSystem

c. System.IO

d. Object

e. Object.IO

Question 6

All of the following are exceptions classes that are thrown in conjunction with files, except:

Select one:

a. FileNotFoundException

b. EndOfStreamException

c. DirectoryNotFoundException

d. IOException

e. InvalidDataFileException

Question 7

In Visual Studio, if you do not specify the full path of a file, what directory is used?

Select one:

a. C:WorkDirectory

b. the project directory

c. C:App_Data

d. binDebug or binRelease

e. C:

Question 8

Using the verbatim string, you could write the full path of

C:CSharpProjects ChI0 WorkDirectory as:

Select one:

a. @"C:CSharpProjectsChI0WorkDirectory"@

b. @"C:\CSharpProjects\ChI0\WorkDirectory"

c. @"C:CSharpprojectsChI0WorkDirectory"

d. "@C:CSharpprojectsChI0WorkDirectory"

e. none of the above

Question 9

All of the following methods of the BinaryReader class could be used to retrieve data, except:

Select one:

a. ReadChar()

b. Read()

c. ReadString()

d. ReadChars()

e. ReadInt()

Question 10

Which of the following methods could be used to retrieve a decimal value from a binary file?

Select one:

a. ReadDoubleValue()

b. ReadDecimalValue()

c. ReadDec()

d. ReadNumber()

e. ReadDecimal()

Explanation / Answer

1. b. FileReader
2. c. WriteLine() //it doesn't matter on data type, write line can be used for string, int etc.
3. b. FileWriter and buffered writer can also be used.
4. b. call the Close() method //file should be closed so that if some other process requires it then it can use.
5. c. System.IO. as it belongs to Input/Output class
6. d. IOException. Rest all belongs to files
7. b. the project directory //by default project directory is used.
8. b. @"C:\CSharpProjects\ChI0\WorkDirectory"
9. e. ReadInt() as data can be character too
10. a. ReadDoubleValue()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote