Exam 8: Text Files
Exam 1: An Introduction to Computers and Problem Solving36 Questions
Exam 2: Visual Basic, Controls, and Events61 Questions
Exam 3: Variables, Input, and Output101 Questions
Exam 4: Decisions86 Questions
Exam 5: General Procedures70 Questions
Exam 6: Repetition73 Questions
Exam 7: Arrays87 Questions
Exam 8: Text Files65 Questions
Exam 9: Additional Controls and Objects90 Questions
Exam 10: Databases34 Questions
Exam 11: Object-Oriented Programming66 Questions
Select questions type
In order to use the OpenFileDialog control, the programmer must first change its Name property to something other than the default OpenFileDialog1.
(True/False)
4.8/5
(33)
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)
(Multiple Choice)
4.8/5
(34)
If the value of IO.File.Exists(filespec) is True, then the specified file exists.
(True/False)
4.9/5
(30)
If an existing text file is opened for output, the computer will append any new data to the end of this existing file.
(True/False)
4.8/5
(35)
Which exception will the following code generate?
Dim num1 As Integer, num2 As Integer = 1000000
num1 = num2 * num2
(Multiple Choice)
4.9/5
(42)
Consider the following code. The Catch block of code will not be executed if the user enters which of the following when prompted?
Private Sub btnCalc_Click(...) Handles btnCalc.Click
Dim newNum, finalNum As Integer
Dim message, message1 As String
Try
newNum = CInt(InputBox("How old are you?"))
Catch
message = "That answer is not an Integer value."
MessageBox.Show(message)
newNum = 0
Finally finalNum = newNum + 1
message1 = "Your age next year will be " & finalNum & "."
MessageBox.Show(message1)
End Try
End Sub
(Multiple Choice)
4.9/5
(41)
The following statement could be used to set the Filter property of the OpenFileDialog control so that it displays files with the .txt extension.
(True/False)
4.8/5
(41)
When using Try-Catch-Finally blocks, the programmer is limited to three Catch blocks of code.
(True/False)
4.9/5
(37)
When a text file is created in Visual Basic using a StreamWriter, the extension .txt is automatically added to the file name if no other extension is specified.
(True/False)
4.9/5
(27)
What property is set to False in order to remove the row header column on the left side of a DataGridView control?
(Multiple Choice)
4.8/5
(34)
Which exception will the following code generate?
Dim str As String
str = "Visual Basic".Substring(14,2)
(Multiple Choice)
4.8/5
(43)
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)
(Multiple Choice)
4.8/5
(40)
XML files must be loaded into XElement objects before being accessed with LINQ.
(True/False)
4.8/5
(32)
Which of the following terms is NOT used to refer to elements in an XML document?
(Multiple Choice)
4.7/5
(33)
In a Try-Catch-Finally block, the code in the first listed Catch block is executed if an exception is thrown in the Try block.
(True/False)
4.8/5
(36)
Select the example statement below that would open a text file for output.
(Multiple Choice)
4.8/5
(37)
What method is used to copy the contents of a string array or LINQ query into a text file?
(Multiple Choice)
4.8/5
(41)
The following statement could be used to set the Filter property of the OpenFileDialog control so that it displays files with the .txt extension.
(True/False)
4.9/5
(34)
Showing 21 - 40 of 65
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)