Section 8.1 Managing Text Files
1.
What method is used to copy the contents of a string array or LINQ query into a text file?
(A)
(B)
(C)
(D)
2.
Which of the following methods is used to change the words in a column header of a
DataGridView control?
(A)
(B)
(C)
(D)
3.
CreateTextFile
WriteAllLines
CopyToTextFile
ReadAllLines
B
HeaderText
HeaderName
HeaderContent
HeaderCaption
A
What property is set to False in order to remove the row header column on the left side of a
DataGridView control?
(A)
(B)
(C)
(D)
ShowRowHeader
DisplayRowHeader
RowHeaderVisible
RowHeaderEnabled
C
4.
A statement of the form IO.File.WriteAllLines("fileName.txt", numArray) copies the contents of the numeric array numArray into a text file. (T/F)
F
5.
The acronym CSV stands for "Comma Separated Values". (T/F)
T
6.
Each record of the file UN.txt contains four pieces of information (name, continent, population in millions, area) about one of the 192 member countries of the United Nations.
The first two lines of the file are
Afghanistan,Asia,28.2,251772
Albania,Europe,3.2,11100
What is the first line of the file created by the following code?
Dim query = From line In IO.File.ReadAllLines("UN.txt")
Let data = line.Split(","c)
Let country = data(0)
Let continent = data(1)
Select country & " is in " & continent
IO.File.WriteAllLines("NewFile.txt", query)
(A)
(B)
(C)
(D)
7.
Afghanistan is in Asia
Albania is in Europe country is in continent
The new file will be empty.
A
Each line of the file UN.txt contains four pieces of information (name, continent, population in millions, area) about one of the 192 member countries of the United Nations. The first two lines of the file are
Afghanistan,Asia,28.2,251772
Albania,Europe,3.2,11100
What is the first line of the file created by the following code?
Dim query = From line In IO.File.ReadAllLines("UN.txt")
Let data = line.Split(","c)
Let country = data(0)
Let population = 1000000 * CDbl(data(2))
Select country & "," &