CSS 331 - Exam II Review: Chapter 5

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Do...Loop

A ________ body must contain an instruction that will stop the loop.

when the computer should continue the processing the loop body when the computer should stop processing the loop body.

A looping condition indicates ___________. A loop exit condition indicates ___________.

Accumulator

An _________ is typically updated by incrementing (rather than decrementing) its value by an amount that varies. The amount can be either positive or negative, interger, or non-integer.

overflow error

An ____________ occurs when the value assigned to a memory location is too large for the location's data type.

Initialized and Updated

Counters and Accumulators need to be ______ and _______.

DEFAULT ANSWER

DEFAULT QUESTION On page 219 and 220, there is a chapter 5 summary. It is a THEORY that our instructor also takes exam questions from this. My advice is to STUDY THE CHAPTER SUMMARY as well.

DEFAULT ANSWER

DEFAULT QUESTION On page 224 and 225, Figure 5-46 to answer the questions from 8 to 11.

Ex.: Dim intNum As Integer = 1 Do lblNums.Text = lblNums.Text & intNum.ToString & " " intNum += 1 Loop Until intNum > 5

Do...Loop statement to code a posttest loop. Syntax: Do . loop body instructions to be processed either while the condition is true or until the condition becomes true . Loop {While | Until} Condition

Ex.: Dim intNum As Integer = 1 Do While intNum <= 5 lblNums.Text = lblNums.Text & intNum.ToString & " " intNum += 1

Do...Loop statement to code a pretest loop. Syntax Do {While | Until} Condition . loop body instructions to be processed either while the condition is true or until the condition becomes true . Loop

Ex.: For intNum As Integer = 1 To 5 lblNum.Text = lblNums.Text & intNum.ToString & " " Next intNum displays the numbers from 1 to 5 in the lblNums control

For...Next statement to code a counter-controlled loop. Syntax: For counter [As dataType] = startValue To endValue [Step stepValue] . loop body instructions . Next counter

Four

How many times will the string literal "Hi" appear in the lblMsg control? Dim intCount As Integer Do lblMsg.Text = lblMsg.Text & "Hi" & ControlChars.NewLine intCount += 1 Loop While intCount > 4

Four

How many times will the string literal "Hi" appear in the lblMsg control? Dim intCount As Integer Do While intCount > 4 lblMsg.Text = lblMsg.Text & "Hi" & ControlChars.NewLine intCount += 1 Loop

Three - because only even numbers between 6 and 13

How many times will the string literal "Hi" appear in the lblMsg control? For intCount As Integer - 6 To 13 Step 2 lblMsg.Text = lblMsg.Text & "Hi" & ControlChars.NewLine Next intCount

4, 35, 3, 12, 1

If a list box's Sorted property is set to FALSE, how will the numbers 4, 35, 3, 1, and 12 be displayed in the list box? a. 4, 35, 3, 1, 12 b. 1, 3, 4, 12, 35 c. 1, 12, 3, 35, 4 d. 35, 12, 4, 3, 1

1, 12, 3, 35, 4

If a list box's Sorted property is set to TRUE, how will the numbers 4, 35, 3, 1, and 12 be displayed in the list box? a. 4, 35, 3, 1, 12 b. 1, 3, 4, 12, 35 c. 1, 12, 3, 35, 4 d. 35, 12, 4, 3, 1

For clause

If the counter variable is declared in the ______, it has block scope and can be used only within the For...Next loop.

pre-test; post-test

In a _________ loop, the condition is evaluated before the loop body is processed. in a _________ loop, the condition is evaluated after the loop body is processed.

diamond

In a flowchart, you use the decision symbol ( ______ ) to represent a loop's condition.

14

The computer will stop processing the loop: For intCount As Integer - 6 To 13 Step 2 lblMsg.Text = lblMsg.Text & "Hi" & ControlChars.NewLine Next intCount when the intCount variable contains the number _______.

posttest, pretest

The instructions in a ____________ loop might not be processed at all, where as the instructions in a ____________ loop are always processed at least once. a. posttest, pretest b. pretest, posttest

Items

The items in a list box belong to which collection? a. Items b. List c. ListItems d. Values

post-test

The loop body in a __________ loop will always be processed at least once. depending on the result of the condition, the loop body in a pretest loop may never be processed.

100

The loop controlled by the correct For clause from the review question, (Which of the following For clauses indicates that the loop instructions should be processed as long as the intX variable's value is less than 100?), will end when the intX variable contains the number ________

Ex.: Variables strCity strState intSalary Contents Atlanta GA 42500 Concatenated String: strCity & strState strCity & " " & strState strCity & ", " & strState

To concatenate strings: Use the concatenation operator &

form's AcceptButton

To make the btnCalc control the default button, you need to set the ___________ property. a. btnCalc's AcceptButton b. btnCalc's DefaultButton c. form's AcceptButton d. form's DefaultButton

30

What will be the following code display in the lblSum control? Dim intSum As Integer Dim intY As Integer Do While intY < 3 For intX As Integer = 1 To 4 intSum += intX Next intX intY += 1 Loop lblSum.Text = intSum.ToString

*** ***

What will the following code display in the lvlAsterisks control? For intX As Integer = 1 To 2 For intY As Integer = 1 To 3 lblAsterisks.Text = lvlAsterisks.Text & "*" Next intY lblAsterisks.Text = lvlAsterisks.Text & ControlChars.NewLine Next intX

ascending order

When a list box's Sorted property is set to True, the list box items appear in _______________; otherwise, they appear in the order they are added to the list box.

the For clause's startValue, endValue, and stepValue.

When using the For...Next statement, the number of iterations the loop will perform is controlled by ____________. The _________, __________, and _________ must be numeric and can be positive or negative, integer or non-integer. If you omit the stepValue, a stepValue of positive 1 is used.

SelectedValueChanged

Which event occurs when the user selects a different item in a list box? a. SelectionChanged b. SelectedItemChanged c. SelectedValueChanged d. None of the Above

For intX As Integer = 10 To 99

Which of the following For clauses indicates that the loop instructions should be processed as long as the intX variable's value is less than 100? a. For intX As Integer = 10 To 100 b. For intX As Integer = 10 To 99 c. For intX As Integer = 10 To 101 d. None of the Above

-Financial.Pmt(0.035, 2, 10000)

Which of the following calculates the monthly payment (expressed as a positive number) for a loan of $10,000 for 2 years with a 3.5% annual interest rate? a. -Financial.Pmt(0.035, 2, 10000) b. -Financial.Pmt(0.035 / 12, 2 * 12, 10000) c. -Financial.Pmt(2 * 12, 0.035 / 12, 10000) d. -Financial.Pmt(10000, 0.035 / 12, 2 * 12)

Do Until intPopulation < 5000

Which of the following clauses will stop the loop when the value in the intPopulation variable is less that the number 5000? a. Do While intPopulation >= 5000 b. Do Until intPopulation < 5000 c. Loop While intPopulation >= 5000 d. All of the Above

Add

Which of the following methods is used to add items to a list box? a. Add b. AddList c. Item d. ItemAdd

SelectedIndex

Which of the following properties stores the index of the item selected in a list box? a. Index b. SelectedIndex c. Selection d. SelectionIndex

All of the Above

Which of the following statements can be used to code a loop whose instructions you want processed 10 times? a. Do...Loop b. For...Next c. All of the Above

dblTotal += dblSales

Which of the following statements is equivalent to the statement dblTotal = dblTotal + dblSales? a. dblTotal += dblSales b. dblSales += dblTotal c. dblTotal =+ dblSales d. dblSales =+ dblTotal

lstNames.SelectedItem = 4

Which of the following statements selects the FOURTH item in the lstNames control? a. lstNames.SelectIndex = 3 b. lstNames.SelectIndex = 4 c. lstNames.SelectedIndex = 3 d. lstNames.SelectedItem = 4

Debug, Stop Debugging

You can stop an endless (infinite) loop by clicking _______ and then click Stop Debugging. Or, you can click the ______________ button (the red square) on the Standard toolbar.

String Collection Editor, Items collection's Add method

You can use either the _______________ or the _____________ to add items to a list box.

add a list box to a form

You can use the ListBox tool in the toolbox to __________.

ControlChars.NewLine

You can use the ____________ constant to advance the insertion point to the next line.

repetition; (loop); loop

You use a _________ structure ( ____ ) when you need the computer to repeatedly process one or more program instructions. The _____ condition can be phrased as either a looping condition or a loop exit condition. The condition must evaluate to True or False.

Counter

________ is usually updated by either incrementing or decrementing its value by a constant amount, which can be either positive or negative, integer or non-integer.

Counter, Accumulator

_________ is usually 1 or 0. __________ is usually 0.

Do...Loop statement

a Visual Basic statement that can be used to code both pretest loops and posttest loops

For...Next statement

a Visual Basic statement that is used to code a specific type of pretest loop, called a counter-controlled loop

List box

a controlled used to display a list of items from which the user can select zero items, one item, or multiple items

Collection

a group of individual objects treated as one unit

select zero items, one item, or multiple items

a list box's SelectionMode property determines whether the user can _________.

Posttest loop

a loop whose condition is evaluated AFTER the instructions in its loops body are processed

Pretest loop

a loop whose condition is evaluated BEFORE the instructions in its loop body are processed

Endless loop

a loop whose instructions are processed indefinitely; also called an infinite loop

Counter-controlled loop

a loops whose processing is controlled by a counter; the loop body will be processed a precise number of times

Accumulator

a numeric variable used for accumulating (adding together) something

Counter

a numeric variable used for counting something

CancelButton Property

a property of a form; used to designate the button that can be selected by pressing the "Esc" key

AcceptButton property

a property of a form; used to designate the default button

Multiline Property

a property of a text box; indicates whether the text box can accept and display either one or multiple lines of text

ReadOnly Property

a property of a text box; specifies whether or not the user can change the contents of the text box

ScrollBars Property

a property of a text box; specifies whether the text box has no scroll bars, a horizontal scroll bar, or both horizontal and vertical scroll bars

ControlChars.NewLine constant

advances the insertion point to the next line

Load event

an event associated with form; occurs when the application is started and the form is displayed the first time

Infinite loop

another name for an endless loop

Loop

another name for the repetition structure

SelectedItem Property

can be used to select an item in a list box and also to determine which item is selected; stores the value of the selected item

SelectedIndex Property

can be used to select and item in a list box and also to determine which item is selected; stores the index of the selected item

Decrementing

decreasing value

SelectionMode property

determines the number of items that can be selected in a list box

Incrementing

increasing value

Real numbers

number with a decimal place

Dictionary order

numbers are sorted before letters, and a lowercase letter is sorted before its uppercase equivalent

SelectedIndexChanged event

occurs when an item is selected in a list box

SelectedValueChanged event

occurs when an item is selected in a list box

Overflow error

occurs when the value assigned to a memory location is too large for the location's data type

String Collection Editior

provides an easy way to add items to a list box's Items collection

ControlChars.Tab constant

represents the Tab key

Block scope

scope of the variable declared in a "For...Next" statement's For clause; indicates that the variable can be used only within the "For...Next" loop

Sorted Property

specifies whether the list box items should appear in the order they are entered in the list box or sorted order

Count property

stores an integer that represents the number of items in the Items collection

Clear method

the Items collection's method used to clear (remove) items from a list box

Concatenation Operator

the ampersand (&); used to concatenate strings

Default Button

the button that can be selected by pressing the Enter key even when the button does not have the focus; designated by setting the form's AcceptButton property

Items collection

the collection of items in a list box

&

the concatenation operator in Visual Basic

Repetition structure

the control structure used to repeatedly process one or more program instructions; also called a loop

Default list box item

the item automatically selected in a list box when the application is started and the interface appears

Looping condition

the requirement that must be met for the computer to CONTINUE processing the loop body instructions

Loop exit condition

the requirement that must be met for the computer to STOP processing the loop body instructions

Add method

these Items collection's method used to add an item to a list box

Financial.Pmt method

used to calculate the periodic payment on either a loan or an investment


संबंधित स्टडी सेट्स

65 10-12A stock traded infrequently would MOST likely have: QID: 2330269 Mark For Review A The frequency of trading in a stock has no bearing on its spread B A wide spread as the security might be difficult to acquire C A narrow spread as there is not muc

View Set

Chapter 11 Vantage Knowledge check

View Set

vSim: Fundamentals Scenario Rashid Ahmed

View Set

core engineering 2 set Manufacturing Technology

View Set

Prefixes that pertain to numbers and amounts- Medical terminology

View Set

Lewis Ch. 23 - Integumentary Problems

View Set

chapter 8 test- the nervous system

View Set