Exam 10: Structures and Sequential Access Files

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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.

(Essay)
4.7/5
(40)

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

(Essay)
4.8/5
(40)

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

(Multiple Choice)
4.8/5
(30)

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

(True/False)
4.8/5
(28)

Programmers refer to a sequence of characters as a ____.

(Multiple Choice)
4.9/5
(42)

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.

(Essay)
4.8/5
(33)

The syntax used to declare a StreamWriter variable is ____.

(Multiple Choice)
4.9/5
(35)

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

(Multiple Choice)
4.8/5
(31)

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

(Multiple Choice)
4.7/5
(34)

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

(Multiple Choice)
4.8/5
(33)

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

(True/False)
4.9/5
(42)

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

(Multiple Choice)
4.9/5
(40)

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 .

(Essay)
4.9/5
(37)

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

(Multiple Choice)
4.8/5
(33)

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

(Multiple Choice)
4.8/5
(30)

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

(Essay)
4.9/5
(36)

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

(Multiple Choice)
4.8/5
(37)

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

(Multiple Choice)
4.7/5
(35)

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

(True/False)
4.8/5
(38)

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

(Multiple Choice)
4.8/5
(34)
Showing 21 - 40 of 60
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)