Question 279 of 513
1Z0-829 Working with Arrays and Collections Practice Question
Given: Map<Integer, String> map = new HashMap<>(); map.put(1, "one"); map.put(2, "two"); map.entrySet().stream().filter(e -> e.getKey() > 1).forEach(System.out::print); What is output?
⚠ Common exam trap
The trap here is that candidates may forget the filter condition excludes key 1, or mistakenly think the stream prints all entries, leading them to choose options that include both entries or no output.
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
✓
2=two
The filter(e -> e.getKey() > 1) retains only the entry with key 2, which is "2=two". The forEach(System.out::print) prints that entry without a newline, so the output is "2=two". Option D is correct.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
2=two1=one
Why it's wrong here
Both entries would be printed without filter.
- ✗
1=one2=two
Why it's wrong here
Both entries in insertion order, but filter excludes key 1.
- ✗
No output
Why it's wrong here
There is an entry with key > 1, so output is produced.
- ✓
2=two
Why this is correct
Only the entry with key 2 passes the filter.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 25, 2026
This 1Z0-829 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-829 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.