IT Certifications · 98-388

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

Exam providerMicrosoft
Exam code98-388
CategoryIT Certifications

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.

Question 1

What is the output of this code?

  1. A`one`
  2. B`two`
  3. C`three`
  4. D`onetwothree`
Show answerCorrect answer: B

A `switch` transfers control to the matching `case`. The `break` after `case 2` prevents execution from falling through to the following case.

Question 2

Which expression creates a new `String` containing the text `Java`?

  1. A`String text = new String("Java");`
  2. B`String text = new String["Java"];`
  3. C`String text = String("Java");`
  4. D`String text = new("Java");`
Show answerCorrect answer: A

The `String` class has a constructor that accepts a string value, so `new String("Java")` creates a String object with that text.

Question 3

What is the value of `total` after this code executes? ```java int total = 0; for (int i = 1; i <= 4; i++) { total += i; } ```

  1. A4
  2. B6
  3. C10
  4. D11
Show answerCorrect answer: C

The loop adds 1, 2, 3, and 4 to `total`, producing 10.

Question 4

Which statement about the `break` statement in a Java loop is correct?

  1. AIt skips only the current iteration and continues with the next one.
  2. BIt exits the nearest enclosing loop.
  3. CIt restarts the loop from its initialization expression.
  4. DIt exits the entire Java program.
Show answerCorrect answer: B

A `break` statement terminates the nearest enclosing loop (or switch statement) and continues execution after it.

Question 5

What does the `finally` block in a `try` statement generally provide?

  1. ACode that runs only when an exception is thrown
  2. BCode that is generally executed after the `try` and any matching `catch` processing
  3. CA replacement for the `try` block when no exception occurs
  4. DA way to declare a checked exception
Show answerCorrect answer: B

A `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.

Question 6

Which condition is true exactly when the integer variable `n` is between 1 and 10, inclusive?

  1. A`n >= 1 && n <= 10`
  2. B`n >= 1 || n <= 10`
  3. C`n > 1 && n < 10`
  4. D`n <= 1 && n >= 10`
Show answerCorrect answer: A

The `&&` operator requires both comparisons to be true, including the endpoints 1 and 10.

Question 7

Which statement correctly declares an array that can hold five `double` values?

  1. A`double values = new double[5];`
  2. B`double[] values = new double[5];`
  3. C`double values[] = double[5];`
  4. D`array<double> values = new array[5];`
Show answerCorrect answer: B

Java 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.
Official sourceOfficial exam page ↗