logo CodeStepByStep logo

ParameterMysterySection2

Language/Type: VB parameters return

The following console program uses parameters and produces eight lines of output. What are they?

Public Module ParameterMysterySection2
    Public Sub Main()
        Dim a As Integer = 137
        Dim b As Integer = 42

        Console.WriteLine("a = " & a)
        Foo(b)
        Console.WriteLine("a = " & a)
        Console.WriteLine("b = " & b)

        a = Bar(b, a + b)  
        Console.WriteLine("a = " & a)
        a = Bar(a, b)  
        Console.WriteLine("a = " & a)
    End Sub

    Public Sub Foo(a As Integer)
        Console.WriteLine("a = " & a)
        a = 160
    End Sub

    Public Function Bar(c As Integer, b As Integer)
        Dim d As Integer = b - c
        Console.WriteLine("d = " & d)
        Return d Mod 10
    End Function
End Module
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.