Deck 7: Lists, loops, and Printing
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
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/76
Play
Full screen (f)
Deck 7: Lists, loops, and Printing
1
An "iteration" is a single execution of the statement(s)in the loop.
True
2
It is possible to add values to a list box or combo box during design by using the Items property.
True
3
The Alphabetize property can be set to True and the combo or list box will automatically be sorted when an item is added to the list.
False
4
To add scroll bars to list boxes and combo boxes you must set the ScrollAlwaysVisible property to True.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
5
To remove an individual item from a list box,you can use the Remove method and specify the index of the item.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
6
The Clear method is used to empty the contents of a list or combo box.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
7
Items are added to a list box during design-time with the ListIndex property.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
8
If you want to remove an item from a list during run time,you can use either the Items.RemoveAt method or the Items.Remove method.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
9
If a list contains 15 items,the Count property will be 15 and the highest SelectedIndex property will be 16.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
10
The TextChanged event procedure occurs once for every keystroke entered.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
11
Boolean variables only hold the values True or False.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
12
The statements in a loop may never be performed if a loop begins with Do Until.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
13
List boxes and combo boxes have a Text property that can be accessed at design time.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
14
Boolean variables are commonly referred to as switches or flags.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
15
List boxes and combo boxes can only hold numeric values.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
16
Use the code: NamesListBox.SelectedIndex = -1,to deselect all items in a list.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
17
List boxes have a Text property,but it can only be accessed at run time.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
18
The SelectedIndex property can be used to select an item in the list or to determine which item is selected.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
19
A loop that begins with Do Until will test the condition at the top of the loop.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
20
The code,"NameLabel.Text = NameComboBox.Text",or the code,"NameLabel.Text = NameComboBox.Items(NameComboBox.SelectedIndex)" will display the selected name in NameLabel.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
21
List boxes and combo boxes _______.
A)are created with the same tool from the toolbox
B)have a Text property during design time
C)hold a list of values
D)always have scroll bars
A)are created with the same tool from the toolbox
B)have a Text property during design time
C)hold a list of values
D)always have scroll bars
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
22
You can specify the X and Y coordinates for each element on the graphics page.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
23
The Continue statement can be used to skip to the next iteration of a loop.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
24
Use the Select method of a text box in order to select the text in the text box.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
25
To start printing output,you execute the Print method of the PrintDocument component.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
26
Use the WriteString method to send a line of text to the graphics page.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
27
Assign a valid index to the SelectedIndex property of a list box in order to make an item in the list appear selected.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
28
Set up output for the printer using the methods and events of the Printer component.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
29
The identifier for a loop index in a For/Next statement must be LoopIndexInteger.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
30
Values for the items in a list _______.
A)can be entered in the Items collection in the Properties window
B)can be entered in the Values collection in the Properties window
C)can be entered in the AddItem collection in the Properties window
D)must be entered in alphabetical order
A)can be entered in the Items collection in the Properties window
B)can be entered in the Values collection in the Properties window
C)can be entered in the AddItem collection in the Properties window
D)must be entered in alphabetical order
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
31
The X and Y coordinates define the upper-left corner of an element on a graphics page.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
32
Use the _______ control from the toolbox to create list boxes on a form.
A)List
B)ListBox
C)ComboBox
D)SimpleList
A)List
B)ListBox
C)ComboBox
D)SimpleList
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
33
Items in a list can be placed in alphabetical order by _______.
A)setting the Sorted property to True
B)selecting the item in the list and then using the arrow keys to move the item up or down the list
C)setting the Alphabetize property to True
D)setting the Index property to 1
A)setting the Sorted property to True
B)selecting the item in the list and then using the arrow keys to move the item up or down the list
C)setting the Alphabetize property to True
D)setting the Index property to 1
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
34
Items can be added to a list during run time using the _________ method.
A)AddLists
B)Lists
C)ItemsAdd
D)Items.Add
A)AddLists
B)Lists
C)ItemsAdd
D)Items.Add
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
35
The data that appears in a combo box when it is first displayed can be added to the combo box _______.
A)using the Form_Load procedure and the combo box Items.Add method
B)during design time in the Items Collection of the combo box
C)using the ComboBox.Add()method
D)Answers A and B are correct.
A)using the Form_Load procedure and the combo box Items.Add method
B)during design time in the Items Collection of the combo box
C)using the ComboBox.Add()method
D)Answers A and B are correct.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
36
Items can be added to a list during design time using the _________ collection.
A)AddLists
B)Items
C)ItemsAdd
D)AddItems
A)AddLists
B)Items
C)ItemsAdd
D)AddItems
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
37
Which of the following is NOT a style for combo boxes?
A)Simple
B)DropDown
C)DropDownList
D)SimpleList
A)Simple
B)DropDown
C)DropDownList
D)SimpleList
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
38
Use the Exit For statement if you need to terminate a For/Next loop before the loop index reaches its final value.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
39
The counter in a For/Next loop can be a variable or a constant.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
40
A _______ control contains a text box as part of the control.
A)Frame
B)ListBox
C)ComboBox
D)DropDownList
A)Frame
B)ListBox
C)ComboBox
D)DropDownList
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
41
The statements inside of a Do Until/Loop may never be executed if _______.
A)the terminating condition is at the top of the loop and it is True the first time it is tested
B)the terminating condition is at the bottom of the loop and it is True the first time it is tested
C)Both answers A and B would cause the statements in the loop not to be executed.
D)The statements in the loop will always be executed.
A)the terminating condition is at the top of the loop and it is True the first time it is tested
B)the terminating condition is at the bottom of the loop and it is True the first time it is tested
C)Both answers A and B would cause the statements in the loop not to be executed.
D)The statements in the loop will always be executed.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
42
A single execution of a group of instructions inside a Do/Loop is called _______.
A)an iteration
B)a loop
C)a set
D)a group
A)an iteration
B)a loop
C)a set
D)a group
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
43
Which of the following code examples can be used to determine the number of items in a list box named ColorListBox?
A)ColorListBox.Count.Index
B)ColorListBox.Items.Count
C)ColorListBox(Items.Total)
D)ColorListBox.SelectedIndex
A)ColorListBox.Count.Index
B)ColorListBox.Items.Count
C)ColorListBox(Items.Total)
D)ColorListBox.SelectedIndex
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
44
Which text box event occurs when a text box gets the focus?
A)Click event
B)Enter event
C)Leave event
D)TextChanged event
A)Click event
B)Enter event
C)Leave event
D)TextChanged event
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
45
An individual item can be deleted from a list with the _______.
A)Items.Delete method
B)Items.Clear method
C)Items.Erase method
D)Items.RemoveAt method
A)Items.Delete method
B)Items.Clear method
C)Items.Erase method
D)Items.RemoveAt method
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
46
The code to delete the selected item from ColorListBox is _______.
A)ColorListBox.Clear
B)ColorListBox.RemoveItem
C)ColorListBox.Delete (ColorListBox.ListIndex)
D)ColorListBox.Items.RemoveAt (ColorListBox.SelectedIndex)
A)ColorListBox.Clear
B)ColorListBox.RemoveItem
C)ColorListBox.Delete (ColorListBox.ListIndex)
D)ColorListBox.Items.RemoveAt (ColorListBox.SelectedIndex)
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
47
When is the counter tested in a FOR/NEXT statement?
A)In the NEXT statement
B)In the FOR statement
C)When the counter is initialized
D)When the counter is incremented
A)In the NEXT statement
B)In the FOR statement
C)When the counter is initialized
D)When the counter is incremented
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
48
Incorrect indentation of the statements in For/Next loops _______.
A)will cause the program to halt
B)will cause the logic of calculations inside the loop to perform incorrectly
C)will make the program difficult to read and understand
D)all of these
A)will cause the program to halt
B)will cause the logic of calculations inside the loop to perform incorrectly
C)will make the program difficult to read and understand
D)all of these
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
49
Which text box event occurs each time the user types a character into a text box?
A)Click event
B)GotFocus event
C)Enter event
D)TextChanged event
A)Click event
B)GotFocus event
C)Enter event
D)TextChanged event
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
50
How many times will the statements inside this For/Next loop be executed? For IndexInteger = 1 to 10
'Statements in loop
Next IndexInteger
A)2
B)4
C)5
D)10
'Statements in loop
Next IndexInteger
A)2
B)4
C)5
D)10
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
51
Which of the following instructions will add the word,monkey,to a list box named AnimalsListBox?
A)AnimalsListBox.Insert(monkey)
B)AnimalsListBox.Insert ("monkey")
C)AnimalsListBox.Items.Add(monkey)
D)AnimalsListBox.Items.Add("monkey")
A)AnimalsListBox.Insert(monkey)
B)AnimalsListBox.Insert ("monkey")
C)AnimalsListBox.Items.Add(monkey)
D)AnimalsListBox.Items.Add("monkey")
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
52
What is the value of the SelectedIndex property if the user has not selected an item from a combo box?
A)-1
B)0
C)1
D)None of these
A)-1
B)0
C)1
D)None of these
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
53
The process of repeating a series of instructions is called ______________.
A)jumping
B)reiteration
C)looping
D)initializing
A)jumping
B)reiteration
C)looping
D)initializing
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
54
The code that will add the name,John,to a combo box named NamesComboBox is _______.
A)NamesComboBox.Items.Add ("John")
B)NamesComboBox.AddItem = ("John")
C)Add.NamesComboBox = ("John")
D)Add."John".NamesComboBox
A)NamesComboBox.Items.Add ("John")
B)NamesComboBox.AddItem = ("John")
C)Add.NamesComboBox = ("John")
D)Add."John".NamesComboBox
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
55
When does a For/Next statement terminate iteration?
A)When executing the For statement,the counter must be greater than the final value.
B)When executing the For statement,the counter must be the same as the final value.
C)When executing the Next statement,the counter must be greater than the final value.
D)When executing the Next statement,the counter must be the same as the final value.
A)When executing the For statement,the counter must be greater than the final value.
B)When executing the For statement,the counter must be the same as the final value.
C)When executing the Next statement,the counter must be greater than the final value.
D)When executing the Next statement,the counter must be the same as the final value.
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
56
The SelectedIndex property of the first item in a list is _______.
A)-1
B)0
C)1
D)True
A)-1
B)0
C)1
D)True
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
57
The group of repeated instructions in a Do/Loop is called a(n)__________.
A)group
B)set
C)loop body
D)iteration
A)group
B)set
C)loop body
D)iteration
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
58
What is the value of the SelectedIndex property if the user has selected the last item in a list with four items?
A)3
B)4
C)5
D)0
A)3
B)4
C)5
D)0
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
59
The values of Boolean data types are sometimes referred to as _______.
A)banners
B)flags
C)ribbons
D)posters
A)banners
B)flags
C)ribbons
D)posters
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
60
When is the counter incremented in a FOR/NEXT statement?
A)In the NEXT statement
B)In the FOR statement
C)In the Exit For statement
D)When the statements in the loop are executed
A)In the NEXT statement
B)In the FOR statement
C)In the Exit For statement
D)When the statements in the loop are executed
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
61
What is the value of IndexInteger after the loop below is executed? For IndexInteger = 4 to 1
'Statements in loop
Next IndexInteger
A)0
B)1
C)4
D)5
'Statements in loop
Next IndexInteger
A)0
B)1
C)4
D)5
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
62
When an item is selected in a list box or a combo box,the _______ property holds the selected item.
A)SelectAll
B)Text
C)Print
D)Selected
A)SelectAll
B)Text
C)Print
D)Selected
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
63
Terminate a For/Next loop with the _______ statement.
A)Exit
B)ExitFor
C)ExitLoop
D)Continue
A)Exit
B)ExitFor
C)ExitLoop
D)Continue
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
64
Skip to the next iteration of a Do loop with the _______ statement.
A)Exit For
B)Exit Do
C)Continue For
D)Continue Do
A)Exit For
B)Exit Do
C)Continue For
D)Continue Do
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
65
The PrintDocument's PrintPage event is fired once for each page to be printed.This technique is referred to as a _______.
A)PagePrint method
B)graphics page
C)callback
D)SystemPrint
A)PagePrint method
B)graphics page
C)callback
D)SystemPrint
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
66
The methods and events of the _________ component can be used to set up output for the printer.
A)Printer
B)PrintDocument
C)Print
D)PrintAndPreview
A)Printer
B)PrintDocument
C)Print
D)PrintAndPreview
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
67
________ is used for viewing print output on the screen.The user can then choose to print or cancel.
A)Preview
B)Sample view
C)Print preview
D)Test print page
A)Preview
B)Sample view
C)Print preview
D)Test print page
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
68
What is the Items collection and how does it relate to a list box and/or a combo box?
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
69
Write the code for a FOR NEXT loop that will execute as many times as there are items in a combo box named ItemsComboBox.Use CountInteger as the counter (loop index).
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
70
What is the value of IndexInteger after the code in the loop below is completed? For IndexInteger = 1 to 10
'Statements in loop
Next IndexInteger
A)0
B)1
C)10
D)11
'Statements in loop
Next IndexInteger
A)0
B)1
C)10
D)11
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
71
How many times will the statements inside this For/Next loop be executed? For IndexInteger = 2 to 12 Step 3
'Statements in loop
Next IndexInteger
A)2
B)4
C)5
D)10
'Statements in loop
Next IndexInteger
A)2
B)4
C)5
D)10
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
72
Which method is used to make all of the text in a text box appear selected?
A)SelectText
B)SelectedIndex
C)SelectedItem
D)SelectAll
A)SelectText
B)SelectedIndex
C)SelectedItem
D)SelectAll
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
73
The _______ method is used to send a line of text to the graphics page.
A)DrawString
B)WriteLine
C)String
D)Print
A)DrawString
B)WriteLine
C)String
D)Print
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
74
How many times will the statements inside this For/Next loop be executed? For IndexInteger = 4 to 1
'Statements in loop
Next IndexInteger
A)0
B)3
C)4
D)5
'Statements in loop
Next IndexInteger
A)0
B)3
C)4
D)5
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
75
What will be the value of ValueInteger after execution of these statements? For IndexInteger = 1 to 10 Step 2
ValueInteger += IndexInteger
Next IndexInteger
A)20
B)25
C)36
D)None of these
ValueInteger += IndexInteger
Next IndexInteger
A)20
B)25
C)36
D)None of these
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck
76
What will be the value of IndexInteger after execution of these statements? For IndexInteger = 1 to 10 Step 2
ValueInteger = += IndexInteger
Next IndexInteger
A)10
B)11
C)13
D)14
ValueInteger = += IndexInteger
Next IndexInteger
A)10
B)11
C)13
D)14
Unlock Deck
Unlock for access to all 76 flashcards in this deck.
Unlock Deck
k this deck