1.
What is the keyword used for declaring a constant?
Correct Answer
D. Const
Explanation
Starts with a capital C. Const
2.
What is the standard way to write constants in Visual Basic?
Correct Answer
A. All capital letters
Explanation
All caps make constants look different from variables.
3.
Which of these is the correct constant declaration for the gravitational constant which is equal to 1.07 times 10 to the negative 9th power in feet cubed per pound second squared?
Correct Answer
B. Const GRAVITY = 1.07E-9
Explanation
We use all caps from constant identifiers and exponential notation must be used. No units are included. In exponential notation, the E takes the place of the x 10 of scientific notation.
4.
Which is the appropriate constant declaration for the weight of the Earth in pounds?
Correct Answer
C. Const WEIGHTEARTH = 1.315e25
Explanation
All capitals and exponential notation.
5.
Which is the correct syntax for the constant definition for the radius of the Earth in feet?
Correct Answer
B. Const RADIUSEARTH = 20882400
Explanation
Do NOT include units. Do not include commas.
6.
Since the elevations are going to be provided by a For Next loop and will be from 0 to 20,000 feet above the Earth's surface in 1000 feet increments, how should the variable Elevation be declared?
Correct Answer
C. Dim Elevation As Integer
Explanation
Only integers are needed because the elevations will be 0, 1000, 2000, 3000, 4000, etc up to 20000.
7.
Since the acceleration is going to be calculated by the program, its variable must also be declared. The sample output shows values such as 32.26627 and 32.22921 as accelerations; therefore, which is the best declaration for the acceleration variable?
Correct Answer
D. Dim Acceleration As Single
Explanation
Single is needed for decimals.
8.
Which is the correct assignment statement for calculating the acceleration?
Correct Answer
A. Acceleration = GRAVITY * WEIGHTEARTH / (RADIUSEARTH + Elevation) ^ 2
Explanation
The correct assignment statement for calculating the acceleration is "Acceleration = GRAVITY * WEIGHTEARTH / (RADIUSEARTH + Elevation) ^ 2." This formula correctly calculates the acceleration by multiplying the gravity (GRAVITY) by the weight of the Earth (WEIGHTEARTH), and then dividing it by the sum of the radius of the Earth (RADIUSEARTH) and the elevation, all raised to the power of 2.
9.
Which is the correct line to use for the beginning of the For Next loop that generates the elevations from 0 to 20000 feet above the Earth's surface for elevations of 1000 feet increments?
Correct Answer
D. For Elevation = 0 To 20000 Step 1000
Explanation
The directions call for the elevations to be feet above the Earth's surface from 0 to 20000 feet in 1000 foot increments. Units are not used in the For Next loop. The phrase in 1000 foot increments means that the step is 1000. No commas are used. The variable after For and after Next is Elevation.
10.
Which is the correct declaration for a variable that will hold the various results as they determined in the For Next loop?
Correct Answer
D. Dim ResultString As String
Explanation
Look at the ResultString.frm directions as a guide. ResultString is a concatenation of values and spaces put into a string variable.
11.
If the result string is made up of a concatenation of values of variables and space and then added to the listbox, which of these lines of code would be appropriate for displaying the output to the listbox?
Correct Answer
A. ResultList.AddItem ResultString
Explanation
ResultList is the name of the ListBox where the results are being displayed. .AddItem is used with ListBoxes. The value of the variable ResultString is being added to the ListBox each time through the loop.
12.
What line of code tells the computer when to increment the elevation and when to repeat the loop?
Correct Answer
B. Next Elevation
Explanation
Every For has its Next. The variable and For and its corresponding Next, must be the same.
13.
What is the best name for the menu item with the word Gravity?
Correct Answer
C. MnuGravity
Explanation
mnu is the 3-letter prefix for menu items.
14.
What line of code will put the cursor on the Clear command button?
Correct Answer
A. CmdClear.SetFocus
Explanation
You look where the cursor is, so the code for putting the cursor somewhere is done with the name of the object followed by .SetFocus