logo CodeStepByStep logo

ParameterMysteryExam2

Language/Type: C# parameters return

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

public class ParameterMysteryExam2
{
    public static void Main()
    {
        string x = "happy";
        string y = "pumpkin";
        string z = "orange";
        string pumpkin = "sleepy";
        string orange = "vampire";

        Orange(y, x, z);
        x = Orange(x, z, y);
        Orange(pumpkin, z, "y");
        z = "green";
        Orange("x", "pumpkin", z);
        Orange(x, z, orange);
    }

    public static string Orange(string z, string y, string x)
    {
        Console.WriteLine(y + " and " + z + " were " + x);
        return x + y + z;
    }
}
line 1
line 2
line 3
line 4
line 5

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.