Exam 10: Structures and Sequential Access Files

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

Which of the following declares a StreamReader variable named newFile?

(Multiple Choice)
4.7/5
(39)

You can use the Strings.Space method to include a specific number of space characters in a string.

(True/False)
4.8/5
(37)

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

(Multiple Choice)
4.8/5
(29)

The following sample of code contains errors. Rewrite the incorrect statements to correct all errors. -Structure ExamGrades Public decExam1 As Decimal Public decExam2 As Decimal Public decExam3 As Decimal End Structure --------------------------- Private Function CalcAverage(ByVal grades As Decimal)As Decimal ' calculates and returns the average grade Dim decSum As Decimal decSum = grades.Exam1 + grades.Exam2 + grades.Exam3 Return decSum * 3 End Function --------------------------- Private Sub btnAverage_Click(ByVal sender As Object,ByVal e As System.EventArgs)Handles btnAverage.Click ' display the average exam grade Dim threeGrades As ExamGrades Dim decAverage As Decimal Decimal.TryParse(txtGrade1.Text,decExam1) Decimal.TryParse(txtGrade2.Text,decExam2) Decimal.TryParse(txtGrade3.Text,decExam3) decAverage = CalcAverage(threeGrades) lblResult.Text = decAverage.ToString("N1") End Sub

(Essay)
4.9/5
(42)

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
(24)

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

(Multiple Choice)
4.9/5
(39)

Files to which information is written are called input files.

(True/False)
4.7/5
(40)

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

(Essay)
4.7/5
(28)

Write the statement that would write two columns of text to an output file named outFile.The first column,which contains the data for the strStudentID variable,must contain nine characters.The second column contains the data for the strLastName variable.

(Short Answer)
4.8/5
(39)

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

(Multiple Choice)
4.9/5
(43)

After declaring a StreamReader variable,you can use the ____ to open a sequential access file for input; doing this automatically creates a StreamReader object.

(Multiple Choice)
4.9/5
(37)

An application contains the Structure statement shown below: Structure Furniture Public strStyle As String Public decPrice As Decimal End Structure Write a Dim statement that declares a Furniture variable named sofas.Then,write assignment statements that assign the value "Sectional" to the strStyle member,and assign the number 1895.99 to the decPrice member.

(Essay)
4.8/5
(35)

Case 1 - Frames Unlimited Frames Unlimited is a wholesale picture and poster frame business. Frame data is stored in sequential access files that contain four columns: item number, item name, size, and price. -You need to create a report using the pictureFrame.txt sequential access file.The report provides a list of all picture frames with a size of 5x7.The report will be saved as another sequential access file named pictureFrame57.txt.Your first step is to ____.

(Multiple Choice)
4.9/5
(40)

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

(Multiple Choice)
4.7/5
(34)

Case 1 - Frames Unlimited Frames Unlimited is a wholesale picture and poster frame business. Frame data is stored in sequential access files that contain four columns: item number, item name, size, and price. -Which of the following statements removes the selected line in the list box?

(Multiple Choice)
4.7/5
(37)

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

(Multiple Choice)
4.8/5
(41)

In the syntax for the PadLeft method,____ is an integer that represents the total number of characters you want the string to contain.

(Multiple Choice)
4.9/5
(33)

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

(True/False)
4.8/5
(41)

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

(Multiple Choice)
4.9/5
(32)

Programmers refer to a sequence of characters as a ____.

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

Filters

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