Wednesday, June 3, 2009

File and Streams

. The smallest data item in a computer is the _________.
A) bit
B) byte
C) kilobyte
D) None of the above.

Points Earned: 1.0/1.0
Correct Answer(s): A




2. Data stored in a file is considered:
A) there is no need to store data in files
B) temporary data
C) recurring data
D) persistent data

Points Earned: 1.0/1.0
Correct Answer(s): D




3. To create a new file and return a stream that can be used to process the file:
A) Create method of class File
B) NewFile method of class File
C) CreateFile method of class File
D) New method of class File

Points Earned: 1.0/1.0
Correct Answer(s): A




4. Files can be stored in:
A) hard drives
B) optical disks
C) magnetic tapes
D) All of the above

Points Earned: 1.0/1.0
Correct Answer(s): D




5. _______________ are used for long-term retention of large amounts of data.
A) Buffers
B) Files
C) Data structures.
D) Memory cards

Points Earned: 1.0/1.0
Correct Answer(s): B




6. A recursive search on a directory is one where:
A) a directory is searched and then all of its sub directories are searched.
B) each sub directory is searched and then the main directory is searched.
C) a search is done randomly on all directories.
D) A and C
E) A and B

Points Earned: 1.0/1.0
Correct Answer(s): E




7. An example of when a file should not be used is:
A) to save the status of a video game for another session.
B) to save the value of a variable at runtime.
C) to log errors in the execution of a program.
D) these are all good examples of when files should be used.

Points Earned: 1.0/1.0
Correct Answer(s): B




8. In a ____________ file, a record typically stored in order by a record-key field.
A) non-sequential
B) record-key
C) chronological
D) sequential

Points Earned: 1.0/1.0
Correct Answer(s): D




9. Directory's method GetDirectories returns:
A) a string of all the names of sibling directories
B) a string of all the names of subdirectories
C) an array of strings of all the names of sibling directories
D) an array of strings of all the names of subdirectories

Points Earned: 1.0/1.0
Correct Answer(s): D




10. One byte is composed of:
A) 10 bits
B) 2 bits
C) 8 bits
D) 4 bits

Points Earned: 1.0/1.0
Correct Answer(s): C




11. Buffering is used to:
A) convert data to binary code before it is stored
B) clean up data before it is filed
C) transfer data into a stream
D) force serialization

Points Earned: 1.0/1.0
Correct Answer(s): C




12. Computer circuitry is able to:
A) get the value of a bit
B) examine the value of a bit
C) reverse the value of a bit
D) All of the above

Points Earned: 1.0/1.0
Correct Answer(s): D




13. Binary code is actually:
A) a series of 0's and 1's.
B) machine language instructions.
C) a complex programming language.
D) a series of characters representing the numbers 0 to 9.

Points Earned: 1.0/1.0
Correct Answer(s): A




14. The Console.Error property returns:
A) a standard error stream object
B) a new error
C) an object of type error
D) None of the above

Points Earned: 1.0/1.0
Correct Answer(s): A




15. Another way that a class could indicate to the CLR that objects of the class can be serialized is through implementing the ________ interface.
A) Serialize
B) Serial
C) ISerializable
D) Serializable

Points Earned: 1.0/1.0
Correct Answer(s): C




16. .NET provides class _______ for manipulating files.
A) File
B) FileManip
C) Folder
D) FileUtil

Points Earned: 1.0/1.0
Correct Answer(s): A




17. A _____________ contains the byte number of the next byte in a file to be read or written to a file.
A) file-position pointer
B) data locator
C) file counter
D) byte-number counter.

Points Earned: 1.0/1.0
Correct Answer(s): A




18. Which of the following methods of FileStream will reset the file-position pointer back to the beginning of the file?
A) Seek
B) Beginning
C) Origin
D) Reset

Points Earned: 1.0/1.0
Correct Answer(s): A




19. Deserialize returns a reference of type:
A) object which must be cast to the appropriate type to manipulate the object
B) the type that the object was originally
C) Deserialized which must be cast to the appropriate type to manipulate the object
D) None of the above

Points Earned: 1.0/1.0
Correct Answer(s): A




20. Which of the following attribute is needed to indicate to the CLR that objects of the class can be serialized?
A) [Serializable]
B) [DeSerializable]
C) [Serialize]
D) both A and B

Points Earned: 1.0/1.0
Correct Answer(s): A




21. Use the _______ method of class OpenFileDialog to show a dialog that allows the user to select a file to be opened.
A) OpenFileDialog
B) ChooseFile
C) OpenFile
D) ShowDialog

Points Earned: 1.0/1.0
Correct Answer(s): D




22. The enumeration FileAccess is used to:
A) control program access to a file
B) control user access to a file
C) FileAccess is a method not an enumeration
D) control the amount of updating that can be done on a file at once

Points Earned: 1.0/1.0
Correct Answer(s): B




23. What kind of exception is thrown if there is a problem opening or creating a StreamWriter?
A) Exception
B) IOException
C) StreamException
D) OpenAndCreatingException

Points Earned: 1.0/1.0
Correct Answer(s): B




24. A serialized object is an object that includes:
A) a sequence of bytes that contain the object's data
B) information about the object's type
C) information about the types of data stored in the object
D) All of the above

Points Earned: 1.0/1.0
Correct Answer(s): D




25. When a FileStream object is opened, the file-position pointer is _________.
A) set to Null
B) set to 0
C) needs to be explicitly created
D) set to the end of the file

Points Earned: 1.0/1.0
Correct Answer(s): B




26. What is the exception thrown when an error occurs during serialization or deserialization?
A) SerialException
B) DeserialException
C) SerializationException
D) DeserializationException
E) C and D, respectively

Points Earned: 1.0/1.0
Correct Answer(s): C




27. Method ________ of class BinaryFormatter reads a serialized object from a stream and reforms the object in memory.
A) Deserial
B) DSerial
C) Deserializable
D) Deserialize

Points Earned: 1.0/1.0
Correct Answer(s): D




28. In a data hierarchy, data items become larger and more complex in structure as we progress from bits, to characters, to fields and up to large data structures.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




29. A field is a random group of characters.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




30. All files must end with an end-of-file marker, so that the computer knows where the file ends.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




31. When a file is opened, a stream object is created and associated with the file.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




32. Console.In, Console.Out and Console.Error are used to take data in, to display data and to show error messages.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




33. File-processing capabilities are important for a programming language to support commercial applications.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




34. The standard output stream object enables a program to output data to the screen.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




35. To distinguish fields or records there has to be one that is different from every other, this is called the record key.
A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




36. A record is a group of fields and a file is a group of records.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




37. Files can only be stored on a computers hard drive.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




38. Using MemoryStream and BufferedStream is inefficient.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




39. Class File can only create new files.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




40. Saving data to a file is the only way to keep that data when the program terminates.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




41. No matter how complicated a program is or looks it can all be broken down in to strings of 0's and 1's.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




42. Classes StreamIn and StreamOut are used to read from text files and output to text files.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




43. Class Directory is used to change directories.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




44. Characters in C# are Unicode characters, each represented by one byte.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




45. Data stored in arrays is permanent data.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




46. The FileAccess.Read enumeration member is used if the file should not be modified.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




47. If the array contains references to other objects, those objects may or may not be serializable.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




48. Being able to write a file is the only important part of filing.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




49. For variables of reference types, you must check the class declaration to ensure that the type is serializable.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




50. BinaryFormatters can be used to serialize and deserialize objects coming in and going out a stream.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




51. By default, array objects are not serializable.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




52. BinaryFormatter's Serialize and Deserialize methods are both parameterless.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




53. The classes dealing with files and directories are located in the System.IO namespace.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




54. In a class that is marked with the [Serializable] attribute or that implements interface ISerializable, not every instance variable of the class needs to be serializable.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




55. A StreamReader object must be created in order to retrieve data from a text file.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




56. Resource releasing should be done as soon as the resource is no longer needed.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




57. BinaryFormatter only allows for the reading of objects.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




58. All simple-type variables and strings are serializable.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




59. Sequential records are sorted on a keyA) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




60. Method GetFiles of class Directory can be used to display all the files in a given directory.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




61. Every file automatically closes itself when not needed.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): False




62. The name of the file to open is specified as the first argument to the FileStream constructor.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True




63. An OpenFileDialog allows a user to select a file to open.A) True
B) False

Points Earned: 1.0/1.0
Correct Answer(s): True

No comments:

Post a Comment