The exam will be open book -- you may use your textbook as well as printouts of the lecture notes. No other material will be allowed.
The exam may consist of questions similar in style and content to those listed below.
The exam will cover topics on branching (if statements), looping (while, do-while, for loops), and arrays.
Exercises R6.14, R6.17
Exercise R7.5
Exercises R8.7, R8.16, R8.17
Given the following code:
public int enigma( int n ) { int m; while ( n >= 10 ) { m = 0; while ( n > 10 ) { m += n % 10; n /= 10; } n = m; } return n; }
What does the statement: System.out.println( enigma(1995) )
print on the screen?