Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. (TCO 7) The process of breaking a large program down into manageable pieces i

ID: 3665259 • Letter: 1

Question

1. (TCO 7) The process of breaking a large program down into manageable pieces is known as top-down design or the _____. (Points : 3)

       divide and solve approach
       divide and conquer approach
       modularity breakdown approach
       module division approach

Question 2. 2. (TCO 7) In Visual Basic, variables can be declared with what scope? (Points : 3)

       Local
       Universal
       Global
       Local and global
       Local and universal

Question 3. 3. (TCO 7) How many values can a function return? (Points : 3

       Zero or more
       One or more
       Zero
       One

Question 4. 4. (TCO 8) The pieces of information passed to a function when the function is invoked are called _____. (Points : 3)

       inputs
       arguments
       function headers
       prototypes

Question 5. 5. (TCO 8) When we pass parameters to a function or sub procedure using the memory address of that parameter, we are passing arguments by _____. (Points : 3)

       parameter
       argument
       reference
       value

Question 6. 6. (TCO 8) What is wrong with the following call statement and its corresponding sub statement?

Call Statement:

DayOfTheWeek(15, "June", 1902)

Sub Statement:

Sub DayOfTheWeek(ByVal var1 As Integer, ByVal var2 As String, ByVal var3 As String) (Points : 3)

       Constant values like 1902 cannot be passed, only variables.
       It is not valid to pass a value like "June."
       var3 is not of the same data type as 1902.
       Nothing is wrong with them.

Question 7. 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 a 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 a As Integer, ByRef b As Integer, ByVal c As Integer).
       Change function declaration to: Sub Swap(ByRef a As Integer, ByVal b As Integer, ByVal c As Integer).
       Change function declaration to: Sub Swap(ByRef a As Integer, ByRef b As Integer, ByVal c As Integer).
       No changes are required, the function works as expected.

Question 8. 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

Question 9. 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.

Question 10. 10. (TCO 7) Which of the following should be considered when designing a module? (Points : 3)

       The module should perform as many tasks as possible.
       The module should have a flexible interface.
       The module should have a single entry point.
       The module should return more than one value.

Question 11. 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)

1. (TCO 7) The process of breaking a large program down into manageable pieces is known as top-down design or the _____. (Points : 3)

       divide and solve approach
       divide and conquer approach
       modularity breakdown approach
       module division approach

Explanation / Answer

Modularity breakdown approach Local and Global One Arguments Reference var3 is not of the same data type as 1902. No changes are required, the function works as expected. Val1=5, val2=4 The amount of time required to code a program decreases.    The module should have a single entry point. 40,14,18