16+ practice questions focused on Controlling Program Flow — one of the most tested topics on the Oracle Certified Professional Java SE 17 Developer 1Z0-829 exam. Each question includes a detailed explanation so you learn why the right answer is correct.
Start Controlling Program Flow PracticeA developer writes code to iterate over a list of strings and print each element. The code uses an enhanced for loop. Which statement is true about the enhanced for loop?
Explanation: The enhanced for loop (for-each) in Java can iterate over arrays and any object that implements the Iterable interface, which includes all Collection classes (e.g., List, Set, Queue). This is because the for-each loop internally uses an iterator for Iterable objects or array indexing for arrays, making it a versatile construct for traversing elements without needing an explicit counter.
Given the code snippet: int x = 10; if (x > 5) { System.out.print("A"); } else if (x > 7) { System.out.print("B"); } else { System.out.print("C"); } What is the output?
Explanation: The if-else chain evaluates conditions sequentially. Since x=10 satisfies x > 5, the first block executes and prints 'A'. The else if and else branches are skipped entirely because the first condition was true. Thus, only 'A' is output.
A method contains a try-with-resources statement that uses two resources: a FileInputStream and a BufferedInputStream. The FileInputStream constructor throws a FileNotFoundException. Which statement about resource closing is true?
Explanation: In a try-with-resources statement, resources are closed only if they have been successfully initialized. If the FileInputStream constructor throws a FileNotFoundException, the resource is never created, so the try-with-resources statement does not attempt to close it. The BufferedInputStream is never constructed because the exception occurs before its declaration is reached, so no resources are opened and none need to be closed. Therefore, option C is correct.
Which TWO statements are true about the switch statement in Java?
Explanation: Option B is correct because Java's switch statement supports String objects since Java 7, allowing comparison based on the string's hashCode() and equals() methods. Option D is correct because switch can be used as an expression (e.g., with the arrow syntax) that yields a value, which can be assigned to a variable or returned.
Which THREE statements are true about loops in Java?
Explanation: The break statement in Java is used to immediately terminate the execution of a loop (for, while, or do-while) and transfer control to the statement following the loop. This allows premature exit based on a condition, which is a fundamental control flow mechanism in Java.
+11 more Controlling Program Flow questions available
Practice all Controlling Program Flow questions1. Baseline your knowledge
Start with 10 questions to gauge your current understanding of Controlling Program Flow. This tells you whether you need a concept refresher or just practice.
2. Review every explanation
For each question — right or wrong — read the full explanation. Understanding why an answer is correct is more valuable than knowing the answer itself.
3. Focus on exam traps
Controlling Program Flow questions on the 1Z0-829 frequently use trap wording. Look for subtle differences in answers that test your precision, not just general knowledge.
4. Reach 80% consistently
Do repeated sessions until you score 80%+ three times in a row. Then move to mixed-mode practice to test cross-topic recall under realistic conditions.
The exact number varies per candidate. Controlling Program Flow is tested as part of the Oracle Certified Professional Java SE 17 Developer 1Z0-829 blueprint. Practicing with targeted Controlling Program Flow questions ensures you can handle any format or difficulty that appears.
Yes. Courseiva provides free 1Z0-829 practice questions across all exam topics and domains. The platform includes topic-based practice, mock exams, missed-question review, bookmarked questions, and readiness tracking — no account required.
Difficulty is subjective, but Controlling Program Flow is a high-priority exam concept tested in multiple ways — direct recall, scenario analysis, and command-output interpretation. Consistent practice is the best way to build confidence.
Launch a full Controlling Program Flow practice session with instant scoring and detailed explanations.
Start Controlling Program Flow Practice →