Quiz 4

Friday

With a piece of paper, write down your name and answers to the following questions.

Consider the following program?

public final class Program {
	public static void main(final String[] args) {
		mysteriousTwo(3);
	}

	private static void mysteriousTwo(final int n) {
		if (n < 1)
			return;
		mysteriousTwo(n - 1);
		mysteriousOne(3);
	}

	private static void mysteriousOne(final int n) {
		if (n <= 1) {
			System.out.println("Hurrah");
			return;
		}
		System.out.println("Hip");
		mysteriousOne(n - 1);
	}
}
  1. What is the base case for the mysteriousOne method?

    Answer: n <= 1.

  2. What is the recursive case for the mysteriousOne method?

    Answer: n > 1.

  3. What is the output of this program?

    Answer:

    Hip
    Hip
    Hurrah
    Hip
    Hip
    Hurrah
    Hip
    Hip
    Hurrah

Student Performance and Statistics

A histogram of student performance on percentage grades for Quiz 4 on Friday.

100% 0 90 - 99% 0 80 - 89% 4 70 - 79% 0 60 - 69% 1 50 - 59% 0 40 - 49% 4 30 - 39% 0 20 - 29% 2 10 - 19% 0 0 - 9% 0

A table showing the average performance for each question in Quiz 4 on Friday.

Q1 0.9 / 1 Q2 0.0 / 1 Q3 1.7 / 3