Chapter 3Using Operators and Decision Constructs

THE OCA EXAM TOPICS COVERED IN THIS PRACTICE TEST INCLUDE THE FOLLOWING:

  • Using Operators and Decision Constructs
    • Use Java operators; use parentheses to override operator precedence
    • Test equality between Strings and other objects using == and equals()
    • Create if and if/else and ternary constructs
    • Use a switch statement
  1. Which of the following variable types is not permitted in a switch statement?

    1. String
    2. double
    3. int
    4. char
  2. What is the value of tip after executing the following code snippet?

    int meal = 5;
    int tip = 2;
    int total = meal + (meal>6 ? ++tip : ‐‐tip);
    1. 1
    2. 2
    3. 3
    4. 6
  3. What is the ...

Get OCA / OCP Java SE 8 Programmer Practice Tests 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.