P.S: This is just a study guide. The questions may not appear exactly like this.
1. A cassette tape’s methodology for accessing a single song is analogous to _____.
• a relational database
• VSAM file
• a sequential file
• an object-oriented database
2. A sequential access file is often used to _____.
• store data
• sort data
• streamline program code
• All of the above
3. “Appending” data to a file means you want to _____.
• add data at the end of the file
• add data at the beginning of the file
• search for the matching position in the file and add data there
• All of the above
4. To add data to a new file, you would _____.
• read and write a file
• append a file
• update a file
• create a file
5. Once you finish processing data in a file, you should _____ the file to avoid losing all of its data.
• close
• append
• exit
• output
6. When reading data from a sequential file, the data will be read _____.
• in alphabetical order
• sorted from smallest to largest
• in key field order
• in the order in which it was written
7. The sequential files created with our programs are exactly like data files created with _____.
• Microsoft Word
• Windows Notepad
• Windows Wordpad
• Microsoft OneNote
• All of the above
8. The Peek function can be used to help us detect the _____ character in a sequential file.
• end-of-function
• end-of-file
• start-of-function
• start-of-file
9. Select the example statement below that would open a sequential file for output.
• Dim sr As IO.StreamReader = IO.File.AppendText(“GRADES.TXT”)
• Dim sw As IO.StreamWriter = IO.File.CreateText(“GRADES.TXT”)
• Dim sw As IO.StreamWriter = IO.File.OpenText(“GRADES.TXT”)
• Dim sr As IO.StreamReader = IO.File.OpenText(“GRADES.TXT”)
10. Assume the file MONTHS.TXT contains 12 records, the names of all calendar months in ascending order. What is stored in OUTPUT.TXT after the following code is executed?
Dim letter As String
Dim sr As IO.StreamReader = IO.File.OpenText(“MONTHS.TXT”)
Do While sr.Peek -1
Dim sw As IO.StreamWriter = IO.File.CreateText(“OUTPUT.TXT”)
letter = sr.ReadLine
sw.WriteLine(letter)
sw.Close()
Loop
sr.Close()
• All the month names in descending order
• All the month names in ascending order
• December
• January
11. Give three different file modes that Visual Basic allows you to use when accessing a file.
File can be opened in 3 different modes