logo CodeStepByStep logo

ParameterMysteryExam4

Language/Type: C# parameters return

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

public class ParameterMysteryExam4
{
    public static void Main()
    {
        int x = 5;
        int y = 1;
        int z = 9;
        int w = y + 2;

        Surprise(x, y);
        x = Surprise(z, w);
        w++;
        z = Surprise(w, x);
        surprise(y, z);
    }

    public static int Surprise(int y, int x)
    {
        x++;
        Console.WriteLine(x + " " + y);
        y--;
        return x;
    }
}
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.