Exam 3: Using Variables and Constants

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Which of the following statements declares a Double variable named dblAverage ?

(Multiple Choice)
4.8/5
(36)

The value returned by the InputBox function depends on the button the user chooses.

(True/False)
4.7/5
(38)

A control's ____ event occurs when a change is made to the contents of a control's Text property.

(Multiple Choice)
4.7/5
(44)

An application allows a user to enter an employee code, a salary amount, and a bonus rate to be used in a calculation. The salary amount will always be a whole number, and the bonus rate may contain a decimal place. Write the appropriate Dim statements to declare the variables. Write the related statements needed to convert the strings entered by the user into numeric data types.

(Essay)
4.8/5
(33)

The assignment operator in Visual Basic is the ____ symbol.

(Multiple Choice)
4.8/5
(36)

Which of the following statements subtracts the contents of the intNum1 variable from the contents of the intNum2 variable, and then multiples the difference by 3? The result is assigned to the intResult variable.

(Multiple Choice)
4.8/5
(39)

You create a named constant using the ____ statement.

(Multiple Choice)
4.9/5
(31)

Spaces are allowed in variable names.

(True/False)
4.8/5
(33)

A variable declared in the Declaration section of a form is called a procedure-level variable.

(True/False)
4.9/5
(32)

Instead of storing data in the properties of various controls, programmers can create ____, which are memory locations inside the computer, to store data.

(Multiple Choice)
4.8/5
(34)

A local gym needs an application to apply a 10% discount for all new members who present a coupon during enrollment. Write the statements to declare a variable to record if a customer has a coupon, and to assign the discount rate. The discount rate will not change while the application is running.

(Essay)
4.8/5
(39)

Data types and classes are not related to each other.

(True/False)
4.8/5
(30)

Problems - Correcting Code Errors The following sample of code contains errors. Rewrite the incorrect statements to correct all errors. Private Sub btnCalc_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCalc.Click ' calculates and displays the total amount owed for purchasing hats ' user enters number of hats and price per hat ' all hats are on sale for 25% off the price Dim dblNumHats As Integer Dim decHatPrice As Decimal Dim decDiscount As Double Dim decTotal As Decimal ' assign number of hats and price to variables Integer.TryPurse(txtNumHats.Text, intNumHats) Decimal.TryParse(txtHatPrice, decHatPrice) ' calculate and display the total amount owed decDiscount = decHatPrice * dblRATE decTotal = (intNumHats + decHatPrice) - decDiscount Total.Text = decTotal.ToString(C2) End Sub

(Essay)
4.7/5
(34)

Case-Based Critical Thinking Questions Case 1 - PetPals You have been hired by PetPals Veterinary Clinic to modify an application. The application is used to enter and save all patient (pet) information obtained during an office visit. To simplify the coding of the InputBox function, the prompt and the title for the InputBox can be declared as ____ because they will not change while the application runs.

(Multiple Choice)
4.9/5
(37)

Every numeric data type in Visual Basic has a ____ method that can be used to convert a string to that numeric data type.

(Multiple Choice)
4.8/5
(30)

The strFirstName and strLastName variables contain the strings "Jane" and "Jones", respectively. Which of the following statements will display a string as "Jones, Jane" (the last name, a comma, a space, and the first name) in the lblFullName control?

(Multiple Choice)
4.8/5
(26)

The ____ of a variable determines where in the application's code a variable can be used.

(Multiple Choice)
4.8/5
(30)

The ControlChars.NewLine constant instructs the computer to ____.

(Multiple Choice)
4.9/5
(38)

Date variables are automatically set to which value when created?

(Multiple Choice)
4.8/5
(25)

All numeric variables are automatically initialized to 0 if no initial value is specified when the variable is declared.

(True/False)
4.9/5
(38)
Showing 21 - 40 of 60
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)