Name: __________________________
Objective: Write subroutines that uses call by reference.
Quiz
Consider the following subroutine:
Private sub Concat(ByVal a as String, ByRef b as String)
a = a.substring(0, 4)
b = b.substring(0, 4)
end sub
If the variable first equals "Barak" and the variable last equals "Obama", then what are their values after the following subroutine call?
call Concat(first, last)
Instructions:
- Create a new project called subswap
- Add the following to the project form:
- Four text boxes
- Two buttons
- In your program create two subroutines.
- The first is called swap. It takes two parameters declared ByVal.
- The second is called flip. It also takes two parameters, but these parameters are declared ByRef. Both subroutines swap their parameters.
- Program the first button to call swap twice with a pair of text boxes.
- Program the second button to call flip twice with a pair of text boxes.
Grading
| Feature |
Points |
Out of |
Notes |
| Form |
|
1 |
|
| swap subroutine |
|
2 |
|
| flip subroutine |
|
2 |
|
| Button programming |
|
2 |
|
| Total |
|
7 |
|
Notes
Comments (0)
You don't have permission to comment on this page.