CSE 142
SPRING 2007
FINAL EXAM
1. Expressions (5 points)
For each expression in the left-hand column, indicate its value in the right-hand column.
Be sure to list a constant of appropriate type (e.g., 7.0 rather than 7 for a double, Strings in "quotes").

CSE 142, Winter 2007
Final Exam
1. Expressions (5 points)
For each expression in the left-hand column, indicate its value in the right-hand column. Be sure to list a constant of
appropriate type (e.g., 7.0 rather than 7 for a double, Strings in "quotes").

CSE 142
Sample Final Exam #3
1. Array Mystery
Consider the following method:
public static void arrayMystery(int[] a) cfw_
for (int i = a.length - 2; i > 0; i-) cfw_
if (a[i + 1] <= a[i - 1]) cfw_
a[i]+;
Indicate in the right-hand column what values wo

CSE 142
Sample Final Exam #4
1. Expressions (10 points)
For each expression in the left-hand column, indicate its value in the right-hand column.
Be sure to list a constant of appropriate type (e.g., 7.0 rather than 7 for a double, Strings in "quotes"). I

CSE 142
Sample Final Exam #2
1. Array Mystery
Consider the following method:
public static int arrayMystery(int[] array) cfw_
int x = 0;
for (int i = 0; i < array.length - 1; i+) cfw_
if (array[i] > array[i + 1]) cfw_
x+;
return x;
In the left-hand col

CSE 142
Sample Final Exam #1
1. Array Mystery
Consider the following method:
public static void arrayMystery(int[] a) cfw_
for (int i = 1; i < a.length; i+) cfw_
a[i] = i + a[i - 1] - a[i];
Indicate in the right-hand column what values would be stored i