Review Questions

3.4 Which of the following expressions will be evaluated using floating-point arithmetic?

Select the three correct answers.

  1. 2.0 * 3.0

  2. 2 * 3

  3. 2/3 + 5/7

  4. 2.4 + 1.6

  5. 0x10 * 1L * 300.0

3.5 What is the value of the expression (1 / 2 + 3 / 2 + 0.1)?

Select the one correct answer.

  1. 1

  2. 1.1

  3. 1.6

  4. 2

  5. 2.1

3.6 What will be the result of attempting to compile and run the following program?
public class Integers {
    public static void main(String[] args) {
        System.out.println(0x10 + 10 + 010);
    }
}

Select the one correct answer.

  1. The program will not compile. The compiler will complain about the expression 0x10 + 10 + 010.

  2. When run, the program will print 28.

  3. When ...

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.