Free 98-388: Introduction to Programming Using Java Exam Questions and Answers
Introduction to Programming Using Java is exam 98-388, part of Microsoft Certifications. Microsoft exam codes name the solution area rather than the level — AZ for Azure, DP for data, MS for Microsoft 365, PL for Power Platform, SC for security, AI for Azure AI — with one reliable rule: any exam numbered 900 or 901 is Fundamentals. Every technical exam is scored from 1 to 1000 with 700 to pass, a scaled score Microsoft notes is explicitly not 70% of the marks.
Looking for 98-388 exam dumps or ExamTopics 98-388 questions? These 98-388 practice questions cover the same ground with verified answers and explanations, a downloadable 98-388 PDF and a full 98-388 practice test, kept current as Microsoft updates the exam.
Last updated: October 22, 2026
- Exam code
- 98-388
- Provider
- Microsoft
- Questions in our bank
- 1000+
- Free to read
- First 10, with answers
- Official page
- Official Exam website
- Our test mode duration & pass mark
- 130 mins · 70%
Recommended: Switch to Test Mode to start a practice test that simulates the real exam experience.
Question #1
You are debugging the following Java program saved in a file named Test.java. 1 public class Test { 2 public static void main(String[] args) { 3 int[] data = new int[3]; 4 data[3] = 10; 5 } 6 } The program compiles without errors. Complete the statements by selecting the correct option from each list. Statement 1: When the program runs, the console displays an exception of type . Statement 2: The stack trace reports that the exception occurred in Test.java at line . Statement 3: This kind of error is a .
Fill each box, then reveal.
Correct answer: Box 1: ArrayIndexOutOfBoundsException; Box 2: 4; Box 3: runtime error
Explanation
An array declared with size 3 has valid indexes 0 to 2, so assigning to index 3 throws ArrayIndexOutOfBoundsException when line 4 executes. The stack trace names the line where the exception was thrown, not where the array was declared. Because javac accepts the code and the failure happens only during execution, it is a runtime error rather than a syntax or logic error.
Continue with 98-388: Introduction to Programming Using Java
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in 98-388: Introduction to Programming Using Java, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #2
You are writing a Java program that must display the even numbers 2, 4, 6, 8 and 10, each on its own line. int n = 2; while (n 10) { System.out.println(n); n 2; } Complete the code by selecting the correct option from each list.
Fill each box, then reveal.
Correct answer: Box 1: <=; Box 2: +=
Explanation
The condition n <= 10 keeps the loop running while n equals 10, so 10 is displayed. With < or != the loop ends before 10 is printed. The statement n += 2 adds 2 on each pass, while n *= 2 would produce powers of two and n =+ 2 simply assigns the value +2 every time, creating an infinite loop.
Continue with 98-388: Introduction to Programming Using Java
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in 98-388: Introduction to Programming Using Java, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #3
You are writing a Java application named Report. The program is started from the command line with the following command: java Report east 12 west The main method contains this statement: System.out.println(args.length + args[0]); What is the output?
Correct answer: B
Explanation
The args array receives only the three arguments that follow the class name: east, 12 and west. The class name Report is not included, so args.length is 3 and args[0] is "east". Adding an int to a String produces concatenation in left-to-right order, giving 3east.
Continue with 98-388: Introduction to Programming Using Java
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in 98-388: Introduction to Programming Using Java, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #4
For each of the following statements, select Yes if the statement is true. Otherwise, select No. 1. A missing semicolon at the end of a statement is reported as an error by javac before the program runs. 2. A program that compiles successfully but displays an incorrect total contains a syntax error. 3. A stack trace lists the method calls that were active at the time an exception occurred.
Answer each statement, then reveal.
- A missing semicolon at the end of a statement is reported as an error by javac before the program runs.Not answered
- A program that compiles successfully but displays an incorrect total contains a syntax error.Not answered
- A stack trace lists the method calls that were active at the time an exception occurred.Not answered
Correct answer: Yes · No · Yes
Explanation
Syntax errors such as a missing semicolon are caught by javac at compile time. A program that compiles but gives wrong results has a logic error, not a syntax error. A stack trace shows the chain of active method calls, which helps locate where the exception occurred.
Continue with 98-388: Introduction to Programming Using Java
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in 98-388: Introduction to Programming Using Java, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #5
You are writing a Java program that contains the following code segment. try { int[] a = new int[2]; a[2] = 5; System.out.print("A"); } catch (ArithmeticException e) { System.out.print("B"); } catch (RuntimeException e) { System.out.print("C"); } finally { System.out.print("D"); } System.out.print("E"); What is the output?
Correct answer: C
Explanation
Index 2 is out of range for a two-element array, so an ArrayIndexOutOfBoundsException is thrown before A is printed. That exception is not an ArithmeticException, but it is a RuntimeException, so the second catch block prints C. The finally block then prints D, and because the exception was handled, execution continues and prints E.
Continue with 98-388: Introduction to Programming Using Java
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in 98-388: Introduction to Programming Using Java, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #6
You are reviewing the following Java code segment. int x = 15; if (x > 10) if (x > 20) System.out.print("Large"); else System.out.print("Small"); System.out.print("Done"); What is the output?
Correct answer: C
Explanation
Indentation does not affect Java. An else belongs to the nearest preceding if that has no else, so it pairs with if (x > 20). Since x > 10 is true and x > 20 is false, the else branch prints Small, and the final statement always runs and prints Done.
Continue with 98-388: Introduction to Programming Using Java
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in 98-388: Introduction to Programming Using Java, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #7
You have the following Java declaration: String s = "Java Exam"; Match each expression to the value it returns. Each result may be used once, and one result will not be used. Expressions (targets): 1. s.length() 2. s.charAt(5) 3. s.substring(5) 4. s.indexOf("a") Results (items): - 1 - 9 - E - Exam - JAVA EXAM
Drag or tap each item onto its target, then reveal.
- s.length()Drop here
- s.charAt(5)Drop here
- s.substring(5)Drop here
- s.indexOf("a")Drop here
Correct answer: s.length() = 9; s.charAt(5) = E; s.substring(5) = Exam; s.indexOf("a") = 1
Explanation
The string has nine characters, including the space, so length() returns 9. Indexes start at 0, so index 5 is E and substring(5) returns everything from that index, Exam. indexOf("a") returns the first match, at index 1, and JAVA EXAM would come from toUpperCase().
Continue with 98-388: Introduction to Programming Using Java
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in 98-388: Introduction to Programming Using Java, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #8
You are writing a Java program that reads from the keyboard. import java.util.Scanner; public class Echo { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); String w = in.next(); System.out.println(w + (a + b)); } } The user types the following input and presses Enter: 12 5 hello What is the output?
Correct answer: C
Explanation
nextInt reads 12 and then 5, and next reads the token hello, because Scanner splits input on whitespace. The parentheses force a + b to be evaluated as integer addition first, giving 17, which is then appended to w. Without the parentheses the result would be hello125.
Continue with 98-388: Introduction to Programming Using Java
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in 98-388: Introduction to Programming Using Java, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #9
You are writing a Java program that prints a greeting using the first command-line argument. The program must start when it is run with the java command. Complete the code by moving the correct code fragment to each target. A fragment may be used once, more than once, or not at all. Code fragments: static void int String[] String 0 1 args.length Code: public class Greeter { public [Target 1] [Target 2] main([Target 3] args) { System.out.println("Hello, " + args[[Target 4]]); } }
Drag or tap each item onto its target, then reveal.
- Target 1Drop here
- Target 2Drop here
- Target 3Drop here
- Target 4Drop here
Correct answer: Target 1 = static; Target 2 = void; Target 3 = String[]; Target 4 = 0
Explanation
The JVM calls main without creating an object, so it must be static, return void, and accept a String array of command-line arguments. The first argument is at index 0, because array indexes start at zero. Index 1 would read the second argument, and args.length is one past the last element, which throws an exception.
Continue with 98-388: Introduction to Programming Using Java
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in 98-388: Introduction to Programming Using Java, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #10
You are reviewing the following Java code segment. int count = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (j == i) continue; if (j > 2) break; count++; } } System.out.println(count); What is the output?
Correct answer: C
Explanation
For i = 0 the inner loop counts j = 1 and 2 (2), for i = 1 it counts j = 0 and 2 (2), for i = 2 it counts j = 0 and 1 (2), and in each of those passes break stops the loop at j = 3. For i = 3 the loop counts j = 0, 1 and 2 (3), and j = 3 is skipped by continue, so the loop ends normally. The total is 2 + 2 + 2 + 3 = 9.
Continue with 98-388: Introduction to Programming Using Java
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in 98-388: Introduction to Programming Using Java, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Discussion
Explain your reasoning, not just the letterOther Microsoft certifications
- AZ-500: Microsoft Azure Security Technologies (opens in a new tab)
- MS-101: Microsoft 365 Mobility and Security (opens in a new tab)
- MS-102: Microsoft 365 Administrator (beta) (opens in a new tab)
- MS-100: Microsoft 365 Identity and Services (opens in a new tab)
- PL-900: Microsoft Power Platform Fundamentals (opens in a new tab)
- AZ-305: Designing Microsoft Azure Infrastructure Solutions (opens in a new tab)
- MS-900: Microsoft 365 Fundamentals (opens in a new tab)
- AZ-400: Microsoft Azure DevOps Solutions (opens in a new tab)
- AZ-900: Microsoft Azure Fundamentals (opens in a new tab)
- 70-740: Installation, Storage, and Compute with Windows Server 2016 (opens in a new tab)
- MD-102: Endpoint Administrator (beta) (opens in a new tab)
- PL-300: Microsoft Power BI Data Analyst (opens in a new tab)
Reviews
Write a review★★★★★
Exam Practice is worth every penny. The mock exams are realistic, and the feedback helped me focus on key areas.
Amit SharmaVerified buyer
★★★★★
I highly recommend Exam Practice. The feedback after each test helped me improve significantly, and I passed my exams easily.
Oscar NyströmVerified buyer
★★★★★
This platform is a lifesaver. The practice questions and explanations are so detailed. It’s the best study tool I’ve ever used.
Hannah SmithVerified buyer
FAQ
Learn More: https://learn.microsoft.com/en-us/credentials/
- Q1: What is the 98-388: Introduction to Programming Using Java exam?
- A: 98-388: Introduction to Programming Using Java is a Microsoft certification exam. Judging by the questions in our bank, it concentrates on java and object.
- Q2: How should I prepare for 98-388: Introduction to Programming Using Java?
- A: Work through the 98-388: Introduction to Programming Using Java practice questions here, checking your answer on each one, then sit the practice test to rehearse the exam under timed conditions before the real thing.
- Q3: Are these real 98-388: Introduction to Programming Using Java exam questions?
- A: They are drawn from officially released past questions and from community members who have sat 98-388: Introduction to Programming Using Java. Answers are verified and updated weekly.
- Q4: Where do I register for the 98-388: Introduction to Programming Using Java exam?
- A: Register through Microsoft directly at https://learn.microsoft.com/en-us/credentials/. Exampractice is not affiliated with Microsoft and does not administer the exam.
- Q5: Is there a free 98-388: Introduction to Programming Using Java sample?
- A: Yes. Every 98-388: Introduction to Programming Using Java page shows a free sample of real questions. Upgrading opens the full bank and the practice test.
- Q6: What are Microsoft Certification Exams?
- A: Microsoft Certification Exams validate your expertise in using and managing Microsoft’s technologies and solutions, including Azure, Office 365, Windows, and more. These certifications demonstrate your proficiency in deploying, configuring, and optimizing Microsoft products to support business operations and IT infrastructure.
- Q7: Why should I pursue Microsoft Certification?
- A: Microsoft Certification enhances your professional credibility, showcasing your skills and knowledge in Microsoft technologies. This can lead to better job opportunities, higher salaries, and career advancement in IT, cloud computing, software development, and related fields.
- Q8: What are the benefits of Microsoft Certification?
- A: Benefits include recognition as a certified Microsoft professional, improved job performance, access to exclusive resources, continuing education opportunities, and staying current with the latest Microsoft technologies and best practices.
- Q9: Who should take Microsoft Certification Exams?
- A: IT professionals, system administrators, developers, cloud engineers, data analysts, and anyone involved in managing and implementing Microsoft solutions should consider these certifications to validate their expertise and advance their careers.
- Q10: What types of Microsoft Certification Exams are available?
- A: Microsoft offers various certification paths, including:
- Q11: How do I prepare for Microsoft Certification Exams?
- A: Preparation can include official Microsoft training courses, study guides, practice exams, online tutorials, and hands-on experience with Microsoft products and solutions.
- Q12: Where can I take Microsoft Certification Exams?
- A: Microsoft Certification Exams can be taken online with remote proctoring or at authorized Pearson VUE testing centers worldwide, providing flexibility to fit your schedule and location.
- Q13: How do Microsoft Certifications impact my career?
- A: Microsoft Certifications significantly boost your career by demonstrating your expertise to employers, making you a more competitive candidate for advanced roles and promotions in IT, cloud computing, software development, and other tech-related fields.
- Q14: Are there any prerequisites for Microsoft Certification Exams?
- A: Some exams may have prerequisites, such as foundational knowledge or prior experience with Microsoft products. Check the specific requirements for each certification path on the Microsoft Learn website.
- Q15: How often do I need to recertify for Microsoft Certifications?
- A: Microsoft Certifications typically require renewal every year or two, depending on the certification, to ensure that certified professionals stay updated with the latest technologies and industry practices.



