Deck 10: Structures and Sequential Access Files
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/58
Play
Full screen (f)
Deck 10: Structures and Sequential Access Files
1
Variables declared using a structure are often referred to as ____.
A) functions
B) Subs
C) structure variables
D) objects
A) functions
B) Subs
C) structure variables
D) objects
C
2
A file to which information is written is referred to as a(n)____ file.
A) report
B) text
C) output
D) data
A) report
B) text
C) output
D) data
C
3
To access a member of a structure variable in an array,you use the syntax ____. 

A
4
Files that are read by the computer are called ____ files.
A) storage
B) serial
C) input
D) report
A) storage
B) serial
C) input
D) report
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
5
You cannot include an array in a structure.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
6
Programmers use structure variables to store related items in an array,even when the items have different data types.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
7
Most programmers use the Structure statement,rather than the Class statement,to create data types that contain procedures.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
8
Data types created using the Structure statement are referred to as user-defined data types or structures.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
9
You can use the ____ to open a sequential access file for output.
A) CreateText method
B) StreamReader object
C) StreamWriter object
D) AppendText method
A) CreateText method
B) StreamReader object
C) StreamWriter object
D) AppendText method
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
10
You reserve memory locations by declaring a structure variable.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
11
Examples of text stored in sequential access files include an employee list,a memo,or a sales report.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
12
Files to which information is written are called input files.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
13
Programmers refer to a sequence of characters as a ____.
A) string of characters
B) stream of characters
C) file
D) variable
A) string of characters
B) stream of characters
C) file
D) variable
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
14
The syntax used to declare a StreamWriter variable is ____. 

Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
15
When you pass a structure variable to a Sub or Function procedure,its member variables are not automatically passed.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
16
You use the ____ member access operator to separate the structure variable's name from the member variable's name.
A) ()
B) arrow
C) asterisk
D) dot
A) ()
B) arrow
C) asterisk
D) dot
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
17
The members of a structure can be variables,constants,or ____.
A) structures
B) classes
C) procedures
D) control characters
A) structures
B) classes
C) procedures
D) control characters
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
18
You can use the Strings.Space method to include a specific number of space characters in a string.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
19
Getting data from a file is referred to as "reading from the file," and sending data to a file is referred to as "writing to the file."
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
20
In Visual Basic,you use a(n)____ to write a stream of characters to a sequential access file.
A) CreateText method
B) StreamReader object
C) StreamWriter object
D) AppendText method
A) CreateText method
B) StreamReader object
C) StreamWriter object
D) AppendText method
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
21
You should use the ____ method to close a sequential access file as soon as you are finished using it.
A) Exit
B) Close
C) End
D) Quit
A) Exit
B) Close
C) End
D) Quit
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
22
Which of the following statements will write the text "Programming" to a sequential access file? 

Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
23
Which of the following statements can be used to fill a string variable with asterisks resulting in "*****$675.89"? 

Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
24
Which of the following determines whether an item is selected in the lstTrees control? 

Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
25
Which of the following statements will read data from a sequential access file?
A) inFile.Read
B) inFile.Peek
C) inFile.ReadWrite
D) inFile.ReadLine
A) inFile.Read
B) inFile.Peek
C) inFile.ReadWrite
D) inFile.ReadLine
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
26
The ____ method writes a newline character after the data.
A) WriteLine
B) ReadLine
C) Write method
D) Read
A) WriteLine
B) ReadLine
C) Write method
D) Read
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
27
Assume that the variable amount contains the value 46.How many characters will be padded in the statement below? amount = amount.ToString.PadLeft(5)
A) two
B) three
C) four
D) five
A) two
B) three
C) four
D) five
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
28
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 ____.
A) declare a StreamWriter variable for the output file
B) open the pictureFrame57.txt file for output using the CreateText method
C) declare a StreamReader variable for the input file
D) open the pictureFrame.txt file
A) declare a StreamWriter variable for the output file
B) open the pictureFrame57.txt file for output using the CreateText method
C) declare a StreamReader variable for the input file
D) open the pictureFrame.txt file
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
29
In the syntax for the PadLeft method,____ is an integer that represents the total number of characters you want the string to contain.
A) totalChars
B) character
C) variable
D) string
A) totalChars
B) character
C) variable
D) string
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
30
Which of the following can be used to determine whether the accounts.txt file exists? 

Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
31
You can use the ____ to open a sequential access file for append.
A) CreateText method
B) StreamReader object
C) StreamWriter object
D) AppendText method
A) CreateText method
B) StreamReader object
C) StreamWriter object
D) AppendText method
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
32
After declaring a StreamReader variable,you can use the ____ to open a sequential access file for input;doing this automatically creates a StreamReader object.
A) OpenText method
B) Write method
C) StreamWriter object
D) ReadLine method
A) OpenText method
B) Write method
C) StreamWriter object
D) ReadLine method
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
33
Which of the following declares a StreamReader variable named newFile?
A) Dim inFile As IO.StreamReader
B) Dim newFile As IO.StreamReader
C) Dim newFile As IO.StreamWriter
D) Dim newFile As StreamReader
A) Dim inFile As IO.StreamReader
B) Dim newFile As IO.StreamReader
C) Dim newFile As IO.StreamWriter
D) Dim newFile As StreamReader
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
34
Which of the following statements should be used first when opening the input file? 

Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
35
Which of the following removes the sixth item from the lstTrees control? 

Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
36
In Visual Basic,you use a(n)____ to read data from a sequential access file.
A) StreamWriter object
B) OpenText method
C) ReadLine method
D) StreamReader object
A) StreamWriter object
B) OpenText method
C) ReadLine method
D) StreamReader object
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
37
After opening a file for input,you can use the ____ to read the file's contents,one line at a time.
A) ReadLine method
B) OpenText method
C) AppendText method
D) WriteLine method
A) ReadLine method
B) OpenText method
C) AppendText method
D) WriteLine method
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
38
Which of the following statements will close the sequential access file associated with the outFile variable?
A) outFile.End()
B) outFile.Quit()
C) outFile.IO()
D) outFile.Close()
A) outFile.End()
B) outFile.Quit()
C) outFile.IO()
D) outFile.Close()
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
39
Which of the following opens the employee.txt file for output,creates a StreamWriter object,and assigns it to the outFile variable? 

Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
40
A(n)____ is defined as a sequence (stream)of characters followed by the newline character.
A) character
B) line
C) input
D) stream
A) character
B) line
C) input
D) stream
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
41
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.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
42
Write a Structure statement that defines a structure named Order.The structure contains four member variables named strItemNum,strItemDesc,decPrice,and intQuantity.Then write the Dim statement that declares an Order variable named furniture.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
43
Write an If clause that determines whether the sequential access file named contacts.txt exists.If the file exists,open the file.If the file does not exist,display the message "File not found" in a message box.The application is named "View Contacts".
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
44
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 customers.txt for output.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
45
Write the statement that would remove the item "RGT12985" from the lstPartNumber control.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
46
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.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
47
Write a Structure statement that defines a structure named Vehicle.The structure contains three member variables named strMake,strModel,and intYear.Then write the Private statement that declares a Vehicle variable named truck.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
48
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.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
49
An application contains the Structure statement shown below:
Write a Dim statement that declares an eight-element one-dimensional array of SalonInfo variables.Name the array mySalonInfo.Write the code to store the following data in the array:



Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
50
What is the difference between an input file and an output file?
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
51
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.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
52
Write the statement that would remove the selected item from the lstFlowers control if an item is selected.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
53
An application contains the Structure statement shown below:
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.

Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
54
You should ____ the pictureFrame.txt file as soon as you have finished using it.
A) Save
B) Read
C) Close
D) Peek
A) Save
B) Read
C) Close
D) Peek
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
55
Which of the following statements removes the selected line in the list box? 

Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
56
An application uses the posterFrame.txt sequential access file to display all of the poster frames in a list box.You need to use the list box to select and remove any poster frames that are 16x20.Which of the following statements determines if a line is selected in the list box? 

Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
57
Describe two advantages to programmers of using structures and structure variables.
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck
58
What is the difference between a structure and a structure variable?
Unlock Deck
Unlock for access to all 58 flashcards in this deck.
Unlock Deck
k this deck