Gaddis Visual Basic Midterm Ch 3 & 4

Ace your homework & exams now with Quizwiz!

variable

A _____ is a storage location in the computer's memory, used for holding information while the program is running

decision

A ______ structure allows a program to execute some statements only under certain circumstances

Nested

A _______ If statement is an If statement that appears inside another If statement

false

A control whose Visible property is set to False still receives the focus

load

A form's __________ procedure executes each time a form loads into memory

c. Text

A group box's title is stored in which property? a. Title b. Caption c. Text d. Heading

false

A local variable may be accessed by any other procedure in the same Form file

false

A named constant's value can be changed by a programming statement while the program is running

true

A variable declared inside a procedure is only visible to statements inside the same procedure

data type

A variable's ________ determines the type of information the variable can hold

false (the scope means the part of a program in which a variable may be accessed.)

A variable's scope is the time during which the variable exists in memory

named constant

A(n) ____ is like a variable whose content is read-only; it cannot be changed while the program is running

Relational

A(n) _____ operator determines if a specific relationship exists between two values

type conversion or type mismatch

A(n) ______ error is generated anytime a nonnumeric value that cannot be automatically converted to a numeric value is assigned to a numeric variable or property (t_______ c____________ o_ t______ m____________)

breakpoint

A(n) _______ is a line of code that causes a running application to pause execution and enter break mode

flag

A(n) ________ is a Boolean variable that signals when some condition exists in the program

variable declaration

A(n) ________ is a statement that causes Visual Basic to create a variable in memory

argument

A(n) _________ is information that is being passed to a function

local

A(n) __________ variable is declared inside a procedure

function

A(n) ___________ is a specialized routine that performs a specific operation and then returns a value

Select Case

A(n) ______________ statement tests the value of an expression only once, and then uses that value to determine which set of statements to branch to

GroupBox control

A(n) _________________ appears as a rectangular border with an optional title

Alt

An access key is a key that you press in combination with the ________key to access a control such as a button quickly

true

An error will occur if you assign a negative value to the TabIndex property in code

dblTest.ToString("d2") "67,521.58" dblTest.ToString("c2") "$67,521.58" dblTest.ToString("e1") "6.7e+003" dblTest.ToString("f2") "67521.58"

Assuming that the variable dblTest contains the value 67521.584, complete the following table, showing the value returned by each function call: Function Call Return Value dblTest.ToString("d2") ______________ dblTest.ToString("c2") ______________ dblTest.ToString("e1") ______________ dblTest.ToString("f2") ______________

true or false

Boolean expressions can only be evaluated as

decimal, exception

Briefly describe how the CDec function converts a string argument to a number The CDec function attempts to convert the string to a d__________ value. If an invalid character is found in the string that prevents the conversion from taking place, the function throws an e__________.

21, 2, 32, 40

Complete the following table by providing the value of each mathematical expression: Expression Value 5 + 2 * 8 ______________ 20 / 5 - 2 ______________ 4 + 10 * 3 - 2 ______________ (4 + 10) * 3 - 2 ______________ (enter answer horizontally separated by comas)

a. intBackPacksSold b. dblPoundsDogFood c. dtmToday d. decWholesale e. strCustomerName f. dblGalaxyDistance g. intMonthNumber

Create variable names that would be appropriate for holding each of the following information items: a. The number of backpacks sold this week b. The number of pounds of dog food in storage c. Today's date d. An item's wholesale price e. A customer's name f. The distance between two galaxies, in kilometers g. The number of the month (1 = January, 2 = February, and so on)

empty, Ctrl

Describe one way to select multiple controls in design mode • Position the mouse cursor over an e_________ part of the form that is near the controls you wish to select. Click and drag a selection box around the controls. When you release the mouse button, all the controls that were partially or completely enclosed in the selection box will be selected. • Hold the C____ key down while clicking each control you wish to select.

displaying information only, input, text box control, Text property

Describe the difference between the Label control's Text property and the TextBox control's Text property: The Label control's Text property is for d__________ i____________ o_______--the user cannot directly alter its contents. The TextBox control's Text property, however, is for i_________. The user can alter it by typing characters into the t_____ b______ c__________. Whatever the user types into the text box is stored in its T______ p__________.

left, F9, Toggle Breakpoint

Describe three ways to set a breakpoint in an application's code. • Place the mouse cursor in the l_____ margin of the Code window next to the line of code you wish to set as the breakpoint and click the left mouse button • Move the cursor to the line you wish to set as a breakpoint and press the ___ key • Move the cursor to the line you wish to set as a breakpoint, then select Debug from the menu bar, then select T________ B______ from the Debug menu • If the Debug ToolBar is visible, move the cursor to the line you wish to set as a breakpoint, then click the Toggle Breakpoint button on the Debug ToolBar.

true

GroupBox and Label controls have a TabIndex property, but they are skipped in the tab order

Text property, ampersand (&)

How do you assign an access key to a button? You assign an access key to a button through its T____ p_____________. For example, assume an application has a button named btnExit. You wish to assign the access key Alt+X to the button, so the user may trigger the button's Click event by pressing Alt+X on the keyboard. To make the assignment, place an a___________ before the letter x in the button's Text property, such as E&xit.

Clear, empty string

How do you clear the contents of a text box? By calling the text box's C_____ method, such as: txtInput.Clear() You can also clear a text box by storing an e_______ s________ in it's Text property. You do this with a statement similar to: txtInput.Text = ""

TabIndex, 0, continues

How does Visual Basic automatically assign the tab order to controls? When you create a control, Visual Basic automatically assigns a value to its T__________ property. The first control you create on a form will have a TabIndex of __, the second will have a TabIndex of 1, and so forth. The control with a TabIndex of 0 will be the first control in the tab order. The next control in the tab order will be the one who's TabIndex is 1. The tab order c__________ in this sequence

numeric value

How does a control's TabIndex property affect the tab order? The TabIndex property contains a n__________ v________, which indicates the control's position in the tab order. The control with a TabIndex of 0 will be the first control in the tab order. The next control in the tab order will be the one who's TabIndex is 1. The tab order continues in this sequence

underlined

How does assigning an access key to a button change the button's appearance? It causes the letter that immediately follows the ampersand (in the Text property) to appear u____________.

a. 22.9 b. 1 c. 0 d. 0.05 e. 0

How would the following strings be converted by the CDec function? a. "22.9000" b. "1xfc47uvy" c. "$19.99" d. "0.05%" e. String.Empty

b. 1.235

If a variable named dblTest contains the value 1.23456, then which of the following values will be returned by the expression dblTest.ToString("N3")? a. 1.23456 b. 1.235 c. 1.234 d. +1.234

true

If the CInt function cannot convert its argument, it causes a runtime error

c. "25.00%"

If the following code executes, which value is assigned to strA? Dim dblTest As Double = 0.25 Dim strA As String = dblTest.ToString("p") a. "0.25" b. "2.50" c. "25.00%" d. "0.25"

TabStop

If you do not want a control to receive the focus when the user presses the tab key, set its _________ property to False

d. focus

In code, you move the focus to a control with which method? a. MoveFocus b. SetFocus c. ResetFocus d. Focus

true

Only controls capable of receiving input, such as TextBox controls and buttons, may have the focus

false

The CDbl function converts a number to a string

true

The TextBox control's Text property holds the text entered by the user into the TextBox control at runtime

TrimStart

The _____ method returns a copy of a string without leading spaces

Length

The _____ method returns the number of characters in a string

Substring

The ______ method extracts a specified number of characters from within a specified position in a string.

TrimEnd

The ______ method returns a copy of a string without trailing spaces

Trim

The ______ method returns a copy of the string without leading or trailing spaces.

"c"

The _______ format string, when passed to the ToString method, produces a number in Currency format

ToUpper

The _______ method returns the uppercase equivalent of a string

ToLower

The _______ returns a lowercase version of a string

TextBox

The _________ control allows you to capture input the user has typed on the keyboard

Clnt

The ___________ function converts an expression to an integer

Line-continuation

The _____________ character allows you to break a long statement into two or more lines of code

IsNumeric

The ___________________ function accepts a string as its argument and returns-True if the string contains a number, or False if the string's contents cannot be recognized as a number

Focus

The control that has the _______ is the one that receives the user's keyboard input or mouse clicks

space, underscore

The line-continuation character is actually two characters: a s_______ followed by an u_____________.

true

The multiplication operator has higher precedence than the addition operator

Tab order

The order in which controls receive the focus is called the __________

true

The statement lblMessage.BackColor = Color.Green will set lblMessage control's background color to green

false

The string concatenation operator automatically inserts a space between the joined strings

vbCrLf

The value ________ can be concatenated with a string to produce multiple line displays

false

To group controls in a group box, draw the controls first, then draw the group box around them

floating point, whole

What is the difference between the Single and Integer data types? The Single data type stores f________ p_______ numbers, while the Integer data type stores w_______ numbers.

receives

What is the focus when referring to a running application? When an application is running and a form is displayed, one of the form's controls always has the focus. The control that has the focus is the one that r__________ the user's keyboard input or mouse clicks

false

When a string variable is created in memory, Visual Basic assigns it the initial value 0.

ends

When is a local variable destroyed? When the procedure that it was declared in e_____.

b. text

When the user types input into a TextBox control, in which property is it stored? a. Input b. Text c. Value d. Keyboard

precedence

When two operators share an operand, the operator with the highest _______ executes first.

true

When you assign an access key to a button, the user can trigger a Click event by typing alt the access key character

a. &

Which character is the string concatenation operator? a. & b. * c. % d. @

c. CancelButton

Which form property allows you to specify a button that is to be clicked when the user presses the Esc-key? a. DefaultButton b. AcceptButton c. CancelButton d. EnterButton

b. AcceptButton

Which form property allows you to specify a button to be clicked when the user presses the enter key? a. DefaultButton b. AcceptButton c. CancelButton d. EnterButton

c. scope

Which of the following is the part of a program in which a variable is visible and may be accessed by a programming statement? a. segment b. lifetime c. scope d. module

false

While single-stepping through an application's code in break mode, the highlighted execution point is the line of code that has already executed

invalid, run-time

Why should you always make sure that a String variable is initialized or assigned a value before it is used in an operation? A string variable's default value is Nothing. The value Nothing is i________ for many operations and can cause a r___________ error.

txtPassword.Focus()

Write a statement that sets the focus to the txtPassword control

d. Text

You assign an access key to a button through which property? a. AccessKey b. AccessButton c. Mnemonic d. Text

true

You can access a TextBox control's Text property in code

false

You can cause a control to be skipped in the tab order by setting its TabPosition property to False

true

You can change the same property for multiple controls simultaneously

a. TabIndex

You can modify a control's position in the tab order by changing which property? a. TabIndex b. TabOrder c. TabPosition d. TabStop

Tabindex

You can modify the tab order by changing a control's _________ property

false

You can put a comment at the end of a line, after the line-continuation character

true

You can select multiple controls simultaneously with the mouse

true

You cannot break up a word with the line-continuation character

b. Const

You declare a named constant with which keyword? a. Constant b. Const c. NamedConstant d. Dim

text

You define a button's access key through its __________ property

Logical

_____ operators connect two or more relational expressions into one or reverse the logic of an expression

Radio button

______ controls usually appear in groups and allow the user to select one of several possible options

input validation

______ is the process of inspecting input values and determining whether they are valid.

If... Then... Else

______ statement will execute one group of statements if the condition is true, and another group of statements if the condition is false. (each word followed by ...)

txt

_______ is a commonly used prefix for TextBox control names

If...Then...ElseIf

_______ statement is like a chain of If...Then...Else statements. They perform their tests, one after the other, until one of them is found to be true

Check box

________ controls may appear alone or in groups and allow the user to make yes/no or on/off selections.

string concatenation

___________ means that one string is appended to another


Related study sets

1.2.2. Measures of Central Tendency, Quantiles, and Dispersion

View Set

Historia de la psicología lejerc parcial 1

View Set

NUR 110 Taylor Chapter 28 - Medications

View Set

Sherpath- Hand-off and Incident Reporting

View Set

Muscles that move the head and the neck Lab Practical

View Set

Chapter 1: Environmental Problems, Their Causes, and Sustainability

View Set

AP Euro Chapter 19/20 Review Quiz

View Set

Exercise session Chapter 12 - 13 - English Grammar

View Set