CIS 265 Midterm
To assign the letter P as the access key for a Print button, what value must be entered in the button's Text property?
What filename extension indicates that the file is an executable file that can be run outside of the IDE?
.exe
What filename extension indicates that the file is a Visual Basic source file?
.vb
If the txtTax.Text property contains $57.25, what number will the Decimal. TryParse(txtTax.Text, decTax) method store in the decTax variable?
0
Evaluate the following expression: 55 \ 5 * 6 Mod 3.
1
Evaluate the following expression: 6 / 2 * 3 + 4.
13
Evaluate the following expression: 45 - (20 / 5 + 15).
26
Evaluate the following expression: 3 * 2 ^ 4 - 6.
42
If the txtTax.Text property contains 6.89, what number will the Decimal. TryParse(txtTax.Text, decTax) method store in the decTax variable?
6.89
If a text box's TabIndex value is the number 10, what TabIndex value should its identifying label have?
9
If the intCode variable is used as the selectorExpression in a Select Case statement, which of the following is a valid Case clause? a. Case 1, 2, 3 b. Case "1", "2", "3" c. Case 1 Through 3 d. All of the above.
A
Using the naming rules and conventions listed in Figure 1-7, which of the following are valid names and which are not? Explain why the names are not valid. a. lblTotal b. txtFirst.Name c. lblCity&State d. btnCalc Total e. txtFirstQuarter
A & E are valid because it doesn't contain any spaces and contains only letters B, C, and D aren't valid because B has a period, C has the & symbol, and D has a space between Calc and Total
What character is the dot member access operator?
A period
What is a computer program?
A set of instructions that tells a computer how to accomplish a task
When using an analogy involving a blueprint and a tree house, the _____________________ is the class, and the _____________________ is an object created from it. A. Blueprint, Treehouse B. Treehouse, Blueprint
A. Blueprint, Treehouse
If a radio button is selected, its _____________________ property contains the Boolean value True. a. Checked b. On c. Selected d. Selection
A. Checked
You create your application's user interface in the _____________________ window in the IDE. A. Designer B. Form C. GUI D. Interface
A. Designer
Which of the following declares a procedure-level String variable? a. Dim String strCity b. Dim strCity As String c. Private strCity As String d. Both b and c.
A. Dim String strCity
Evaluate the following expression: 13 > 12 OrElse 6 < 5. A.True B. False
A. True
Evaluate the following expression: 8 <= 4 + 6 AndAlso 5 > 6 OrElse 4 < 7. a. True b. False
A. True
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
A. dblTotal += dblSales
Which of the following compound conditions determines whether the value in the intOrdered variable is outside the range of 0 through 25? a. intOrdered < 0 OrElse intOrdered > 25 b. intOrdered > 0 AndAlso intOrdered < 25 c. intOrdered <= 0 OrElse intOrdered >= 25 d. intOrdered < 0 AndAlso intOrdered > 25
A. intOrdered < 0 OrElse intOrdered > 25
Which of the following can be used to clear the text contained in the lblTax control? a. lblTax = String.Empty b. lblTax.Text = String.Empty c. lblTax.ClearText d. lblTax.Text.Clear
A. lblTax = String.Empty
Which of the following is an invalid name for an object? A. picMy.Dog B. btnCalcSalesTax C. lbl2017 D. All of the above are invalid names
A. picMy.Dog
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 a. zero b. one c. four d. five
A. zero
An online retailer offers free shipping on purchases over $100, but only when the customer has a free shipping code. If subcondition1 is dblPurchase > 100 and subcondition2 is strFreeShip = "Y", which logical operator should you use to combine both subconditions: AndAlso or OrElse? (Use the truth tables shown in Figure 4-13 as a guide.)
AndAlso
What is the name of the vertical pushpin button on a window's title bar?
Auto-Hide
Evaluate the following expression: 5 * 4 > 6 ˆ 2 AndAlso True OrElse False. a. True b. False
B. False
Evaluate the following expression: 5 * 7 > 6 ˆ 2. a. True b. False
B. False
Evaluate the following expression: 6 + 3 > 7 AndAlso 11 < 2 * 5. A. True B. False
B. False
Evaluate the following expression: 7 + 3 * 2 > 6 * 3 AndAlso True. a. True b. False
B. False
A(n) _____________________ is an environment that contains all of the tools and features you need to create, run, and test your programs. A. GUI B. IDE C. UDE D. User Interface
B. IDE
Which of the following statements declares a class-level variable? a. Class intNum As Integer b. Private intNum As Integer c. Private Class intNum As Integer d. Private Dim intNum As Integer
B. Private intNum As Integer
Which property controls the text displayed in a form's title bar? A. Caption B. Text C. Title D. TitleBar
B. Text
The instructions in a _____________________ loop might not be processed at all, whereas the instructions in a _____________________ loop are always processed at least once. a. posttest, pretest b. pretest, posttest
B. pretest, posttest
A static variable has the same _____________________ as a procedure-level variable but the same _____________________ as a class-level variable. a. lifetime, scope b. scope, lifetime
B. scope, lifetime
Which property determines a label's border?
BorderStyle
If a check box is not selected, what value is contained in its Checked property? a. True b. Unchecked c. False d. Unselected
C. False
Label controls that display program output typically have their BorderStyle property set to _____________________. a. BorderSingle b. Fixed3D c. FixedSingle d. None
C. FixedSingle
Which window is used to set the characteristics that control an object's appearance and behavior? A. Characteristics B. Object C. Properties D. Toolbox
C. Properties
Which of the following statements declares a procedure-level variable that remains in the computer's memory until the application ends? a. Dim Static intScore As Integer b. Private Static intScore As Integer c. Static intScore As Integer d. Both b and c.
C. Static intScore As Integer
Which property determines the tab order for the controls in an interface? A. SetOrder B. SetTab C. TabIndex D. TabOrder
C. TabIndex
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.
C. all of the above
Which of the following controls will provide an area in the form for the user to enter a name? a. button b. label c. text box d. All of the above.
C. text box
What is the ID used for text box names? a. tex b. text c. txt d. None of the above.
C. txt
Write a Case clause that specifies all numbers less than 0.
Case Is < 0
What is the process of translating a solution into a computer program?
Coding
Write a statement that declares a named constant whose value is 0.12 and name is dblRATE.
Const dblRate As double = 0.12
Write a statement that declares a procedure-level named constant whose value and name are 10.5 and decPAY, respectively.
Const decPAY As Decimal = 10.5D
Which of the following clauses will stop the loop when the value in the intPopulation variable is less than the number 5000? a. Do While intPopulation >= 5000 b. Do Until intPopulation < 5000 c. Loop While intPopulation >= 5000 d. All of the above.
D. All of the above
Which of the following should have their names changed to more meaningful ones? a. all controls that will be coded b. all controls that will be referred to in code c. the form d. All of the above.
D. All of the above
The expression intNum * intNum * intNum is equivalent to which of the following expressions? a. intNum ^ 3 b. intNum * 3 c. intNum ^ 2 * intNum d. Both a and c.
D. Both a and c
Which property is used to give a form file a more meaningful name? A. File B. File Name C. Form Name D. Name
D. Name
Which window lists the projects and files included in a solution? A. Object B. Project C. Properties D. Solution Explorer
D. Solution Explorer
Which property determines the initial position of a form when the application is started? A. InitialLocation B. Location C. StartLocation D. StartPosition
D. StartPosition
Which of the following statements declares a procedure-level variable that is removed from the computer's memory when the procedure ends? a. Const intCounter As Integer b. Dim intCounter As Integer c. Local intCounter As Integer d. Static intCounter As Integer
D. Static intCounter As Integer
What is the ID used for label control names? a. lab b. lal c. lbe d. None of the above.
D. none of the above
What symbol is used in a flowchart to represent a selection structure's condition?
Diamond
Which flowchart symbol represents the condition in a multiple-alternative selection structure?
Diamond
Write a Dim statement that declares a Boolean variable named blnIsRegistered and initializes it using the keyword True.
Dim blnIsRegistered As Boolean = True
Write a statement that declares a procedure-level variable named dblNumber.
Dim dblNumber As Double
Write a Dim statement that declares a Decimal variable named decSales.
Dim decSales As Decimal
Write a Dim statement that declares a String variable named strName.
Dim strName As String
Write a TryParse method that stores the strSales variable's value in the dblSales variable.
Double.TryParse(strSales, dblSales)
Which type of selection structure provides one set of instructions to be processed only when its condition is true and a different set of instructions to be processed only when its condition is false?
Dual-alternative
All controls have a TabIndex property. True or False?
False
Button captions should end with a colon. True or False?
False
Evaluate the following expression: 10 / 5 + 3 - 6 * 2 > 0.
False
Evaluate the following expression: 8 < 12 / 2 OrElse 4 > 9 Mod 3 * 4.
False
Every text box's KeyPress event procedure needs to be coded. True or False?
False
If a check box is not selected, what value is contained in its Checked property?
False
Label controls that display program output typically have their AutoSize property set to _____________________. a. Auto b. False c. NoSize d. True
False
TabIndex values begin with the number 1. True or False?
False
What menu provides options for centering two or more controls on the form?
Format
What is a GUI?
Graphical User Interface which is what the person using your program sees and interacts with while your program is running
Which property of the KeyPress procedure's e parameter is used to cancel the key pressed by the user?
Handled
What is the first step in the planning process for a Windows Forms application?
Identify the application's purpose
Write an If clause that determines whether the blnIsInsured variable contains the keyword True.
If blnIsInsured = True Then or If blnIsInsured Then
Write an If clause that determines whether the value in the dblPay variable is at least 10.45.
If dblPay >= 10.45 Then
Write an If clause that determines whether the value in the decSales variable is more than $1,500.99.
If decSales > $1,500.99D Then
A movie theater charges $8 per ticket for children ages 2 through 12. The age information is stored in the intAge variable. Write an appropriate If clause.
If intAge >= 2 AndAlso intAge <= 12 Then
Write an If clause that determines whether the strFinished variable contains the letter Y.
If strFinished = "Y" Then
Which data type stores only whole numbers?
Integer
Write a TryParse method that converts the contents of the txtAge.Text property to an integer, storing the result in the intAge variable.
Integer.TryParse(txtAge.Text, intAge)
What is the purpose of an access key?
It allows the user to select the button by pressing the Alt key in combination with a character that appears in the Text property.
Why is it a good idea to lock the controls on the form?
It prevents them from being moved inadvertently as you work in the IDE.
Which property of the KeyPress procedure's e parameter is used to determine the key pressed by the user?
KeyChar
What type of control is used to display the result of a calculation?
Label
What type of control is used to identify the contents of a text box?
Label
If an application contains only one form, what Visual Basic statement tells the computer to end the application?
Me.Close()
Customers who belong to an online retailer's Free Ship club receive free shipping on all of their purchases. Customers who do not belong to the club must make a minimum purchase of $50 to receive free shipping. If subcondition1 is strClubMember = "Y" and subcondition2 is dblPurchase >= 50, which logical operator should you use to combine both subconditions: AndAlso or OrElse? (Use the truth tables shown in Figure 4-13 as a guide.)
OrElse
Write a statement that declares a class-level variable named strName.
Private strName As String
While designing an interface, which window in the IDE allows you to change the default value of an object's property?
Properties
What is the recommended font type for Windows 10 applications?
Segoe UI
Which type of selection structure provides instructions that are to be processed only when its condition evaluates to true?
Single-alternative
Which of a form's properties determines the location of the form when the application is started?
StartPosition
Write a statement that declares a procedure-level variable named dblSum. The variable should retain its value until the application ends.
Static dblSum As Double
Which data type is appropriate for storing the name of a street?
String
To display the words ABC Company in a form's title bar, you need to set which of the form's properties?
Text Property
Which property specifies the alignment of the text inside a label control?
TextAlign
If Option Strict is set to On, how will the computer evaluate the intPrice * 1.05 expression?
The intPrice variable's value will be converted to a Double number before being multiplied by the Double number 1.05
Jake's Car Rental charges each customer a daily rental fee of $55. However, there is an additional charge for renting a luxury car. The additional charge is $10 if the customer has a Jake's Luxury coupon; otherwise, the additional charge is $30. What are the primary and secondary decisions?
The primary decision is the car's classification, and the secondary decision is the coupon status
Members of the Allen Golf Club pay a $100 green fee. Nonmembers golfing on Monday through Thursday pay $150. Nonmembers golfing on Friday through Sunday pay $200. What are the primary and secondary decisions?
The primary decision is the membership status, and the secondary decision is the day of the week.
Which window in the IDE lists the tools you can use to add objects to a form?
Toolbox
A text box's access key is defined in its identifying label. True or False?
True
A user-provided item that will be used in a calculation should be stored in a variable. True or False?
True
Each tool in the toolbox represents a class from which an object can be instantiated.
True
Evaluate the following expression: 13 Mod 3 * 2 <= 1 AndAlso 9 \ 4 <= 2.
True
Evaluate the following expression: 4 + 3 * 2 > 2 * 10 - 11.
True
Evaluate the following expression: 6 / 2 + 7 - 5 > 4 AndAlso 7 > 3.
True
Evaluate the following expression: 75 / 25 + 2 * 5 * 6 <= 8 * 8.
True
Evaluate the following expression: 8 + 3 - 6 + 85 < 5 * 26.
True
Most of the memory locations declared in an application should be class-level variables.
True
Radio button and check box controls have a CheckedChanged event that is invoked when a change is made to their Checked property. True or False?
True
The result of a calculation made by an application should be stored in a variable. True or False?
True
To cancel a key, you assign what value to the e parameter's Handled property?
True
A form contains six radio buttons. Three of the radio buttons are contained in a group box. How many of the radio buttons in the interface can be selected at the same time?
Two
Which menu provides options for opening a closed window in the IDE?
View
Which menu contains an option for displaying the interface's TabIndex boxes?
View Menu
In object-oriented programming, what is a class?
a pattern that the computer uses to create the object
What is an event procedure?
a set of Visual Basic instructions that tell an object how to respond to an event
What is a keyword?
a word that has a special meaning in a programming language which appears in a diff color from the rest of the code
What character is used to designate an access key?
ampersand
In the Code Editor window, what character designates that the text that follows it is a comment?
apostrophe '
What is the three-character ID used when naming buttons?
btn
To use the menu from Question 1 to make the btnCalc control the same size as the btnExit control, which of the two controls should you select first?
btnExit
Write an assignment statement that assigns the keyword False to the btnPrint control's Enabled property.
btnPrint.Enabled = Fasle
How do you specify the default radio button?
by setting its checked property to true in the properties window
Where can a nested selection structure appear? a. only in an outer selection structure's false path b. only in an outer selection structure's true path c. in either of an outer selection structure's paths d. only in another nested selection structure's true or false paths
c. in either of an outer selection structure's paths
Write a statement that assigns the number 2.5 to the dblNum variable.
dblNum = 2.5
Write an expression that multiplies the value stored in the dblTotal variable by 15%.
dblTotal * 0.15
Write a statement that adds together the values stored in the dblDomestic and dblInternational variables, assigning the result to the dblTotal variable.
dblTotal = dblDomestic + dblInternational
Write a statement that assigns the number 9.99 to the decPrice variable.
decPrice = 9.99
Which data types are appropriate for storing the number 4.5?
decimal / double
Where are class-level named constants declared?
immediately after the Public Class clause in a form class's declarations section
Where are procedure-level variables declared?
in a procedure
Write a statement that uses an arithmetic assignment operator to add the number 1 to the intAge variable.
intAge += 1
Which of the following are valid names for variables: intAge, dblFirst&Qtr, decRate5, strFirst_Name, and dbl$Sales?
intAge, decRate5, and strFirst_Name
Write a statement that displays the decPrice variable's value in the lblPrice.Text property. The value should contain a dollar sign and two decimal places.
lblPrice.Text = decPrice.ToString("C2")
Write a statement that displays the intQuantity variable's value in the lblQuantity.Text property.
lblQuantity.Text = intQuantity.ToString
Write a statement that displays the dblRate variable's value in the lblRate.Text property. The value should contain a percent sign and no decimal places.
lblRate.Text = dblRate.ToString("P0")
What is the opposite of greater than?
less than or equal to
What is the three-character ID used when naming picture boxes?
pic
Write a statement that assigns the name Jim to the strFirst variable.
strFirst = "Jim"
Write a statement that selects all of the text contained in the txtAddress control.
txtAddress.SelectAll()
When are class-level variables removed from the computer's main memory?
when the application ends
When does a text box's TextChanged event occur?
when the contents of the text box chnages
When are procedure-level named constants removed from the computer's main memory?
when the procedure ends
When does a text box's Enter event occur?
when the text box receives the focus