Most Missed Questions

1. Which of the following compiles and results in a == 0 being true?

  1. int a = 3 / 4;
  2. int a = (int) (3.0 / 4.0);
  3. double a = 3 / 4;
  4. All of these

More information: Lesson 2.1.5 and Lesson 2.1.7.

9. Which of the following method declarations overrides this method defined in the superclass? Note that {...} means there are valid statements inside the curly braces.

double calculateMilesPerGallon(double speed) {...}

  1. int calculateMilesPerGallon(double speed) {...}
  2. double calculateMilesPerGallon(int speed) {...}
  3. double calculateMilesPerGallon(double speed, int r) {...}
  4. double calculateMilesPerGallon(double s) {...}

More information: Lesson 7.1.4.