Starting out with visual basic 8e chapter 3 review

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

If the following code executes, which value is assigned to strA? Dim dblTest As Double = 0.25 Dim strA As String = dblTest.ToString("p")

"25.00%"

Which character is the string concatenation operator?

&

How can you place an existing control in a group box?

1. Select the control you wish to add to the group box 2. Cut the control to the clipboard 3. Select the group box4. Paste the control

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")?

1.235

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 invalid for many operations and can cause a run-time error.

Which form property allows you to specify a button to be clicked when the user presses the (enter) key?

AcceptButton

Why assign access keys to buttons?

Access keys are assigned to buttons because, they create the flexibility in usage to someusers. Some users prefer to use access keys instead of the mouse.

An access key is a key that you press in combination with the (blank) key to access a control such as a button quickly.

Alt

Generally speaking, which button should be set as a form's default button?

Any button that is frequently clicked should probably be set as a form's default button.This will allow keyboard users to access the button quickly and easily.

The (blank) function converts an expression to an integer.

CInt

Which form property allows you to specify a button that is to be clicked when the user presses the (esc) key?

CancelButton

(blank) means that one string is appended to another.

Concatenation

A variable's (blank) determines whether a variable can hold a string, an integer, a date, or some other kind of data

Data type

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

False

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

False

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

False

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

False

The CDbl function converts a number to a string.

False

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

False

To group controls in a group box, add the controls to a form first, then draw the group box around them.

False

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

False

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

False

In code, you move the focus to a control with which method?

Focus

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

Function

A(n) (blank) is a container for other controls that appears as a rectangular border with an optional title.

GroupBox

Visual Basic automatically reports syntax errors. Why doesn't it automatically report logic errors?

It doesn't automatically reports logic errors because VB compilers don't have the capability to analyze the logic of the program.Fortunately, Visual Studio provides you with debugging tools that make locating logic errors easier.

Describe the difference between the Label control's Text property and the TextBox control's Text property.

Label is a box that displays text that cannot be changed or entered by the user. Textbox is a rectangular area in which the user can enter text, or the program can display text.

A(n) (blank) variable is declared inside a procedure.

Local

When Option Strict is set to (blank), only widening conversions are permitted.

On

When two operators share an operand, the operator with the highest (blank) executes first

Precedence

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

Return value "error" "$67 ,521.58" "6.8e+004" "67521.58"

Describe one way to select multiple controls in design mode

Select multiple controls by using one of the following techniques: • Position the mouse cursor over an empty part of the form 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 Ctrl key down while clicking each control you wish to select.

What is the difference between the Single and Integer data types?

Single data types are precision real numbers with +- 7 significant digits. Integers are whole numbers

The order in which controls receive the focus is called the (blank).

Tab order

You can modify a control's position in the tab order by changing which property?

TabIndex

you can modify the (blank) tab order by changing a control's property.

TabIndex

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

TabStop

1. When the user types input into a TextBox control, in which property is it stored?

Text

A group box's title is stored in which property?

Text

You assign an access key to a button through which property?

Text

You define a button's access key through its (blank) property.

Text

The (blank) control allows you to capture input the user has typed on the keyboard.

TextBox

How do you clear the contents of a TextBox control?

TextBoxName.Clear()

Briefly describe how the CDec function converts a string argument to a number.

The CDec function can convert strings starting with a $ character, such as $1,200.00. Commas are also permitted. If the expression converts to a value outside the range of a Decimal, or is not a numeric value, a runtime error is generated.

How does a control's TabIndex property affect the tab order?

The Tablndex property contains a numeric value, which indicates the control's position in the tab order. The control with a Tablndex of 0 will be the first control in the tab order. The next control in the tab order will be the one who's Tablndex is 1. The tab order continues in this sequence.

How does assigning an access key to a button change the button's appearance?

The ampersand is part of the button's Text property, it is not displayed on the button.The letter with the ampersand in front of it will appear underlined.

Suppose a number is used in calculations throughout a program and must be changed every few months. What benefit is there to using a named constant to represent the number?

The benefit of a named constant to represent the number is if the number itself is coded into each statement that uses it, the programmer will have to search through the source code for each instance of the number. If the number is represented by a named constant, the programmer need only change the value assigned to the constant.

What is the significance of showing an underlined character on a button?

The significance of showing an underlined character on a button is it indicates which character must be pressed in combination with the Alt key in order to activate the buttonfrom the keyboard.

should the tab order of controls in your application be logical?

The tab order of controls in your application is logical because unordered tab orders can confuse and annoy the users of the application. Users want to tab smoothly from one control to the next, in a logical sequence.

How does Visual Basic automatically assign the tab order to controls?

The tab order will be the same sequence in which you created the controls.

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

True

A runtime error will occur if you assign a negative value to the TabIndex property in code.

True

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

True

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

True

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

True

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

True

The multiplication operator has higher precedence than the addition operator.

True

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

True

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

True

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

True

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.

True

You can select multiple controls simultaneously with the mouse.

True

A(n) (blank) is a storage location in the computer's memory, used for holding information while the program is running.

Variable

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

Variable declaration

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)

Variable names may not be the same, they should give an indication of the variable's purpose a. intBackPacksSold b. db!PoundsDogFood c. dtmTodaydate d. dec Wholesaleprice e. strCustomerName f. dblGalaxy Distance g. intMonthNumber

Should a programming language automatically insert a space between strings concatenated with the & operator?

Visual Basic doesn't automatically insert a space between strings concatenated with the & operator because of flexibility. In some cases, the programmers may not want to insert the spaces between two joined strings.

Why can't you perform arithmetic operations on a string, such as "28.9"?

We can't perform arithmetic operations on a string because strings are intended to be displayed on a screen or printed on paper. Strings are stored in memory differently than numbers.

What is the focus when referring to a running application?

When an application is runnng and a form is displayed, one of the form's controls always has the focus. The control having the focus is the one that receives the user's keyboard input.

When is a local variable destroyed?

When the procedure that it was declared in ends

How can you get your application to execute a group of statements each time a form is loaded into memory?

When you run an application, the application's form is loaded into memory and an event known as the Load event takes place.The Load event takes place before the form is displayed on the screen. If you want to execute some code at this point, you can write the code in the form's Load event handler.

How do you assign an access key to a button?

You assign an access key to a button through its Text property. To make the assignment, place an ampersand (&) before the letter in the button's Text property , such as E&xit.

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

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

A(n) (blank) is information that is passed to a function when the function is called.

argument

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

break point

The (blank) format string, when passed to the ToString method, produces a number in Currency format.

c

You declare a named constant with which keyword?

const

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

constant

The control that has the (blank) is the one that receives the user's keyboard input or mouse clicks.

focus

Should Label controls be capable of receiving the focus?

no, because label controls do not receive input.

A(n) (blank) is a container for other controls that displays no title and has a customizable border. 23. A form's procedure executes each time a form loads into memory.

panel

Which of the following is the part of a program in which a variable is visible and may be accessed by a programming statement?

scope

(blank) is a commonly used prefix for TextBox control names.

txt

Write a statement that sets the focus to the txtPassword control.

txtPassword.focus( ).

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

value 5 + 16 = 21 4 - 2 = 2 4 + 30 - 2 = 34 - 2 = 32 14 * 3 - 2 = 42 - 2 = 40

Describe three ways to set a breakpoint in an application's code.

• Move the text cursor to the line you wish to set as a breakpoint and then press F9. • Place the mouse cursor in the left 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 select Debug from the menu bar. Then select Toggle Breakpoint from the Debug menu


Kaugnay na mga set ng pag-aaral

Geography Ch1 part 2 Mastering Geography

View Set

Lecture Final Review Micro, Micro HW and DSM 21, Micro DSM 20, Micro HW 20, Micro DSM 19, Micro HW 19, Micro Ch. 18 DSM, Micro HW ch. 17, Micro Ch. 18 HW, Micro HW ch. 16, DSM Ch. 16, 17, Micro Quick Quiz (Ch. 11,, Microbiology Ch. 11-14, Microbiolog...

View Set

ITE 115 Exam 1 study guide (Norman Hahn)

View Set

Udemy-AWS Cloud Practitioner (CLF-C01)-Practice Exam

View Set

Live Virtual Machine Lab 9.2: Module 09 Enterprise Network Security Configuration Concepts

View Set

MICROECON EXAM, Exam 3 Microeconomics

View Set