CMSC 132 Quiz 1 Worksheet information about the quiz:

advertisement
CMSC 132 Quiz 1 Worksheet
The first quiz for the course will be on Friday, June 9 in lecture. The following list provides more
information about the quiz:



The quiz will be a written quiz (no computer).
Closed book, closed notes quiz.
Answers must be neat and legible. We recommend that you use pencil and eraser.
The following exercises cover the material to be included in this quiz. Solutions to these exercises
will not be provided, but you are welcome to discuss your solutions with the TA or instructor
during office hours.
Problem I
1. Write a Java program that copies the contents of a text file (source file) to another
text file. The program must ask for a source file name as long as an invalid file
name (e.g., a name for a file that does not exist) is provided.
2. Write a Java program that reads a sequence of integer values and computes the
average. The program will give the user the choice of reading data either from the
standard input (System.in) or from a file. In addition, the program will give the
user the choice of sending the output to the standard output (System.out) or a
specific file.
3. Implement a method named compareStrArrays that has the following prototype:
public static boolean compareStrArrays(String[][] array1, String[][] array2);
The method will return true if the arrays have the same dimensions and the same
String values. Keep in mind that each array can have rows with different lengths.
Download