Exam 98-388: Introduction to Programming Using Java Practice Test
Exam 98-388 practice focuses on reading and writing Java code, tracing program execution, and applying core language constructs. The available questions use examples involving strings, arithmetic expressions, loops, conditional logic, arrays, methods such as Math.max, and exception handling with try and finally blocks.
Exam overview
About the Exam 98-388: Introduction to Programming Using Java Exam
Java programming requires tracking how values change as statements execute and selecting expressions that produce the intended result. Practice tracing loops and compound assignments, evaluating operators such as remainder, and distinguishing inclusive range conditions from other comparisons. Array questions develop attention to declaration syntax, element types, valid indexes, and the runtime consequences of an out-of-range access. String questions ask you to recognize construction and value behavior, while exception-handling questions test the role of finally in control flow. These skills support debugging small programs, checking boundary cases, and translating a task into clear statements using Java’s types and control structures. When solving code-output items, follow execution in order and account for each update before choosing an answer.
Sample Practice Questions
Review a selection from this exam's published US Practice Tests practice bank.
What is the output of this code?
Show answer
Correct answer: BA `switch` transfers control to the matching `case`. The `break` after `case 2` prevents execution from falling through to the following case.
Which expression creates a new `String` containing the text `Java`?
Show answer
Correct answer: AThe `String` class has a constructor that accepts a string value, so `new String("Java")` creates a String object with that text.
What is the value of `total` after this code executes? ```java int total = 0; for (int i = 1; i <= 4; i++) { total += i; } ```
Show answer
Correct answer: CThe loop adds 1, 2, 3, and 4 to `total`, producing 10.
Which statement about the `break` statement in a Java loop is correct?
Show answer
Correct answer: BA `break` statement terminates the nearest enclosing loop (or switch statement) and continues execution after it.
What does the `finally` block in a `try` statement generally provide?
Show answer
Correct answer: BA `finally` block is generally executed after the `try` block and any applicable `catch` block, making it useful for cleanup. There are special termination cases where it may not run, such as abrupt JVM termination.
Which condition is true exactly when the integer variable `n` is between 1 and 10, inclusive?
Show answer
Correct answer: AThe `&&` operator requires both comparisons to be true, including the endpoints 1 and 10.
Which statement correctly declares an array that can hold five `double` values?
Show answer
Correct answer: BJava array declarations use a component type followed by `[]`; `new double[5]` creates an array with five elements.
How to use this practice test
The free practice session selects up to 20 random questions from the 50-question bank. Work through each Java snippet by tracing variable values, conditions, and control flow; after the session, review the displayed results to identify concepts that need more practice.
Preparation tips
- Trace each loop iteration in a small table, recording the loop variable and any accumulated value after every pass.
- For condition questions, test boundary values such as 1, 10, 0, and 11 to verify inclusive comparisons.
- Review Java array declarations and valid index ranges; for an array of length five, the usable indexes are 0 through 4.
- Evaluate arithmetic expressions in Java order, paying particular attention to integer remainder with the % operator.
- Compare try-catch-finally control flow and identify when a finally block runs as execution leaves the try statement.