Examlex
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
Reframing
The process of changing the way a situation or experience is viewed or interpreted, often to find more positive or empowering perspectives.
Out-of-the-Loop Employees
Workers who are not privy to important information within their workplace, often leading to feelings of exclusion and detachment.
Information Technology
The use of computers, storage, networking, and other physical devices, infrastructure and processes to create, process, store, secure, and exchange all forms of electronic data.
Social Behavior
encompasses the actions and reactions of individuals or groups in interaction with others within a social context.
Q1: Assume that the data for salary is
Q5: Explain the difference between a pretest loop
Q13: The code in the _ allows an
Q22: Based on the code below, intScores(3, 1)
Q25: The assignment operator in Visual Basic is
Q29: The _ method pads the string on
Q41: An application contains the Structure statement shown
Q50: The Class statement ends with the keyword(s)
Q54: Each menu in an application does not
Q580: The database object called Macro displays data