Quiz #1

Wednesday

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

  1. Which of the following is a valid println statement?

    1. System.out.println + "Hello World";
    2. out.System.println("Hello World");
    3. println.out("Hello World");
    4. None of the above is valid
  2. &&, ||, and ! are ____.

    1. relational operators
    2. logical operators
    3. conditional operators
    4. ternary operators
  3. This type of method does not return a value

    1. null
    2. void
    3. empty
    4. anonymous
  4. Find the error in the following class:

    public class MyClass {
        private int x;
        public void MyClass(int a) {
            x = a;
        }
    }

    Correction:

    public class MyClass {
        private int x;
        public MyClass(int a) {
            x = a;
        }
    }

Student Performance and Statistics

A histogram of student performance on percentage grades for Quiz 1 on Wednesday.

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

A table showing the average performance for each question in Quiz 1 on Wednesday.

Q1 1.0 / 1 Q2 0.4 / 1 Q3 0.7 / 1 Q4 0.1 / 1

Friday

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

  1. These characters mark the beginning of a single-line comment.

    1. //
    2. /*
    3. */
    4. /**
  2. This type of expression has a value of either true or false.

    1. binary expression
    2. decision expression
    3. unconditional expression
    4. boolean expression
  3. What will the println statement in the following program segment display?

    int x = 5
    System.out.println(++x);
    1. 5
    2. 6
    3. 0
    4. None of these
  4. Find the error in the following method.

    public static double timesTwo(double num) {
        double result = num * 2;
    }

    Correction:

    public static double timesTwo(double num) {
        double result = num * 2;
        return result;
    }

Student Performance and Statistics

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

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

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

Q1 0.9 / 1 Q2 1.0 / 1 Q3 0.8 / 1 Q4 0.8 / 1