CS 1073 Introductory Programming
for Scientific Applications
Review and Topics for
Final Exam, Fall 2004


Date and length: Tuesday, 14 Dec 2004, 1:30-4:15 pm.


Topics that came before the mid-term exam:


Topics that came after the mid-term exam:


Possible Questions: I will pick simple questions about many of the topics above. Often it will involve giving you some code and asking you to explain, modify, or complete the code.

  1. Simple loop: I may give you a loop to modify or ask you to write a loop.

    Question: Here is a practice problem: loop problem.
    Solution. (Don't access until you've tried the problem.)

  2. Array initialization with curley brackets:

    Question: Use a for loop to add up the squares of the primes stored in the array in 2 above. Print the sum.
    Solution. (Don't access until you've tried the problem.)

  3. for loops and arrays: For loops go hand-in-hand with arrays, to I may use such an example as a loop to set all elements of an array to zero:

    Question: Here is a practice problem: Problem involving arrays.
    Solution. (Don't access until you've tried the problem.)

  4. Strings. (Remember that strings in Java are objects, not primitive data types, and as such there are a number of methods for working with strings. Given two strings String s1, s2;, you would not normally compare them for equality with s1 == s2, but instead with s1.equals(s2). Similarly, use s1.compareTo(s2) to compare strings using alphabetic order.)

    Question: Here is a practice problem: Problem involving strings.
    Solution. (Don't access until you've tried the problem.)

  5. Java classes: I might give you a class similar to the Rectangle or the Circle class, ask questions about it, and ask you to fill in missing parts.

    Question: Here is a practice problem: Problem involving classes.
    Solution. (Don't access until you've tried the problem.)

  6. Strings and arrays of Strings: Simple examples and then an example similar to "Bottles of Beer"

    Question: Here is a practice problem: 12 days of Christmas.
    Solution. (Don't access until you've tried the problem.)

  7. Approximation: We did vartious approximation algorithms.

    Question: Here is an approximation problem: Approximate pi.
    Solution. (Don't access until you've tried the problem.)