Name_______________________________ Your final answer to each question should appear on this sheet.
v22.0002, Additional sample questions for the final
For the String problems, you may use the charAt(j), substring() and length() methods.

None of the methods you write should read from the keyboard or write to the screen. Don't call System.out

1 Given the following method heading
 public static boolean palindrome( String s)
write a method that returns true if the string s is a palindrome, i.e., the letters arer symmetric around the midpoint of the string. It should return false, if the string is not a palindrome. For example, "asdffdsa" and "asdfdsa" are palindromes where as "asdfgh" is not.

2. Write a method with the heading public static boolean palindrome(int[] x) that determines if x is a palindrome.

3.. Given an array x that has n elements and an array y that has m elements, write a method with the heading public static void addThem(int[] x, int[] y, int[] z) that copies the m elements of x into the first m elements of z and the n elements of y into the next n elements of z. The dimension of z is n + m. Note that the dimension of any array, let's say w, is w.length.

4. Write a method with the heading public static void pattern(int n) that produces the following triangle:

where the bottom line has n x's.

5. Write a method public static int sum(int[] x) that adds all the elements in the array x.