Online Exam

CCE 170 - Final Exam KEY

Fall Semester 2021

Page 1
Page 2
[Page 3]
Page 4
Page 5
Page 6
Page 7

Short Answer

16. (ranges) What method associated with a VB range can be used to delete the contents of the range, including the formatting?

17. (variables) What should you type at the top of your VB source code module to force you to declare all variables?

18. (strings) Given the following declarations and assignments:

Dim a As String
Dim b As String
Dim c As String
b = "Hello "
c = "world!"
Write a VB statement that combines (concatenates) the strings stored in b and c and stores the result in a.

19. (objects) The attributes of objects in VB are called .

20. (excel) When writing spreadsheet formulas, a cell address such as $A$10 is referred to as a(n) address.

21. (variables) A variable that can be either True or False in VB should be declared of type .

22. (controls) What type of VB control would you use to put a JPEG image from the internet on your Excel sheet so that you can manipulated it on your VB code?

23. (loops) What number is displayed in the cell B4 after the following code is executed? Recall that the Mod operator returns the remainder after integer division of the two operands.

Answer:

Dim i As Integer
Dim b As Integer

i = 1
b = 0
Do
If (i Mod 2) = 0 Then
b = b + i
End If
i = i + 1
Loop Until i = 10

Range("B4") = b

24. (VB) In the VB environment code from macros are stored in the "Modules" Folder.

25. (compsci) Suppose that you have an Google Fiber internet connection capable of downloading at 1 Gb (gigabit) per second. At this rate, how long would it take you to download a 853.2 MB (mega-byte) file?

[seconds]

26. (debug) A statement can be turned into a comment and then ignored when the code is executed by typing what character at the beginning of the line?

27. (functions) Write a custom function called equal that takes three integers as arguments and returns True if they are all equal, and returns False otherwise.

28. (functions) What is wrong with the following code? It is meant to be a custom function that one could use in an Excel formula that finds the smallest of three numbers.

Function my_min(x, y, z)

x = Range("A1")
y = Range("A2")
z = Range("A3")

If x <= y And x <= z Then
my_min = x
ElseIf y <= x And y <= z Then
my_min = y
Else
my_min = z
End If

End Function