Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Consider the following event procedure that calls a Function procedure named Cube, which returns the cube of a number. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim num, result As Double num = CDbl(InputBox("Enter a number to cube:")) result = Cube(num) txtBox.Text = "The cube of " & num & " is " & result & "." End Sub Which of the following is a correct Function definition for Cube?

Consider the following event procedure that calls a Function procedure named Cube, which
returns the cube of a number.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim num, result As Double
num = CDbl(InputBox("Enter a number to cube:"))
result = Cube(num)
txtBox.Text = "The cube of " & num & " is " & result & "."
End Sub
Which of the following is a correct Function definition for Cube?


1. Function Cube(var As Double) As Double
Return var ^ 3
End Function
2. Function Cube(num As Double) As Double
Return num ^ 3
End Function


(A) 1 only
(B) 2 only
(C) Both 1 and 2
(D) Neither 1 nor 2



Answer: C

Which statement is True in regard to the following code?

Which statement is True in regard to the following code?



A) This is an infinite loop.
B) intCount should start at -1.
C) The Items.Insert method should be used instead of Items.Add.
D) The text Good Job should not have quotation marks around it.


Correct Answer(s): A

What is wrong with the following code?

What is wrong with the following code?



A) The Next statement must read Next intIndex.
B) A For Next loop cannot be used to count backward.
C) intIndex is declared incorrectly for use with this type of loop.
D) You need to specify a negative step value in order to execute this loop.


Correct Answer(s): D