You are on page 1of 2

VB warm up exercises

1. What is Event procedure? And give two examples of events.


2. What is the uses of the following Controls? Textbox Control, Label Control and Button
Control
3 Write a program that reads in the radius of a circle and prints the circle’s diameter,
circumference and area. Use the constant 3.14159 for PI.
4. A temperature reading in Fahrenheit degrees is to be read into the computer and converted into
Celsius degrees, using the formula C = (5/9)(F – 32).
5. Write a program that prompts the user to enter five test scores and then prints the average test
score. (Assume that the test scores are decimal numbers.)
6. Evaluate the following expressions i) 5 * 4 > 6 ˆ 2 And True Or False
ii) 8 <= 4 + 6 And 5 > 6 Or 4 < 7 iii) 6 + 3 > 7 And 11 < 2 * 5
7. What is the value of intCost variable? If intAge variable contain the following numbers 65, 2,
12 and 33
If intAge <= 5 Then
intCost = 0
ElseIf intAge <= 12 Then
intCost = 5
ElseIf intAge <= 55 Then
intCost = 10
Else
intCost = 8
End If

7 Write a program that reads in five different integers and determines and prints the largest and
smallest integers in the group.
8. Explain any 2 controls that can be used to print output in VB program, and state the
Procedure(s) to set the two controls.

9. What is an Access key?


10. State the procedure(s) to set an access key for an Object.
11. Write a program that reads a student’s score and prints the student’s grade based on the
following grade system. The marks are rounded to the nearest integer. Use if…else structure.
Marks 0 – 39 40 – 44 45 – 49 50 – 59 60 – 69 70 – 100
Range

Grade F E D C B A

12. Repeat problem 11 but use the select case structure.


13. Write a program that simulates a simple calculator. The program should reads an integer, a
character and an integer. If the character is ‘ + ’ the sum is printed, if the character is ‘ – ‘ the
difference is printed; if the character is ‘ * ‘ the product is printed; and if the character is ‘ / ’ the
quotient is printed. Example if the user types 2 * 5 the output should be 10. The user should put
a space between the operands and the operation.
14. What is the different between an Exit and Continue statements
15. Explain the differences between the Text and the Name property of an object?

Page 1 of 2
16. Write a VB program that ask a user to input a number. The program should then output the
number and a message saying whether the number is positive, negative, or zero. Note: Use textbox
control for input and label control for output
17. Using a list box, write code segments that demonstrate how to use the five basic arithmetic
operators
18. Briefly explain Event procedure in VB and give two examples of events.
19. What is the different between a Variable and a Constant.
20. Write an assignment statement that decrements the intNumcounter variable by 5.
Use an arithmetic assignment operator
21. Write an assignment statement that increments the decTotalvariable by the value in the
decRegionvariable. Use an arithmetic assignment operator.
22. Using the While keyword, write a Do clause that processes the loop body as long as the
value in the intAgevariable is greater than 21.

Page 2 of 2

You might also like