Here is the listing of our program to read and display a file one record at a time:

Private Sub btnList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnList.Click
'  declare a new StreamReader and Open the file
   Dim nameFile As System.IO.StreamReader
   nameFile = New System.IO.StreamReader("a:/friends.txt")
'  declare other variables
   Dim strIn As String ' a string variable used to hold the records as they are read
   txtOut.Clear()      ' clear the output area
'  loop to read and display the file
   Do Until nameFile.Peek = -1
      strIn = nameFile.ReadLine
      txtOut.AppendText(strIn & vbCrLf)
   Loop
   nameFile.Close()
   txtOut.AppendText("That's all, folks!")
End Sub
Which of the following is/are true?
  1. StreamReader is a nameFile
  2. nameFile is a StreamReader
  3. nameFile is an object
  4. nameFile is a file name
  5. nameFile is a class
  6. nameFile is a method
  7. StreamReader is an object
  8. StreamReader is a file name
  9. StreamReader is a class
  10. StreamReader is a method
  11. A program might have several StreamReaders
  12. A program might have several nameFiles
  13. Peek is a property of StreamReader
  14. Peek is a method of StreamReader
  15. Peek is a property of nameFile
  16. Peek is a method of nameFile

Explain your answers.


Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.