VB Intro. Test #1 - February 6, 2002
I have not violated the Honor Code in completing this test. ________________________________
READ THESE NOTES
Sign the pledge and initial each sheet. SHOW ALL YOUR WORK.
DO NOT spend an excessive amount of time on any one question since all questions count the same.
Do as many questions as you are able.
You may OMIT any ONE question. You MUST indicate which question is to be omitted by circling its number and writing the word OMIT next to it.
- In the Visual Basic Integrated Development Environment (IDE) where does one find the controls that one is able to place on a form?
- If help is not available in the VB IDE where else may one find help about Visual Basic controls, statements, functions, etc. Be specific.
- Name the controls.
Fill in the blanks with one of the following: text box, picture box, label, command button, option button
- A control that a user would normally use to cause some action to occur. __________________
- A control that can be used for two-way communicate with a user. ____________________
- A control that a programmer may use to contain (hold) other controls? _________________
- Enables the user to select one of several items. _________
- A control that may be used to describe the function of other controls. __________
- What is the purpose in placing "Option Explicit" in one's VB program?
- Give a VB declaration for each of the following variables using the most appropriate data type .
- NumStu - the number of students in a class. ____________________________
- AvgGrade - the average grade for all students on this test. _______________________
- ShoeCost - the cost of a pair of shoes. ___________________________
- Paid - indicates if a student has paid his/her tuition _________________________
- PopCount - the number of U.S. citizens. _________________________
- A) Give a declaration for a constant called TaxRate which is equal to 0.1.
B) Give a VB statement that converts the content of text box txtAmount to a number and places that number in a variable called Amount.
- A text box named txtSalePrice is supposed to hold the amount of a purchase. When the command button named cmdCompute is clicked the amount in txtSalePrice is placed in a variable called SalePrice. SalePrice is then multiplied by TaxRate to compute the tax on the purchase. The tax is then added to SalePrice to compute the total cost for the sale and the total cost is placed into a text box named txtTotalCost. If the contents of txtSalePrice is not numeric then when cmdCompute is clicked an error message should be displayed. Write the VB code for the cmdCompute_Click event.
- A programmer places a graphic image of a car in a picture box called picCar. The programmer wants the car to appear to drive across the screen when the user clicks the cmdDrive button. Give VB code and/or pseudocode to accomplish this.
- A command button named cmdControl is used to start and stop an animation. To start the animation the programmer calls subroutine StartA and to stop the animation the programmer calls the subroutine StopA. When the animation is running cmdControl displays STOP and when the animation is stopped cmdControl displays START. Write the VB code for the cmdControl_Click event.
- Fill in the blanks with the correct answers.
A) ________________________________ tell something about an object such as its name, color, size, etc.
B) Actions taken on your program by the user may cause _________________ to occur. These may be captured by your program and your program may execute appropriate VB instructions to respond to them.
- A) What is the scope of a variable that is declared in the General declarations section of a form?
B) What is the scope of a variable that is declared in the cmdCompute_Click event subroutine?
Top of this page
Home page 
