logo CodeStepByStep logo

ParameterMysteryExam4

Language/Type: VB parameters return

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

Public Module ParameterMysteryExam4
    Public Sub Main()
        Dim x As Integer = 5
        Dim y As Integer = 1
        Dim z As Integer = 9
        Dim w As Integer = y + 2

        Surprise(x, y)
        x = Surprise(z, w)
        w += 1
        z = Surprise(w, x)
        Surprise(y, z)
    End Sub

    Public Function Surprise(y As Integer, x As Integer)
        x += 1
        Console.WriteLine(x & " " & y)
        y -= 1
        Return x
    End Function
End Module
line 1
line 2
line 3
line 4

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.