CHAPTER08

Topics: XML, .NET Framework, Java Pages: 19 (2686 words) Published: January 25, 2015
Chapter 8 Text Files
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 & "," & population
IO.File.WriteAllLines("NewFile.txt", query)

(A)
(B)
(C)
(D)

Afganistan,28.2
Afganistan,28,200,000
Afganistan,28200000
country,population

C

8.

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))
Let area = CDbl(data(3))
Let density = population / area
Select country & "," & density.ToString("N1")
IO.File.WriteAllLines("NewFile.txt", query)

(A)
(B)
(C)
(D)

Afganistan,28200000/251772
Afganistan,112.0
Afganistan,112.006100757829
country,density

B
9.

What elements are in the array newArray after the following code is executed? Dim firstArray() As Integer = {1, 2, 3}
Dim secondArray() As Integer = {3, 4, 5, 6}
Dim newArray() As Integer = firstArray.Intersect(secondArray).ToArray

(A)
(B)
(C)
(D)

1, 2, 3, 3, 4, 5, 6
1, 2, 3, 4, 5, 6
3
1, 2

C
10. What elements are in the array newArray after the following code is executed? Dim firstArray() As Integer = {1, 2, 3}
Dim secondArray() As Integer = {3, 4, 5, 6}
Dim newArray() As Integer = firstArray.Union(secondArray).ToArray

(A)
(B)
(C)
(D)

1, 2, 3, 3, 4, 5, 6
1, 2, 3, 4, 5, 6
3
1, 2

B

11. What elements are in the array newArray after the following code is executed? Dim firstArray() As Integer = {1, 2, 3}
Dim secondArray() As Integer = {3, 4, 5, 6}
Dim newArray() As Integer = firstArray.Except(secondArray).ToArray

(A)
(B)
(C)
(D)

1, 2, 3, 3, 4, 5, 6
1, 2, 3, 4, 5, 6
3
1, 2

D
12. How many elements are in...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Chapter08 Essay
  • Chapter08 Research Paper
  • Essay on Chapter08 review questions

Become a StudyMode Member

Sign Up - It's Free