1/45
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Repetition structure (or loop)
Repeatedly processes instructions until condition is met
Looping condition
The requirement for repeating the instructions
Loop exit condition
The requirement for not repeating the instructions
Pretest loop
Evaluates condition prior to processing instructions
Posttest loop
Evaluates condition after processing instructions
Do…Loop statement
Used to code both pretest loop and posttest loop
Begins with Do clause, ends with Loop clause
Instructions to be repeated are placed between Do and Loop clauses
Use While or Until keyword before condition
Condition must evaluate to Boolean True or False
While keyword,
Until keyword
Two variations of syntax
One for pretest loop and one for posttest loop
While keyword
Indicates that instructions should be processed while condition is true
Until keyword
Indicates that instructions should be processed until condition becomes true
Pretest loop
Appears in Do clause
Posttest loop
Appears in Loop clause
Diamond
Represents loop condition in flowchart
endless loop
Infinite loop is also called _____.
Infinite loop
The condition to end the loop is never met
Counters and Accumulators
Used to calculate subtotals, totals, and averages
Counter
Numeric variable used for counting
Accumulator
Numeric variable for accumulating (adding together) something
Initializing
Assigning beginning value
Updating (incrementing)
Adding a number to accumulator’s value
Number can be positive or negative
Done within the loop body
Priming read
Use to prime (prepare or set up) loop by performing first action prior to entering loop
Update read
Allows user to update value that controls loop’s condition
Arithmetic Assignment Operators
Used to abbreviate an assignment statement:
Containing an arithmetic operator
Format
variableName = variableName arithmeticOperator value
Example
intAge = intAge + 1 can be abbreviated
intAge += 1
For…Next statement
Used to code a counter-controlled loop
Processes instructions precise number of times
Condition tested before processing (pretest loop)
Must specify start value, end value, and step value
Start value and end value
provide looping range
Step value
increments or decrements counter
hexagon
For clause represented by a _____ in flowchart
For…Next
Comparing the For…Next and Do…Loop Statements
Either can be used to code counter-controlled loop
_____ is more convenient
Declaration, initialization, update, and comparison
Handled by the For clause
Do…Loop
Comparing the For…Next and Do…Loop Statements
Must declare and initialize the counter variables
And update the counter variable
Include the appropriate comparison in the Do clause
Initialized
Updated within loop
Counters and accumulators must be (2):
Nested repetition structure
Inner loop placed entirely within outer loop
Inner loop
is referred to as nested loop
Refresh method
Ensures that computer processes any previous lines of code that affect interface appearance
Syntax:
Me.Refresh()
Me
refers to current form
Sleep method
Delays program execution
Syntax:
System.Threading.Thread.Sleep(milliseconds)
Millisecond: 1/1000 of second
List box
Displays list of choices from which user can select zero or more choices
SelectionMode property
Controls number of choices that can be selected
ListBox tool
Used to add list box to interface
3 to 8
List box can be made any size you want
Windows standard: _____ to _____ choices
Collection
Group of objects treated as one unit
Items collection
Refers to group of items in list box
Index
Unique number that identifies each item in collection
First item has _____ of zero
Items collection’s Add method or Items.Add method
Used to add item to list box
Usually entered in form’s Load event procedure
Sorted property
List box
Determines order of displayed items
If True,
newly added item is placed in its proper position
If False
newly added item is placed at end of list
Uses dictionary sort order
SelectedItem property
Contains value of selected item
Contains empty string when no item is selected
SelectedIndex property
Contains value of selected item’s index
Contains -1 when no item is selected
Default list box item
Appears when application is first loaded
Chosen by setting either SelectedItem or SelectedIndex property
SelectedValueChanged event,
SelectedIndexChanged event
Occur when user or code statement selects item in list box
Can use these events to process instructions when selection is made