This website is preserved for historical and scholarly reference and is no longer actively maintained.
QUIZ 14
September 22, 1997
#1. What is printed by the following program? Show the results exactly as they will appear. ( 5 pts.)
import ccj.*;
public class quiz14
{
public static void main (String[] args)
{
int x = 2;
System.out.println("" + x);
x = fun1(x);
System.out.println("" + x);
x = fun1(x);
System.out.println (" " + x);
}
public static int fun1 (int s)
{
int y = s * (s + 1 );
return y;
}
}
#2. In problem #1, should the function have printed the value of y before returning the value? Justify your answer. (2 pts.)
#3. The text refers to a parameter value and a parameter variable. In problem #1, identify the parameter variable. (1 pt.)
#4. Use De Morgan's laws to simplify the following Boolean expression. (2 pts.)