Quiz #3

Friday

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

  1. What is the Java keyword that can be used to represent an instance of the class in which it appears and can be used to access class variables and methods?

    1. me
    2. this
    3. that
    4. self
  2. What object collaboration relationship does the following UML diagram demonstrate?

    Class Diagram

    1. Nesting
    2. Aggregation
    3. Concatenation
    4. Class Fielding
  3. Should class designers avoid returning references to mutable private fields because doing so may allow users of the class to adversely affect the internal state of an object?

    Answer: Yes, they should avoid returning references to mutable private fields.

  4. What is the output of the following program?

    public class Program {
      public static void main(final String[] args) {
        System.out.println(Gender.Male);
      }
    }

    enum Gender {
      Confidential,
      Male,
      Female;
    }

    Answer: Male

Student Performance and Statistics

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

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

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

Q1 0.8 / 1 Q2 0.6 / 1 Q3 0.8 / 1 Q4 0.8 / 1