1Z0-811 What is Java Practice Question
Exhibit
Refer to the exhibit.
```
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at com.example.MyClass.createObjects(MyClass.java:15)
```What is the most likely cause of this error?
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
✓
The heap size is insufficient for the objects being created.
OutOfMemoryError: Java heap space indicates the heap is full. Option A (memory leak in native code) would typically cause a different error, such as a native memory error. Option C (stack overflow) would be StackOverflowError. Option D (too many threads) would cause an error like 'unable to create new native thread'.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
There is a memory leak in native code outside the heap.
Why it's wrong here
A memory leak in native code would typically cause a native memory error, not OutOfMemoryError: Java heap space.
- ✓
The heap size is insufficient for the objects being created.
Why this is correct
Heap space error occurs when object allocations exceed heap capacity.
- ✗
There is a stack overflow in the method being called.
Why it's wrong here
Stack overflow produces StackOverflowError.
- ✗
Too many threads are running concurrently.
Why it's wrong here
Too many threads running concurrently would cause an error like 'unable to create new native thread', not OutOfMemoryError: Java heap space.
Go deeper
Related to this question
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 →
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.