1Z0-811 · topic practice

Arrays and Methods practice questions

Practise Oracle Java Foundations 1Z0-811 Arrays and Methods practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Reviewed byJohnson Ajibi· MSc IT Security
17 questionsDomain: Arrays and Methods

What the exam tests

What to know about Arrays and Methods

Arrays and Methods questions test whether you can apply the concept in context, not just recognise a definition.

How the topic appears in realistic exam-style scenarios.

Which detail in the question changes the correct answer.

How to eliminate plausible but wrong options.

How to connect the question back to the wider exam objective.

Watch out for

Common Arrays and Methods exam traps

  • Answering from memory before reading the full scenario.
  • Missing a constraint such as cost, availability, security, scope or command context.
  • Choosing a broad answer when the question asks for the most specific fix.
  • Ignoring why the wrong options are tempting.

Practice set

Arrays and Methods questions

17 questions · select your answer, then reveal the explanation

Question 1mediummultiple choice
Read the full NAT/PAT explanation →

A developer writes a method that takes an int array and returns the sum of its elements. The method signature is: 'public static int sumArray(int[] arr)'. Which statement correctly calls this method?

Given the code snippet: 'int[] nums = {10, 20, 30, 40}; int sum = 0; for (int i = 0; i < nums.length; i++) { sum += nums[i]; }'. What is the value of sum after execution?

A method 'public static void modifyArray(int[] arr) { arr[0] = 99; }' is called with 'int[] myArray = {1,2,3}; modifyArray(myArray); System.out.println(myArray[0]);'. What is the output?

Which of the following correctly declares and initializes an array of strings with the elements "A", "B", and "C"?

A method 'public static int findMax(int[] numbers)' returns the maximum value in the array. Which implementation correctly handles an empty array by returning 0?

Given the method: 'public static void swapFirstTwo(int[] arr) { int temp = arr[0]; arr[0] = arr[1]; arr[1] = temp; }'. What is the effect of calling this method with an array of length 1?

Question 7mediummultiple choice
Read the full NAT/PAT explanation →

A developer writes a method that accepts a variable number of int arguments and returns their product. Which method signature correctly implements this?

What is the output of the following code? int[] a = {1,2,3}; int[] b = a; b[0] = 99; System.out.println(a[0]);

Which of the following correctly describes the effect of the method call 'Arrays.sort(myArray)' on an array of objects that do not implement Comparable?

Which TWO statements are true about method overloading in Java?

Which TWO statements are true about passing arrays to methods in Java?

Question 12hardmulti select
Read the full NAT/PAT explanation →

Which THREE statements are correct about the 'main' method signature in Java?

Question 13mediummultiple choice
Read the full NAT/PAT explanation →

A team is developing a Java application for an online store. The application has a class 'Inventory' that maintains an array of 'Product' objects. The method 'public void addProduct(Product p)' is intended to add a product to the array. The current implementation uses a fixed-size array of length 100. However, the business has grown, and the array may exceed its capacity. The team needs a solution that allows dynamic resizing without changing the method signature. Which approach should the team take?

A developer is working on a Java program that processes sensor data. The data is stored in a 2D array 'double[][] readings', where each row represents a sensor and each column a time interval. The method 'public static double[] averagePerSensor(double[][] data)' should compute the average reading for each sensor (row) and return a 1D array of averages. The developer writes the following implementation: 'double[] result = new double[data.length]; for (int i = 0; i < data.length; i++) { double sum = 0; for (int j = 0; j < data[i].length; j++) { sum += data[i][j]; } result[i] = sum / data[i].length; } return result;'. However, the program sometimes throws a NullPointerException. What is the most likely cause?

Arrange the steps to create an object from a class in Java in the correct order.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5

Match each control flow statement to its purpose.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Executes a block based on a boolean condition

Selects one of many code blocks based on a value

Iterates a fixed number of times

Repeats while a condition is true

Executes at least once then repeats while condition true

A banking application stores daily transaction amounts in an array. Which declaration correctly creates an array of 31 double values?

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused Arrays and Methods sessions

Start a Arrays and Methods only practice session

Every question in these sessions is drawn from the Arrays and Methods domain — nothing else.

Related practice questions

Related 1Z0-811 topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the 1Z0-811 exam test about Arrays and Methods?
Arrays and Methods questions test whether you can apply the concept in context, not just recognise a definition.
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just Arrays and Methods questions in a focused session?
Yes — the session launcher on this page draws every question from the Arrays and Methods domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other 1Z0-811 topics?
Use the topic links above to move to related areas, or go back to the 1Z0-811 question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the 1Z0-811 exam covers. They are not copied from any real exam or dump site.