← All 1Z0-819 Flashcard Decks

Core APIs & Data Manipulation Flashcards

7 cards from real 1Z0-819 practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 7 Core APIs & Data Manipulation flashcards as text
  1. What does `String.format("%05d", 42)` produce?

    Answer: 00042

    The `%05d` format specifier pads the integer with leading zeros to a width of 5.

  2. Which method returns an `OptionalInt` containing the sum of an `IntStream`?

    Answer: reduce(Integer::sum)

    `IntStream.reduce(Integer::sum)` returns an `OptionalInt` because the stream might be empty; `sum()` returns a plain `int`.

  3. What is the result of `"hello".substring(2, 4)`?

    Answer: ll

    `substring(beginIndex, endIndex)` extracts characters from index 2 (inclusive) to 4 (exclusive), yielding "ll".

  4. Which `LocalDate` method adds a specified number of months and adjusts the day if the result month is shorter?

    Answer: plusMonths()

    `plusMonths()` adds months and normalizes the day-of-month if the target month has fewer days.

  5. Which interface does `HashMap` NOT implement?

    Answer: SortedMap

    `HashMap` implements `Map`, `Cloneable`, and `Serializable`, but NOT `SortedMap` — that is implemented by `TreeMap`.

  6. What does `Arrays.asList(1, 2, 3).remove(0)` do at runtime?

    Answer: Throws UnsupportedOperationException

    The list returned by `Arrays.asList` is fixed-size; structural modifications like `remove` throw `UnsupportedOperationException`.

  7. What is the output of `Math.round(2.5)`?

    Answer: 3

    `Math.round(double)` uses half-up rounding, so 2.5 rounds to 3L (returns a `long`).