Buy New CIS170A Quiz 5 in vb
Buy New CIS170A Quiz 5 in vb
1. (TCO 7) Modular programming uses a(n) _____ and _____ approach to problem solving. (Points : 3)
divide, conquer
breakdown, conquer
divide, simplify
abstraction, modular
2. (TCO 7) In Visual Basic, variables can be declared with what scope? (Points : 3)
Local
Universal
Global
Local and Global
Local and universal
3. (TCO 7) The _____ statement is used to pass a value back to the calling code from a function. (Points : 3)
void
return
type
value parameter
4. (TCO 8) Which part of a function or sub-procedure declaration statement is optional? (Points : 3)
Procedure name
Body code
Header
Parameters
5. (TCO 8) The process of passing only the value of a variable to a function or sub-procedure is called _____. (Points : 3)
passing by reference
passing by value
localization
valuation of parameters
6. (TCO 8) Consider the following function call.
Dim letter grade As String
letterGrade = CalcLetterGrade(95.5)
What would be a valid function declaration? (Points : 3)
Private Function CalcLetterGrade(ByVal del X As Double) As Integer
Private Function CalcLetterGrade(ByVal del X As Double) As String
Private Function CalcLetterGrade(ByVal del X As Double) As Double
Private Function CalcLetterGrade(ByVal into As Integer) As String
7. (TCO 8) What changes are required in the following code so that the resulting output is as follows?
Expected Output:
num1 = 2
num2 = 1
num3 = 3
Code:
Sub Main()
Dim num1 As Integer = 1
Dim num2 As Integer = 2
Dim num3 As Integer = 3
Swap(num1, num2, num3)
Console.WriteLine(“num1 = ” & num1)
Console.WriteLine(“num2 = ” & num2)
Console.WriteLine(“num3 = ” & num3)
End Sub
Sub Swap(ByVal an As Integer, ByVal b As Integer, ByVal c As Integer)
Dim temp As Integer
temp = a
a = b
b = temp
End Sub (Points : 3)
Change function declaration to Sub Swap(ByVal an As Integer, ByRef b As Integer, ByVal c As Integer).
Change function declaration to Sub Swap(ByRef an As Integer, ByVal b As Integer, ByVal c As Integer).
Change function declaration to Sub Swap(ByRef an As Integer, ByRef b As Integer, ByVal c As Integer).
No changes are required, and the function works as expected.
8. (TCO 8) What is displayed when the following code is executed?
Sub Main()
Dim val1 As Integer = 4
Dim val2 As Integer = 5
Triple(val1, val2)
Console.WriteLine(“val1 = ” & val1)
Console.WriteLine(“val2 = ” & val2)
End Sub
Sub Triple (ByVal x As Integer, ByRef y As Integer)
Dim temp As Integer
temp = x
x = y
y = temp
End Sub (Points : 3)
val1 = 5
val2 = 4
val1 = 4
val2 = 4
val1 = 4
val2 = 5
None of the above
9. (TCO 7) Which of the following is NOT an advantage of creating modular code? (Points : 3)
The complexity of the code design decreases.
The amount of time required to code a program decreases.
Finding errors is easier.
Many people can work on related modules at the same time.
10. (TCO 7) Which of the following should NOT be considered when designing a module? (Points : 3)
The module should perform one single task.
The module should contain appropriate documentation.
The module should have a single entry point.
The module should allow for a flexible interface.
11. (TCO 8) What will be the output of the following program when it is executed?
Sub Main()
Dim num As Integer = 5
MultiplyAndPrint(num)
num = 7
MultiplyAndPrint(num)
num = 9
MultiplyAndPrint(num)
End Sub
Sub MultiplyAndPrint(ByVal num As Integer)
Dim strHold As String
If num >= 7 Then
strHold = “Result is: ” & (2 * num)
Else
strHold = “Result is: ” & (8 * num)
End If
System.Console.WriteLine(strHold)
End Sub (Points : 5)
Need to Buy Quiz?
Are you suffering together with your online classes? Are you wondering, can I pay a person to finish elegance online for me? Do you need a person that will help you out? You have come to the proper place. At Get Exam Done, we provide skilled lecturers who will cope with your everyday online elegance portals. You do not ought to do anything, not to mention search, or pay someone to take my online class. Everything in your portal could be accomplished from our quit, including assignments, discussions, and quizzes.