โ† All 1Z0-811 Flashcard Decks

Core Java API Flashcards

7 cards from real 1Z0-811 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 Java API flashcards as text
  1. What does `Arrays.copyOfRange(arr, 1, 4)` return for `arr = {10,20,30,40,50}`?

    Answer: {20,30,40}

    `copyOfRange(arr, 1, 4)` copies elements at indices 1, 2, and 3 (exclusive end), yielding {20,30,40}.

  2. Which `String` method checks whether the string begins with a given prefix?

    Answer: startsWith()

    `String.startsWith(prefix)` returns true if the string starts with the specified prefix.

  3. What is printed by `System.out.println(Double.isNaN(0.0 / 0.0))`?

    Answer: true

    Dividing 0.0 by 0.0 with floating-point arithmetic produces NaN, so `Double.isNaN()` returns true.

  4. Which method on `Queue` retrieves and removes the head, or returns null if empty?

    Answer: poll()

    `Queue.poll()` retrieves and removes the head element, returning null if the queue is empty.

  5. What is the effect of calling `Collections.sort(list, Comparator.reverseOrder())`?

    Answer: Sorts list in descending order

    `Comparator.reverseOrder()` produces a comparator that imposes the reverse of the natural ordering, sorting the list in descending order.

  6. What does `String.join("-", "a", "b", "c")` return?

    Answer: "a-b-c"

    `String.join(delimiter, elements...)` concatenates the elements with the delimiter between each pair, producing "a-b-c".

  7. Which method converts a `Stream` to an `Optional` containing the first element?

    Answer: findFirst()

    `Stream.findFirst()` returns an `Optional` describing the first element of the stream, or an empty Optional if the stream is empty.