Deck 17: Files and Streams

Full screen (f)
exit full mode
Question
The classes dealing with files and directories are located in the System.IO namespace.
Use Space or
up arrow
down arrow
to flip the card.
Question
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
Question
What exception is thrown when an error occurs during serialization or deserialization

A) SerialException
B) DeserialException
C) SerializationException
D) DeserializationException
E) c and d, respectively
Question
Which of the following methods of FileStream will reset the file-position pointer back to the beginning of the file

A)Reset
B) Origin
C) Seek
D) Beginning
Question
An OpenFileDialog allows a user to select a file to open.
Question
________ are used for long-term retention of large amounts of data.

A) Memory cards
B) Buffers
C) Files
D) Data structures
Question
Each resource should be released as soon as it's no longer needed.
Question
Console.In,Console.Out and Console.Error are used to take data in,to display data and to show error messages,respectively.
Question
What kind of exception is thrown if there's a problem opening or creating a StreamWriter

A)Exception
B) StreamException
C) OpenAndCreatingException
D) IOException
Question
BinaryFormatters can be used to serialize and deserialize objects coming in and going out via a stream.
Question
The FileAccess.Read enumeration member is used if the file should not be modified.
Question
A _____________ contains the byte number of the next byte in a file to be read or written to a file.

A) data locator
B) file counter
C) file-position pointer
D) byte-number counter.
Question
The standard output stream object enables a program to output data to the
screen.
Question
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
Question
Use the _______ method of class OpenFileDialog to show a dialog that allows the user to select a file to be opened.

A) OpenFile
B) ChooseFile
C) ShowDialog
D) OpenFileDialog
Question
Data stored in a file is considered:

A) temporary data
B) persistent data
C) recurring data
D) there is no need to store data in files
Question
The enumeration FileAccess is used to:

A) control user access to a file
B) control program access to a file
C) control the amount of updating that can be done on a file at once
D) FileAccess is a method, not an enumeration
Question
Files can be stored in:

A) hard drives
B) optical disks
C) magnetic tapes
D) All of the above
Question
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
Question
When a file is opened,a stream object is created and associated with the file.
Question
Method GetFiles of class Directory can be used to display all the files in a given directory.
Question
Method ________ of class BinaryFormatter reads a serialized object from a stream and recreates the object in memory.

A) Deserial
B) Deserialize
C) Deserializable
D) DSerial
Question
.NET provides class _______ for manipulating files.

A) Folder
B) FileUtil
C) File
D) FileManip
Question
Class File can only create new files.
Question
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
Question
For variables of reference types,you must check the class declaration to ensure that the type is serializable.
Question
Class Directory is used to change directories.
Question
Which of the following attributes 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
Question
If the array contains references to other objects,those objects may or may not be serializable.
Question
Directory's method GetDirectories returns:

A)a string of all the names of sibling directories
B) an array of strings of all the names of sibling directories
C) a string of all the names of subdirectories
D) an array of strings of all the names of subdirectories
Question
BinaryFormatter's Serialize and Deserialize methods are both parameterless.
Question
All simple-type variables and strings are serializable.
Question
To create a new file and return a stream that can be used to process the file,use the:

A) CreateFile method of class File
B) NewFile method of class File
C) Create method of class File
D) New method of class File
Question
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
Question
By default,array objects are not serializable.
Question
In a class that's marked with the [Serializable] attribute or that implements inter
face ISerializable,not every instance variable of the class needs to be seri
alizable.
Question
Another way that a class could indicate to the CLR that objects of the class can be serialized is through implementing the ________ interface.

A)Serializable
B)ISerializable
C)Serial
D)Serialize
Question
BinaryFormatter allows only for reading objects.
Question
The name of the file to open is specified as the first argument to the FileStream constructor.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/39
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 17: Files and Streams
1
The classes dealing with files and directories are located in the System.IO namespace.
True
2
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
B
3
What exception is thrown when an error occurs during serialization or deserialization

A) SerialException
B) DeserialException
C) SerializationException
D) DeserializationException
E) c and d, respectively
C
4
Which of the following methods of FileStream will reset the file-position pointer back to the beginning of the file

A)Reset
B) Origin
C) Seek
D) Beginning
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
5
An OpenFileDialog allows a user to select a file to open.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
6
________ are used for long-term retention of large amounts of data.

A) Memory cards
B) Buffers
C) Files
D) Data structures
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
7
Each resource should be released as soon as it's no longer needed.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
8
Console.In,Console.Out and Console.Error are used to take data in,to display data and to show error messages,respectively.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
9
What kind of exception is thrown if there's a problem opening or creating a StreamWriter

A)Exception
B) StreamException
C) OpenAndCreatingException
D) IOException
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
10
BinaryFormatters can be used to serialize and deserialize objects coming in and going out via a stream.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
11
The FileAccess.Read enumeration member is used if the file should not be modified.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
12
A _____________ contains the byte number of the next byte in a file to be read or written to a file.

A) data locator
B) file counter
C) file-position pointer
D) byte-number counter.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
13
The standard output stream object enables a program to output data to the
screen.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
14
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
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
15
Use the _______ method of class OpenFileDialog to show a dialog that allows the user to select a file to be opened.

A) OpenFile
B) ChooseFile
C) ShowDialog
D) OpenFileDialog
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
16
Data stored in a file is considered:

A) temporary data
B) persistent data
C) recurring data
D) there is no need to store data in files
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
17
The enumeration FileAccess is used to:

A) control user access to a file
B) control program access to a file
C) control the amount of updating that can be done on a file at once
D) FileAccess is a method, not an enumeration
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
18
Files can be stored in:

A) hard drives
B) optical disks
C) magnetic tapes
D) All of the above
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
19
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
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
20
When a file is opened,a stream object is created and associated with the file.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
21
Method GetFiles of class Directory can be used to display all the files in a given directory.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
22
Method ________ of class BinaryFormatter reads a serialized object from a stream and recreates the object in memory.

A) Deserial
B) Deserialize
C) Deserializable
D) DSerial
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
23
.NET provides class _______ for manipulating files.

A) Folder
B) FileUtil
C) File
D) FileManip
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
24
Class File can only create new files.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
25
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
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
26
For variables of reference types,you must check the class declaration to ensure that the type is serializable.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
27
Class Directory is used to change directories.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
28
Which of the following attributes 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
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
29
If the array contains references to other objects,those objects may or may not be serializable.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
30
Directory's method GetDirectories returns:

A)a string of all the names of sibling directories
B) an array of strings of all the names of sibling directories
C) a string of all the names of subdirectories
D) an array of strings of all the names of subdirectories
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
31
BinaryFormatter's Serialize and Deserialize methods are both parameterless.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
32
All simple-type variables and strings are serializable.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
33
To create a new file and return a stream that can be used to process the file,use the:

A) CreateFile method of class File
B) NewFile method of class File
C) Create method of class File
D) New method of class File
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
34
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
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
35
By default,array objects are not serializable.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
36
In a class that's marked with the [Serializable] attribute or that implements inter
face ISerializable,not every instance variable of the class needs to be seri
alizable.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
37
Another way that a class could indicate to the CLR that objects of the class can be serialized is through implementing the ________ interface.

A)Serializable
B)ISerializable
C)Serial
D)Serialize
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
38
BinaryFormatter allows only for reading objects.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
39
The name of the file to open is specified as the first argument to the FileStream constructor.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 39 flashcards in this deck.