Test 6 Review
Using the statement below, what is the initial value of this variable? Dim intHours As Integer
0
If you assign a number such as 3.768 to a double variable, what will be stored in the memory location?
3.768
If you assign a number, such as 3.7, to an integer variable, what will be stored in the memory location?
4
What value does the statement intWeight=Convert.toInt32(txtWeight.Text) return if the value keyed by the user was 47?
47
A variable named blnIsTrue is of what data type?
Boolean
A variable named decBonus is of what data type?
Decimal
Which would BEST represent a variable that will hold a true or false value if an entry was valid?
Dim blnlsValid As Boolean
If a student needed to declare a variable to hold values representing a grade point average (GPA), which would be the BEST declaration given programming naming conventions?
Dim dblGPA As Double
A variable named dblTaxRate is of what data type?
Double
Which data type is appropriate to store the value 75.9?
Double
Which data type is used to declare a variable that will store the value 0.113?
Double
Josie is writing a program and needs a variable that can be accessed from multiple event procedures. What scope of variable should she use?
Global
A variable named intGrade is of what data type?
Integer
Which data type is appropriate to store the number five (5)?
Integer
Why is label NOT a valid variable name?
It is a Visual Basic reserved keyword.
In the statement, lblMessage.Text = "This is a label." What does lblMessage refer to?
Label control
Hugh declares a variable in the event procedure code for a button. What scope is this variable?
Local
What is the correct code to create a message box from the following code? lblcost.Text = "The cost of the product is: " & (deccost + dectax)
MessageBox.Show ("The cost of the product is: "& (deccost + dectax))
Variable names:
Must begin with a letter
Susan declares a variable within an If statement. What is the scope of this variable?
Procedural
How do you declare a variable whose value cannot be changed after assignment?
Replace Dim with Const
John needs a variable to hold its value beyond its normal lifetime. What type of variable should he use?
Static
Kirk wants to delcare a variable that holds its value beyond the normal lifetime. How should he declare it?
Static intGrade As Integer
A variable named strName is of what data type?
String
Jayce wants to store the student name "Ellen" in a variable. Which data type should he use?
String
The most appropriate data type for the word "Value" is:
String
The words "A Double data type should be always stored as a Double data type!" would be best stored in which one of the following data types?
String
What data type is returned from a text box control?
String
A Boolean variable can contain:
True and false.
Which is a proper name for a button according to Hungarian notation?
btnAdd
Which would BEST represent a Button control object that will be used to calculate an average?
btnCalcAverage
Which method formats output as currency?
dblMoney.ToString("$##.00")
Which is written in Hungarian Notation?
decAmountDue
According to Hungarian notation, which is a correct variable name?
decHourlyRate
What is an appropriate naming convention for a constant according to Hungarian notation?
decRATE
Which would be appropriate as a variable?
strFirstName
Which would be appropriate as an object name?
txtHoursWorked
According to Hungarian notation, what is an appropriate name for a text box?
txtName
What is an appropriate name for a textbox according to Hungarian notation?
txtName