Deck 11: Data Files
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/43
العب
ملء الشاشة (f)
Deck 11: Data Files
1
The StreamWriter's WriteLine method places an Enter (carriage return)between the items in the data file.
True
2
The Peek method reads the next data element in a data file.
False
3
A delimited file is a data file that has all of the data stored on one line.
False
4
You must use the Retrieve method in order to access data in a file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
5
The StreamReader is used to create a data file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
6
Using a text editor such as Notepad,you can view the contents of a data file with a .txt file extension.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
7
VbCrLf is a VB intrinsic constant for a carriage return and a line feed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
8
A StreamWriter object can be declared in the Declarations section of a program or in a procedure.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
9
The data files that are presented in Chapter 11,Saving Data in Files,are commonly used to store large amounts of data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
10
The StreamReader object can be used to read data from a data file that has been created with a StreamWriter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
11
New data will be appended to the existing data file if you are using a StreamWriter that specifies the name of a data file that already exists and the code does not include a value for the BooleanAppend argument.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
12
When instantiating a StreamReader,an exception will occur if the data file does not exist in the specified path.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
13
In order to append data to an existing data file,set the BooleanAppend argument of the StreamWriter constructor to True.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
14
Data elements that are added to a data file in the append mode are written at the end of the file,but may later be read in random order.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
15
A new data file will be created if the filename does not exist when declaring a new StreamWriter object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
16
The StreamWriter's Close method does not always release the information in the buffer that is related to that file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
17
If you use the following line of code: Dim TestStreamWriter as New StreamWriter("Test.txt")and the file,Test.txt,already exists,a new file will be created and the existing file will be overwritten.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
18
It is not necessary to use a Try/Catch block when declaring a StreamReader object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
19
The WriteAllText()method reads data from a text file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
20
Visual Basic offers simplified File I/O objects and methods in the Microsoft.VisualBasic.FileIOlibrary.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
21
If you intend to write data to an existing data file and it is your intention to overwrite all of the data in a file,you should _______.
A)set the BooleanAppend argument of the StreamWriter constructor to True
B)not include the BooleanAppend argument in the StreamWriter constructor
C)set the BooleanAppend argument of the StreamWriter to False
D)Both answers B and C are correct
A)set the BooleanAppend argument of the StreamWriter constructor to True
B)not include the BooleanAppend argument in the StreamWriter constructor
C)set the BooleanAppend argument of the StreamWriter to False
D)Both answers B and C are correct
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
22
You can use _______ in order to allow the user to browse and find a file at run time.
A)the OpenFileDialog common dialog control
B)the StreamReader object
C)the OpenDialog control
D)a hard-coded path name
A)the OpenFileDialog common dialog control
B)the StreamReader object
C)the OpenDialog control
D)a hard-coded path name
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
23
In the statement,PhoneStreamWriter.WriteLine(NameTextBox.Text),NameTextBox.Text refers to _______.
A)the record number
B)the variable that will store the data in NameTextBox
C)the data file number
D)the Text property of the object that contains the data that will be written to disk
A)the record number
B)the variable that will store the data in NameTextBox
C)the data file number
D)the Text property of the object that contains the data that will be written to disk
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
24
If a program does not include exception handling,what will happen when a data file is opened with the StreamReader object and the file does not exist?
A)A file will be created.
B)The next available file on the disk will be opened.
C)A dialog box will automatically appear allowing the user to find the correct name or location of the file.
D)An unhandled exception will occur,causing the program to fail.
A)A file will be created.
B)The next available file on the disk will be opened.
C)A dialog box will automatically appear allowing the user to find the correct name or location of the file.
D)An unhandled exception will occur,causing the program to fail.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
25
Each element in a data file must be read in the same sequence as it was written.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
26
The _______ method of My.Computer.FileSystem is used to read an entire file into a single string.
A)WriteAllText
B)ReadAllText
C)ReadLine
D)WriteLine
A)WriteAllText
B)ReadAllText
C)ReadLine
D)WriteLine
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
27
Setting the BooleanAppend argument to True in the StreamWriter constructor _______.
A)will create a new data file
B)is used to add data to the end of existing data files
C)adds data to the beginning of an existing data file
D)reads data previously stored on disk
A)will create a new data file
B)is used to add data to the end of existing data files
C)adds data to the beginning of an existing data file
D)reads data previously stored on disk
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
28
Which of the following steps does NOT occur when writing data to a data file?
A)A new StreamWriter object must be declared.
B)The StreamWriter's WriteLine method will create a buffer in memory.
C)A new data file will always be created when a StreamWriter is declared.
D)The data to be written will be converted to string data.
A)A new StreamWriter object must be declared.
B)The StreamWriter's WriteLine method will create a buffer in memory.
C)A new data file will always be created when a StreamWriter is declared.
D)The data to be written will be converted to string data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
29
If you intend to add data to the end of an existing data file,you should set the _______ argument of the StreamWriter to True.
A)Boolean
B)Append
C)Output
D)BooleanAppend
A)Boolean
B)Append
C)Output
D)BooleanAppend
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
30
My.Computer.FileSystem.WriteAllText(FileName,StringToWrite,AppendBoolean)______.
A)creates a database file
B)creates a text file
C)is used to read data from a file
D)is used to add data to a database
A)creates a database file
B)creates a text file
C)is used to read data from a file
D)is used to add data to a database
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
31
When reading data in a data file,the data will be read _______.
A)in alphabetical order
B)in the order in which it was written
C)in key field order
D)in random order
A)in alphabetical order
B)in the order in which it was written
C)in key field order
D)in random order
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
32
What is the purpose of "WriteLine" in the following statement? PhoneStreamWriter.WriteLine(NameTextBox.Text)
A)WriteLine refers to the number of fields in the record.
B)WriteLine will display the content of NameTextBox.Text in a label named phoneStreamWriter.
C)WriteLine will write the data in the NameTextBox.Text textbox to the data file.
D)WriteLine will create a data file named NameTextBox.txt.
A)WriteLine refers to the number of fields in the record.
B)WriteLine will display the content of NameTextBox.Text in a label named phoneStreamWriter.
C)WriteLine will write the data in the NameTextBox.Text textbox to the data file.
D)WriteLine will create a data file named NameTextBox.txt.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
33
Use the StreamReader's Peek method to determine if there is more data in a file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
34
What should be used to handle exceptions and avoid terminating the program when an exception occurs during run-time?
A)Do / Loop
B)Off Error
C)Case Error
D)Try/Catch
A)Do / Loop
B)Off Error
C)Case Error
D)Try/Catch
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
35
When instantiating a StreamWriter object,the name of the file on the disk _______.
A)must be in uppercase characters
B)appears immediately after the word As
C)must be enclosed in quotes
D)All of these
A)must be in uppercase characters
B)appears immediately after the word As
C)must be enclosed in quotes
D)All of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which of the following will occur if you are opening a data file with the StreamReader object and the file does not exist?
A)The file will be created.
B)An exception will occur.
C)VB will automatically use the last file created with the StreamWriter.
D)VB will shut down the computer.
A)The file will be created.
B)An exception will occur.
C)VB will automatically use the last file created with the StreamWriter.
D)VB will shut down the computer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
37
Sometimes,a project will need to save the information that the user inputs so that it can be used again.The information is stored and will later be accessed from a(n)_______.
A)program file
B)project file
C)data file
D)user file
A)program file
B)project file
C)data file
D)user file
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
38
You can load data from a data file into a list box during run time by looping through the file and adding the file elements into the list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
39
When you are finished working with a data file,you should _______ the file.
A)Close
B)Append
C)Output
D)Answers A and B are both correct
A)Close
B)Append
C)Output
D)Answers A and B are both correct
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
40
The standard Windows OpenFileDialog component can be used in your VB program to allow users to browse for a folder and filename.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
41
If you want to do something before a project ends,such as ask the user a question,the best location to query the user is _______.
A)in the form's Load event
B)in the Exit buttons Query event
C)in the form's Query event
D)in the form's FormClosing event
A)in the form's Load event
B)in the Exit buttons Query event
C)in the form's Query event
D)in the form's FormClosing event
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
42
What is the difference between the Write method and the WriteLine method of a StreamWriter?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck
43
Visual Studio handles data files using streams.Explain the steps in writing data to a file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 43 في هذه المجموعة.
فتح الحزمة
k this deck