Courseiva
Arrays and MethodshardMultiple ChoiceObjective-mapped

1Z0-811 Arrays and Methods Practice Question

Given 'int[] source = {1,2,3,4,5};' and 'int[] dest = new int[3];' which code correctly copies the first three elements from source to dest using System.arraycopy?

⚠ Common exam trap

Oracle often tests the misconception that the `length` parameter refers to the total size of the destination array rather than the number of elements to copy, leading candidates to choose option B.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

System.arraycopy(source, 0, dest, 0, 3);

`System.arraycopy(source, 0, dest, 0, 3)` copies exactly three elements starting from index 0 of the source array to index 0 of the destination array, matching the requirement. The `length` argument (3) specifies the number of array elements to copy, and the destination array has a capacity of 3, so no `ArrayIndexOutOfBoundsException` occurs.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • System.arraycopy(source, 0, dest, 0, 3);

    Why this is correct

    Correct parameters.

  • System.arraycopy(source, 0, dest, 0, 5);

    Why it's wrong here

    Length 5 exceeds dest length.

  • System.arraycopy(source, 1, dest, 0, 3);

    Why it's wrong here

    sourcePos should be 0, not 1.

  • System.arraycopy(source, 0, dest, 1, 3);

    Why it's wrong here

    destPos should be 0, not 1.

About these practice questions

One of 481 original 1Z0-811 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.