Microsoft Visual Basic 2010 for Windows Web Office and Database Applications Comprehensive 1st Edition by Gary B. Shelly – Test Bank

$20.00

Pay And Download

 

Complete Test Bank With Answers

 

 

 

Sample Questions Posted Below

 

 

 

 

Chapter 5: Decision Structures

 

MULTIPLE RESPONSE

 

Modified Multiple Choice

 

  1. When a condition is tested in a Visual Basic program, this is a possible outcome: ____.
a. the condition cannot be determined c. the condition is constant
b. the condition is true d. the condition is false

 

 

ANS:  B, D               PTS:   1                    REF:   312

 

  1. The ____ is a relational operator.
a. = c. >
b. ? d. <

 

 

ANS:  A, C, D           PTS:   1                    REF:   313

 

  1. An If…Then statement can be used to compare an arithmetic expression to a(n) ____.
a. logical operator c. other data type
b. constant d. arithmetic operator

 

 

ANS:  B, C                PTS:   1                    REF:   319

 

  1. When using multiple ____ operators in an If statement, the order of precedence of the operators should be established through the use of parentheses.
a. relational c. concatenated
b. logical d. range

 

 

ANS:  A, B               PTS:   1                    REF:   332

 

  1. After the Not operator, the ____ logical operator has the next precedence.
a. And c. AndAlso
b. Xor d. Or

 

 

ANS:  A, C               PTS:   1                    REF:   332

 

MODIFIED TRUE/FALSE

 

  1. A RadioButton’s Selected property will indicate if the radio button has been selected by the user. _________________________

 

ANS:  F, Checked

 

PTS:   1                    REF:   300

 

  1. The plus sign is the preferred operator for concatenation. _________________________

 

ANS:  F, ampersand

 

PTS:   1                    REF:   311

 

  1. An If…Then statement can be used to compare two strings. _________________________

 

ANS:  T                                                     PTS:   1                    REF:   316

 

  1. In string comparison, a number is more than an uppercase letter. _________________________

 

ANS:  F, less

 

PTS:   1                    REF:   316

 

  1. A condition can be true and false at the same time. _________________________

 

ANS:  F, cannot

 

PTS:   1                    REF:   319

 

MULTIPLE CHOICE

 

 

  1. As shown in the accompanying figure, a ____ object forces the user to select only one option from a group of options.
a. CheckBox c. TextBox
b. RadioButton d. CheckList

 

 

ANS:  B                    PTS:   1                    REF:   300

 

  1. When the object indicated by the value Pine (or Oak or Cherry) in the accompanying figure is selected by the user, the ____ property changes from False to True.
a. Selected c. Checked
b. Value d. Input

 

 

ANS:  C                    PTS:   1                    REF:   300

 

  1. Which of the following is a feature of the Panel object?
a. caption c. scroll bars
b. labeled border d. none of the above

 

 

ANS:  D                    PTS:   1                    REF:   302

 

  1. The Panel object performs in the same manner as the ____ object.
a. GroupBox c. FlowLayout
b. TabControl d. TableLayout

 

 

ANS:  A                    PTS:   1                    REF:   302

 

  1. ____ objects are used to gather related RadioButtons together so that the user can select one radio button from each group.
a. Container c. Layout
b. Grouping d. Cluster

 

 

ANS:  A                    PTS:   1                    REF:   303

 

  1. Of all the following objects provided by Visual Basic for Windows applications, the ____ object is used most often.
a. GroupBox c. FlowLayout
b. TabControl d. TableLayout

 

 

ANS:  A                    PTS:   1                    REF:   302

 

  1. The ____ object provides several options not available with the Panel object.
a. GroupBox c. FlowLayout
b. TabControl d. TableLayout

 

 

ANS:  A                    PTS:   1                    REF:   302

 

  1. The Panel, GroupBox, and TabControl objects are examples of ____ objects.
a. compound c. complex
b. container d. group

 

 

ANS:  B                    PTS:   1                    REF:   302

 

 

  1. A message box like the one shown in the accompanying figure is also known as a(n) ____ box.
a. alert c. pop-up
b. dialog d. warning

 

 

ANS:  B                    PTS:   1                    REF:   303

 

  1. To display a message box window like the one in the accompanying figure, use the ____ procedure of the MessageBox class.
a. Display c. View
b. Show d. Visible

 

 

ANS:  B                    PTS:   1                    REF:   304

 

  1. ____ is the default setting for the buttons that will be displayed in a message box like the one in the accompanying figure.
a. MessageBoxButtons.OKOnly c. MessageBoxButtons.YesNo
b. MessageBoxButtons.OKCancel d. MessageBoxButtons.YesNoCancel

 

 

ANS:  A                    PTS:   1                    REF:   307

 

  1. What is the value of the MsgBoxStyle.OKOnly?
a. 0 c. 2
b. 1 d. 3

 

 

ANS:  A                    PTS:   1                    REF:   307

 

  1. What is the value of the MsgBoxStyle.OKCancel?
a. 0 c. 2
b. 1 d. 3

 

 

ANS:  B                    PTS:   1                    REF:   307

 

  1. The ampersand (&) symbol is the operator used to ____ two strings together.
a. link c. embed
b. display d. concatenate

 

 

ANS:  D                    PTS:   1                    REF:   311

 

  1. A ____ structure is used to deal with different conditions that occur based on values entered into an application.
a. compound c. decision
b. logical d. baseline

 

 

ANS:  C                    PTS:   1                    REF:   312

 

  1. A statement that tests a value is called a ____ statement.
a. conditional c. logical
b. scope d. range

 

 

ANS:  A                    PTS:   1                    REF:   312

 

  1. In an If…Then statement, the ____ symbol is used to test for inequality.
a. >< c. = =
b. != d. <>

 

 

ANS:  D                    PTS:   1                    REF:   313

 

  1. Every If statement block must be terminated by the ____ keyword.
a. End If c. End
b. If End d. Not If

 

 

ANS:  A                    PTS:   1                    REF:   313

 

  1. Use the ____ statement to execute one set of instructions if the condition is true, and another set of instructions if the condition is false.
a. Do…While c. If…Then…Else
b. If…Then d. Not…If

 

 

ANS:  C                    PTS:   1                    REF:   318

 

  1. The ____ of a variable means where a variable can be referenced within a program.
a. range c. versatility
b. life d. scope

 

 

ANS:  D                    PTS:   1                    REF:   327

 

  1. To use multiple conditions in a single If…Then…Else statement, ____ conditions are required.
a. range c. indexed
b. compound d. logical

 

 

ANS:  B                    PTS:   1                    REF:   328-329

 

  1. To create a compound condition in an If statement, a(n) ____ operator is required.
a. compound c. arithmetic
b. logical d. logical

 

 

ANS:  B                    PTS:   1                    REF:   329

 

  1. The business traveling rule, “If the flight costs less than $300.00 and the hotel is less than $120.00 per night” is an illustration of ____ conditions.
a. continuous c. contiguous
b. compound d. grouped

 

 

ANS:  B                    PTS:   1                    REF:   329

 

  1. An expression using the logical operator ____ will evaluate to true only when both of the conditions are true.
a. And c. Not
b. Or d. Nor

 

 

ANS:  A                    PTS:   1                    REF:   329

 

  1. An expression using the logical operator ____ will evaluate to true when either of the compound conditions is true.
a. And c. Not
b. Or d. Nor

 

 

ANS:  B                    PTS:   1                    REF:   330

 

  1. The logical operator ____ reverses the logical value of a condition.
a. And c. Not
b. Or d. Nor

 

 

ANS:  C                    PTS:   1                    REF:   331

 

  1. An expression using the logical operator ____ evaluates to true when only one but not both of the two compound conditions are true.
a. Nor c. AndAlso
b. OrElse d. Xor

 

 

ANS:  D                    PTS:   1                    REF:   332

 

  1. In an expression using the logical operator ____, as soon as one of the compound conditions is found to be false, no further conditions are tested and the expression evaluates to false.
a. Nor c. OrElse
b. AndAlso d. Xor

 

 

ANS:  B                    PTS:   1                    REF:   332

 

  1. In an expression using the logical operator ____, as soon as one of the compound conditions is found to be true, no further conditions are tested and the expression evaluates to true.
a. Nor c. OrElse
b. AndAlso d. Xor

 

 

ANS:  C                    PTS:   1                    REF:   332

 

  1. The logical operator ____ has the highest priority and is evaluated first.
a. Or c. Not
b. Xor d. And

 

 

ANS:  C                    PTS:   1                    REF:   332

 

  1. To end a Select Case structure, a(n) ____ statement is used.
a. End Select c. Select End
b. End Case d. Select Close

 

 

ANS:  A                    PTS:   1                    REF:   334

 

  1. In a Select Case structure, the ____ statement includes all conditions not specifically tested for in the other Case statements.
a. Case Other c. Case Else
b. Else d. All Else

 

 

ANS:  C                    PTS:   1                    REF:   334

 

  1. When relational operators are used in a Case statement within a Select Case structure, the keyword ____ must be used with the relational operator.
a. Is c. Cont
b. From d. To

 

 

ANS:  A                    PTS:   1                    REF:   335

 

  1. To specify a continuous range of values to be tested in a Case statement within a Select Case structure, the word ____ must be used.
a. From c. To
b. Range d. Cont

 

 

ANS:  C                    PTS:   1                    REF:   336

 

  1. Which of the following CANNOT be contained in a code snippet?
a. an entire program c. an If…Then…Else decision structure
b. code to send an e-mail message d. code to draw a circle

 

 

ANS:  A                    PTS:   1                    REF:   337

 

 

  1. Visual Basic contains a code library of almost ____ pieces of code called code snippets, inserted by the command shown in the accompanying figure.
a. 125 c. 500
b. 250 d. 750

 

 

ANS:  C                    PTS:   1                    REF:   337

 

  1. It is important to ____ the line in the code editing window where you want to insert a code snippet to produce the shortcut menu in the accompanying figure.
a. click c. right-click
b. double-click d. mouse over

 

 

ANS:  C                    PTS:   1                    REF:   337

 

  1. The ____ function is used to determine if an input value can be converted into a numeric value.
a. IsNumeric c. IsInteger
b. IsNumber d. IsQuantity

 

 

ANS:  A                    PTS:   1                    REF:   340

 

  1. The IsNumeric function will return a(n) ____ type value.
a. Boolean c. Double
b. Decimal d. Integer

 

 

ANS:  A                    PTS:   1                    REF:   340

 

  1. If data analyzed by the IsNumeric function cannot be converted to a numeric data type, the function will return a value of ____.
a. NaN c. False
b. NotNumber d. null

 

 

ANS:  C                    PTS:   1                    REF:   340

 

TRUE/FALSE

 

  1. Developers can code Visual Basic applications to make decisions based on the input of users or other conditions that occur.

 

ANS:  T                    PTS:   1                    REF:   292

 

  1. When you want to move a GroupBox object, you must first move its contained objects.

 

ANS:  F                    PTS:   1                    REF:   297

 

  1. When RadioButton objects are contained in a group box, the user can select only one of the radio buttons on the panel.

 

ANS:  T                    PTS:   1                    REF:   294

 

  1. Often, during design time, you should set the Checked property for the most commonly selected RadioButton object to True to save the user from having to select the most common choice.

 

ANS:  T                    PTS:   1                    REF:   301

 

  1. A Panel object can have a caption, but a GroupBox object cannot.

 

ANS:  F                    PTS:   1                    REF:   302

 

  1. In an If…Then statement, the If keyword should appear on the first line with the conditional expression, and the Then keyword should appear on the second line.

 

ANS:  F                    PTS:   1                    REF:   315

 

  1. When comparing two data values in Visual Basic, both values must be the same data type.

 

ANS:  F                    PTS:   1                    REF:   317

 

  1. In an If…Then…Else statement, if the condition is false, the statements between the Else and End If keywords will be executed.

 

ANS:  T                    PTS:   1                    REF:   319

 

  1. When using an If…Then…ElseIf structure, when a condition is found to be true, the rest of the ElseIf statements are skipped.

 

ANS:  T                    PTS:   1                    REF:   320

 

  1. In an If…Then statement, the code between the If and the End If keywords is considered a block of code.

 

ANS:  T                    PTS:   1                    REF:   328

 

  1. Variables declared within a block of code can only be referenced within that block.

 

ANS:  T                    PTS:   1                    REF:   328

 

  1. A variable defined between the Then keyword and the Else keyword in an If…Then…Else structure can be referenced from within the Else section of the structure.

 

ANS:  F                    PTS:   1                    REF:   328

 

  1. Only one condition can be tested in an If statement.

 

ANS:  F                    PTS:   1                    REF:   328

 

  1. A Case Else statement is required in a Select Case structure.

 

ANS:  F                    PTS:   1                    REF:   334

 

  1. An End Case statement is used to terminate a Select Case structure.

 

ANS:  F                    PTS:   1                    REF:   334

 

  1. In a Select Case statement, the keyword Is must be used when testing with relational operators.

 

ANS:  T                    PTS:   1                    REF:   335

 

  1. A Case statement in a Select Case structure can test for a range of values.

 

ANS:  T                    PTS:   1                    REF:   336

 

  1. Each value in a Case statement is separated by a period.

 

ANS:  F                    PTS:   1                    REF:   336

 

 

  1. Each code snippet inserted by the command in the accompanying figure consists of a complete programming task.

 

ANS:  T                    PTS:   1                    REF:   337

 

  1. You can create your own code snippets but they cannot be added to the library.

 

ANS:  F                    PTS:   1                    REF:   337

 

  1. In adding a code snippet, if you right-click outside the desired location for your code, the shortcut menu might list choices that are customized to that area of code and not include the code snippet for which you were searching.

 

ANS:  T                    PTS:   1                    REF:   337

 

  1. You can display a code snippet to ensure you understand the syntax and requirements for a given type of statement.

 

ANS:  T                    PTS:   1                    REF:   337

 

  1. In the era of IntelliSense, developers need no longer anticipate that users will enter invalid data.

 

ANS:  F                    PTS:   1                    REF:   339

 

  1. If a program attempts to process invalid data, unexpected errors can occur.

 

ANS:  T                    PTS:   1                    REF:   339

 

  1. The process of validating input data is fundamental to programming when using a graphical user interface.

 

ANS:  T                    PTS:   1                    REF:   341

 

COMPLETION

 

 

  1. Message boxes like the ones in the accompanying figure also are known as ____________________ boxes.

 

ANS:  dialog

 

PTS:   1                    REF:   293

 

  1. The ____________________ procedure found in the MessageBox class is used to display a message box, like the one in the accompanying figure.

 

ANS:  Show

 

PTS:   1                    REF:   304

 

  1. The default setting for the MessageBoxButtons argument of a message box will display only a(n) ____________________ button in the message box.

 

ANS:  OK

 

PTS:   1                    REF:   307

 

  1. ____________________ is the MsgBoxButtons argument that displays the Yes and No buttons.

 

ANS:  MsgBoxStyle.YesNo

 

PTS:   1                    REF:   307

 

  1. ____________________ is the MsgBoxButtons argument that, after an error occurs, allows the user to choose Retry or Cancel.

 

ANS:  MsgBoxStyle.RetryCancel

 

PTS:   1                    REF:   307

 

  1. If the condition tested in an If statement evaluates to ____________________, the statement(s) between the If and the End If keywords will be executed.

 

ANS:

true

True

 

PTS:   1                    REF:   312

 

  1. The ____________________ keyword terminates the If…Then block of code.

 

ANS:  End If

 

PTS:   1                    REF:   313

 

  1. In Unicode, numbers are considered to be ____________________ than uppercase or lowercase letters.

 

ANS:  less

 

PTS:   1                    REF:   316

 

  1. When using an If…Then…Else statement, if the condition evaluates to false, the statement(s) between the _______________ keyword and the End If keyword will be executed.

 

ANS:  Else

 

PTS:   1                    REF:   318

 

  1. When using an If…Then…ElseIf statement, a trailing ____________________ statement can be placed at the end to handle a condition that does not meet any of the conditions tested.

 

ANS:  Else

 

PTS:   1                    REF:   321

 

  1. To test a second condition only after the result of the first condition is known, ____________________ If statements can be used.

 

ANS:  nested

 

PTS:   1                    REF:   322

 

  1. The logical operator ____________________ will return a value of true only if all conditions in a compound condition evaluate to true.

 

ANS:

And

AndAlso

 

PTS:   1                    REF:   329 | 332

 

  1. The logical operator ____________________ will return a value of true if at least one condition in a compound condition evaluates to true.

 

ANS:

Or

OrElse

 

PTS:   1                    REF:   330 | 332

 

  1. The ____________________ logical operator reverses the logical value of a condition.

 

ANS:  Not

 

PTS:   1                    REF:   331

 

  1. When different operations must occur based upon the value in a single field, it is best to use a(n) ____________________ statement to test the value.

 

ANS:  Select Case

 

PTS:   1                    REF:   333

 

  1. In a Select Case structure, each ____________________ statement specifies a value for which the test expression is checked.

 

ANS:  Case

 

PTS:   1                    REF:   334

 

  1. Inserting code ____________________ is an effective way to enhance productivity.

 

ANS:  snippets

 

PTS:   1                    REF:   337

 

  1. Since the first days of computers, the phrase “____________________” has described the fact that allowing incorrect input data into a program produces incorrect output.

 

ANS:  garbage in garbage out

 

PTS:   1                    REF:   339

 

  1. The ____________________ function can be used to determine if an input value can be converted to a numeric value.

 

ANS:  IsNumeric

 

PTS:   1                    REF:   340

 

  1. The IsNumeric function returns a(n) ____________________ type value.

 

ANS:  Boolean

 

PTS:   1                    REF:   340

 

MATCHING

 

Identify the letter of the choice that best matches the phrase or definition.

a. GroupBox f. icons
b. logical g. Is
c. relational h. IsNumeric
d. Select Case i. If…Then…ElseIf
e. RadioButton j. conditional

 

 

  1. Function that returns a Boolean value

 

  1. Kind of object that associates items as a group, allowing the user to select one item from the group

 

  1. When this kind of object is contained in a group box, the user can select only one of the radio buttons

 

  1. Message boxes can display these to represent the type of message being displayed

 

  1. The kind of statement between the If keyword and the Then keyword in an If…Then statement

 

  1. A conditional expression tested uses this kind of operator to evaluate to either true or false

 

  1. Multiple conditions can be tested using this kind of statement

 

  1. This kind of operator is used to create compound conditions

 

  1. An easier and clearer alternative to using a series of If…Then…ElseIf statements

 

  1. Keyword automatically added by Visual Studio to a Select Case statement that uses relational operators

 

  1. ANS:  H                    PTS:   1                    REF:   340

 

  1. ANS:  A                    PTS:   1                    REF:   294

 

  1. ANS:  E                    PTS:   1                    REF:   294

 

  1. ANS:  F                    PTS:   1                    REF:   308

 

  1. ANS:  J                     PTS:   1                    REF:   312

 

  1. ANS:  C                    PTS:   1                    REF:   313

 

  1. ANS:  I                     PTS:   1                    REF:   320

 

  1. ANS:  B                    PTS:   1                    REF:   329

 

  1. ANS:  D                    PTS:   1                    REF:   333

 

  1. ANS:  G                    PTS:   1                    REF:   335

 

ESSAY

 

  1. What are the steps for automatically indenting code in an If…Then statement?

 

ANS:

Click Tools on the menu bar at the top of the screen and then click Options. If necessary, click the triangle next to Text Editor in the left panel. If necessary, click the triangle next to Basic in the left panel. If necessary, click VB Specific in the left panel. Ensure the Pretty listing (reformatting) of code check box contains a check mark. Click the OK button in the Options dialog box.

 

PTS:   1                    REF:   313                TOP:   Critical Thinking

 

  1. Visual Basic provides six different logical operators. Briefly describe the function of each.

 

ANS:

The And logical operator allows you to combine two or more conditions into a compound condition that can be tested with an If statement. If any of the conditions stated in the compound condition is false, the compound condition is considered false and the statements following the Else portion of the If statement will be executed. When the Or logical operator is used to connect two or more conditions, the compound condition is true if any tested condition is true. Even if four conditional statements are included in the compound condition, if one conditional statement in the compound condition is true, the entire statement is considered true. The Not logical operator allows you to state conditions that are best expressed in a negative way; in essence, it reverses the logical value of a condition on which it operates. With the Xor operator, when one condition in the compound is true, but not both, the compound condition is true. With the AndAlso operator, as soon as a condition is found to be false, no further conditions are tested and the compound condition is false. With the OrElse operator, as soon as a condition is found to be true, no further conditions are tested and the compound condition is true.

 

PTS:   1                    REF:   329-332         TOP:   Critical Thinking

 

  1. Discuss how to select which decision structure to use.

 

ANS:

In some instances, you might be faced with determining if you should use the Select Case statement or the If…Then…ElseIf statement to solve a problem. Generally, the Select Case statement is most useful when more than two or three values must be tested for a given variable. The If…Then…ElseIf statement is more flexible because more than one variable can be used in the comparison, and compound conditions with the And, Or, and Not logical operators can be used.

 

PTS:   1                    REF:   337                TOP:   Critical Thinking

 

CASE

 

Critical Thinking Questions

Case 5-1

 

You have written the code below and you want to step through it with some actual values to make sure that it is working in practice the way you expect it to work.

 

If decGPA > 3.5 Then

If intSatScore > 1000 Then

lblAdmissionsStatus.Text = “You have earned admission”

Else

lblAdmissionsStatus.Text = “Retake the SAT exam”

EndIf

Else

If intSatScore > 1200 Then

lblAdmissionsStatus.Text = “You have earned probationary admission”

Else

lblAdmissionStatus.Text = “You have been denied admission”

End If

End If

 

  1. Assuming that an applicant has a GPA of 3.55, what is the value of lblAdmissionsStatus.Text if the applicant’s SAT score is 1000?

 

a. Retake the SAT exam c. You have earned probationary admission
b. You have earned admission d. You have been denied admission

 

 

ANS:

A

 

PTS:   1                    REF:   323

 

  1. Assuming that an applicant has a GPA of 3.5, what is the value of lblAdmissionsStatus.Text if the applicant’s SAT score is 1200?

 

a. Retake the SAT exam c. You have earned probationary admission
b. You have earned admission d. You have been denied admission

 

 

ANS:

D

 

PTS:   1                    REF:   323

 

Critical Thinking Questions

Case 5-2

 

Eric had a small reference card that he keeps handy to remind him which MsgBoxButton arguments values translate to which buttons in the dialog box, but then he lost the card. He calls over to you for help in reminding him what values correspond to what.

 

  1. Eric wants your help in remembering which of the following options corresponds to a dialog box that alerts the user to an error and offers the OK and Cancel buttons. What do you tell him?

 

a. MsgBox(“User name is missing”, 0 Or 32, “User Name Error”) c. MsgBox(“User name is missing”, 1 Or 64, “User Name Error”)
b. MsgBox(“User name is missing”, 0 Or 48, “User Name Error”) d. MsgBox(“User name is missing”, 1 Or 16, “User Name Error”)

 

 

ANS:

D

 

PTS:   1                    REF:   307

 

  1. Now, Eric needs help in remembering which of the following options corresponds to a dialog box that displays an information icon and offers the Retry and Cancel buttons. Which of the following is the right answer?

 

a. MsgBox(“You have been disconnected”, 5 Or 64, “User Disconnection”) c. MsgBox(“You have been disconnected”, 4 Or 16, “User Disconnection”)
b. MsgBox(“You have been disconnected”, 5 Or 32, “User Disconnection”) d. MsgBox(“You have been disconnected”, 2 Or 48, “User Disconnection”)

 

 

ANS:

A

 

PTS:   1                    REF:   307

There are no reviews yet.

Add a review

Be the first to review “Microsoft Visual Basic 2010 for Windows Web Office and Database Applications Comprehensive 1st Edition by Gary B. Shelly – Test Bank”

Your email address will not be published. Required fields are marked *

Category:
Updating…
  • No products in the cart.