microsoft 98-388 practice test

Exam Title: Introduction to Programming Using Java

Last update: Dec 09 ,2025
Question 1 Topic 2, Topic 2, Work with data types, variables, and expressions

DRAG DROP
You have the following code:

You need to create an int array named numbers initialized with num1, num2, and num3.
How should you complete the code? To answer, drag the appropriate code segment to the correct position. Each code
segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to
view content.
NOTE: Each correct selection is worth one point.
Select and Place:

Answer:


Explanation:
Example:
int[] numbers = new int[] {num1, num2, num3}
References: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
https://alvinalexander.com/blog/post/java/java-faq-create-array-int-example-syntax

Comments
Question 2 Topic 2, Topic 2, Work with data types, variables, and expressions

HOTSPOT
You are creating a method that processes invoices. The invoices are contained in an ArrayList instance. After each invoice is
processed, the method must remove the invoice from the ArrayList instance.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:


Explanation:
References: https://beginnersbook.com/2013/12/java-arraylist/

Comments
Question 3 Topic 2, Topic 2, Work with data types, variables, and expressions

HOTSPOT
You are writing a Java method.
The method accepts a two-dimensional String array and prints the content of each array element.
The size of each dimension of the array might be different.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:


Explanation:
References: https://www.tutorialgateway.org/two-dimensional-array-in-java/

Comments
Question 4 Topic 2, Topic 2, Work with data types, variables, and expressions

HOTSPOT
You are developing a Java program to play Tic-Tac-Toe. You define the following array to store the state of the board:

Use the drop-down menus to select the answer choice that answers each question based on the information presented in
the code.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:


Comments
Question 5 Topic 2, Topic 2, Work with data types, variables, and expressions

HOTSPOT
You are writing a Java program.
The program must meet the following requirements:
Truncate firstName to its first five characters

Set output to a string that contains the firstName and the number of characters in firstName

How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:


Explanation:
References: https://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html
https://www.tutorialspoint.com/java/lang/stringbuilder_substring_end.htm

Comments
Question 6 Topic 2, Topic 2, Work with data types, variables, and expressions

DRAG DROP
You are writing a Java program that collects patient information and stores it in a database.
You need to ensure that the program stores data using the least amount of memory.
Which data type should you use to complete each variable declaration? To answer, drag the appropriate data type from the
column on the left to its code segment on the right. Each data may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.
Select and Place:

Answer:


Explanation:
References: http://www.tutorialspoint.com/java/java_basic_datatypes.htm

Comments
Question 7 Topic 2, Topic 2, Work with data types, variables, and expressions

DRAG DROP
You are writing a Java method that evaluates an arithmetic formula.
The method accepts an int value named number, raises the value to the second power, and returns the negative value of the
result.
How should you complete the code? To answer, drag the appropriate code segment to the correct position. Each code
segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to
view content.
NOTE: Each correct selection is worth one point.
Select and Place:

Answer:


Comments
Question 8 Topic 2, Topic 2, Work with data types, variables, and expressions

HOTSPOT
You are creating a method that converts a string representation of a number into an actual number.
The numbers passed into the method include whole numbers and fractional numbers.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:


Explanation:
References:
https://docs.oracle.com/javase/tutorial/java/data/converting.html

Comments
Question 9 Topic 2, Topic 2, Work with data types, variables, and expressions

DRAG DROP
You attend an interview for a job as a Java programmer.
You need to declare a two by three array of the double type with initial values.
How should you complete the code? To answer, drag the appropriate code segment to the correct location. Each code
segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to
view content.
NOTE: Each correct selection is worth one point.
Select and Place:

Answer:


Explanation:
References: https://www.dummies.com/programming/java/java-use-arrays-with-two-dimensions-or-more/

Comments
Question 10 Topic 2, Topic 2, Work with data types, variables, and expressions

HOTSPOT
You are interviewing for a job as a Java developer. You need to evaluate the following code. Line numbers are included for
reference only.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:


Explanation:
References: https://www.tutorialspoint.com/java/java_strings.htm

Comments
Page 1 out of 4
Viewing questions 1-10 out of 42
Go To
page 2