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 the line of code sw = IO.File.CreateText(fileName) sw is a variable that holds the value of a filespec for an existing text file.
(True/False)
4.8/5
(38)
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)
(Multiple Choice)
4.8/5
(39)
When you place the OpenFileDialog control on a form, it will not be visible on the form.
(True/False)
5.0/5
(38)
The following statements are valid.
Dim filespec As String
filespec = InputBox ("Enter name of file to process:")
Dim sr As IO.StreamReader = IO.File.OpenText (filespec)
(True/False)
4.7/5
(44)
Which of the following exceptions will be generated by trying to access a disk drive that doesn't contain a disk?
(Multiple Choice)
4.8/5
(40)
The value of sr.EndOfStream is True when the end of file accessed by the StreamReader is reached.
(True/False)
4.7/5
(45)
An individual item of a text file cannot be changed or deleted directly.
(True/False)
4.8/5
(41)
A statement of the form IO.File.WriteAllLines("fileName.txt", numArray) copies the contents of the numeric array numArray into a text file.
(True/False)
4.9/5
(26)
Placing the statement Imports System.IO near the top of the Code Editor (before the Class frmName statement) simplifies file handling by eliminating the need to use the words StreamReader, StreamWriter, and File in your code.
(True/False)
4.7/5
(31)
The following statement causes the Open dialog box to become visible on the form. OpenFileDialog1.ShowDialog After a file has been selected and the Open button is pressed, the value of OpenFileDialog1.FileName will be the file's filespec; this will include all of the following except
(Multiple Choice)
5.0/5
(28)
The XML standard was recommended by the World Wide Web Consortium.
(True/False)
4.8/5
(39)
Which of the following statements is used when you want to add data to the end of an existing text file?
(Multiple Choice)
4.8/5
(36)
Showing 41 - 60 of 65
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)