Filters
Question type

Study Flashcards

A file to which information is written is referred to as a(n) ____ file.


A) report
B) text
C) output
D) data

Correct Answer

verifed

verified

Write the code to declare a variable named outFile that can be used to write data to a sequential access file. Then write the statement to open a sequential access file named samples.txt for output. New data should be written to the file after any existing data in the file.

Correct Answer

verifed

verified

Dim outFile As IO.St...

View Answer

Describe two advantages to programmers of using structures and structure variables.

Correct Answer

verifed

verified

Programmers use structure variables when...

View Answer

Which of the following can be used to determine whether the accounts.txt file exists?


A) If IO.Exists.File("accounts.txt") Then
B) If IO.File.Exists("accounts.txt") Then
C) If IO.File("accounts.txt") Then
D) If IO.Exists("accounts.txt") Then

Correct Answer

verifed

verified

To access a member of a structure variable in an array, you use the syntax ____.


A) arrayName ( subscript ) . memberVariableName
B) arrayName ( subscript ) -> memberVariableName
C) arrayName ( subscript ) [ memberName ]
D) arrayName ( subscript ) @ memberName

Correct Answer

verifed

verified

Programmers refer to a sequence of characters as a ____.


A) string of characters
B) stream of characters
C) file
D) variable

Correct Answer

verifed

verified

Data types created using the Structure statement are referred to as user-defined data types or structures.

Correct Answer

verifed

verified

Most programmers use the Structure statement, rather than the Class statement, to create data types that contain procedures.

Correct Answer

verifed

verified

The Peek method, looks ahead into the file to determine whether the file contains another character to read.

Correct Answer

verifed

verified

A(n) ____ is defined as a sequence (stream) of characters followed by the newline character.


A) character
B) line
C) input
D) stream

Correct Answer

verifed

verified

The syntax used to declare a StreamWriter variable is ____.


A) {Dim|Private} streamWriterVariableName IO.StreamWriter
B) {Dim|Private} streamWriterVariableName As IN.StreamWriter
C) {Dim|Private} streamWriterVariableName As IO.StreamWriter
D) {Dim|Private} streamWriterVariableName As StreamWriter

Correct Answer

verifed

verified

Which of the following statements can be used to fill a string variable with asterisks resulting in "*****$675.89"?


A) amount=amount.Fill(12,"*")
B) amount=amount.Insert(5,"*")
C) amount=amount.PadLeft(12,"*")
D) amount=amount.Space(5, "*")

Correct Answer

verifed

verified

You can use the ____ to open a sequential access file for append.


A) CreateText method
B) StreamReader object
C) StreamWriter object
D) AppendText method

Correct Answer

verifed

verified

Problems - Correcting Logic and Code Errors The following sample of code contains errors. Rewrite the incorrect statements to correct all errors. Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click ' display the contents of the students.txt file ' declare variables Dim inFile As IO.StreamWriter Dim strStudent As String ' clear previous students from the Students box lblStudents.Text = String.Empty ' determine whether the file exists If IO.Exists("students.txt") = True Then ' open the file for input inFile = IO.File.ReadText("students.txt") ' process loop instructions until end of file Do Until inFile.Peek -1 ' read a student line strStudent = inFile.ReadLine ' display the student lblStudents.Text = lblStudents.Text & strStudent & ControlChars.NewLine Loop ' close the file Me.Close() Else MessageBox.Show("File not found","Students", MessageBoxButtons.OK, MessageBoxIcon.Information) End If End Sub

Correct Answer

verifed

verified

Private Sub btnDisplay_Click(ByVal sende...

View Answer

Write a Do clause that reads each line of text in a sequential access file and assigns the line to the strTextLine variable. Process the loop until the end of the file has been reached. The file is associated with a StreamReader variable named inFile .

Correct Answer

verifed

verified

Do Until inFile.Peek...

View Answer

Which of the following statements will write the text "Programming" to a sequential access file?


A) outFile.Write("Programming")
B) outFile.Append("Programming")
C) outFile.Write{"Programming"}
D) outFile.Add["Programming"]

Correct Answer

verifed

verified

Write the code to declare a variable named inFile that can be used to read data from a sequential access file. Then write the statement to open a sequential access file named samples.txt for input.

Correct Answer

verifed

verified

Dim inFile As IO.Str...

View Answer

Which of the following opens the employee.txt file for output, creates a StreamWriter object, and assigns it to the outFile variable?


A) outFile = File.CreateText("F:\employee.txt")
B) outFile = IO.File.CreateText("F:\employee.txt")
C) outFile = File.CreateText("F:\")
D) outFile = IO.File.Create("F:\employee.txt")

Correct Answer

verifed

verified

Variables declared using a structure are often referred to as ____.


A) functions
B) Subs
C) structure variables
D) objects

Correct Answer

verifed

verified

The members of a structure can be variables, constants, or ____.


A) structures
B) classes
C) procedures
D) control characters

Correct Answer

verifed

verified

Showing 21 - 40 of 60

Related Exams

Show Answer