microsoft 98-388 practice test

Introduction to Programming Using Java

Last exam update: Jul 18 ,2024
Page 1 out of 3. Viewing questions 1-15 out of 42

Question 1 Topic 3, Topic 3, Implement flow control

HOTSPOT
You work as a Java programmer. A member of the team creates the following program. Line numbers are included for
reference only.

The program is supposed to display a message to the console while it counts down from 60. The method does not work as
intended.
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/nutsandbolts/operators.html

Discussions
0 / 1000

Question 2 Topic 3, Topic 3, Implement flow control

HOTSPOT
You are writing a Java method named countdown.
The method must meet the following requirements:
Accept an int parameter named start

Display all numbers from start to zero in decrements of one

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/javaOO/arguments.html

Discussions
0 / 1000

Question 3 Topic 3, Topic 3, Implement flow control

DRAG DROP
Traders hires you to write a Java program to manage account openings.
To open a new account, a user must meet one the following requirements:
be over 65 years old and have a minimum annual income of 10,000 be at least 21 and have an annual income greater


than 25,000
How should you complete the code? To answer, drag the appropriate operator to the correct position. Each operator 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.tutorialspoint.com/java/java_basic_operators.htm

Discussions
0 / 1000

Question 4 Topic 3, Topic 3, Implement flow control

HOTSPOT
You are writing a Java method.
The method must meet the following requirements:
Accept a String array named entries

Iterate through entries

Stop the iteration and return false if any element has more than 10 characters Otherwise, return true


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:

Discussions
0 / 1000

Question 5 Topic 3, Topic 3, Implement flow control

HOTSPOT
You are interviewing for a job as a Java developer. You need to demonstrate your understanding of switch statements.
For each of the following code segments, select Yes if the code segment can be changed to a switch statement with up to
three case statements. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:

Explanation:
References: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html

Discussions
0 / 1000

Question 6 Topic 3, Topic 3, Implement flow control

HOTSPOT
You work as an intern Java programmer at Adventure Works. Your team lead asks you to create a method.
The method must meet the following requirements:
Accept an int array

Check for duplicate values in the array

Stop the outer loop as soon as a duplicate value has been detected and return true Return false if all values in the array


are unique
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://stackoverflow.com/questions/3951547/java-array-finding-duplicates

Discussions
0 / 1000

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

HOTSPOT
You are writing a Java console program. The program accepts command line arguments.
You need to ensure that the main method parses and handles each command line argument.
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:
Topic 3, Topic 3, Implement flow control

Discussions
0 / 1000

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

DRAG DROP
Your instructor asks you to evaluate four arithmetic code segments.
What is the value of each code segment? To answer, drag the appropriate value 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:

Discussions
0 / 1000

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

You work as a Java programmer.
You need to convert a numeric String to a primitive double value.
What code segment should you use?

  • A. Double.valueOf(numberString);
  • C. String.parseDouble(numberString);
  • D. Double.parseDouble(numberString);
Answer:

B

User Votes:
A
50%
C
50%
D
50%

Explanation:
References: https://www.javacodeexamples.com/convert-string-to-primitive-example/140

Discussions
vote your answer:
A
C
D
0 / 1000

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

DRAG DROP
You are writing a Java method.
The program must meet the following requirements:
Accept a String parameter firstName

Display a welcome message that contains firstName

Ensure that the first letter of the name is capitalized, and the remaining letters are in lowercase

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:
References: http://www.tutorialspoint.com/java/java_strings.htm

Discussions
0 / 1000

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

You need to evaluate the following code segment:

What happens when the code segment is run?

  • A. iNum has a value of 0.
  • B. An exception is thrown.
  • C. iNum has a value of 2.
  • D. iNum has a value of 3.
Answer:

C

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

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

The question requires that you evaluate the underlined text to determine if it is correct.
You should use an int data type to store the numeric value 3,000,000,000 (3 billion) so that the least amount of memory is
used.
Review the underlined text. If it makes the statement correct, select No change is needed. If the statement is incorrect,
select the answer choice that makes the statement correct.

  • A. No change is needed.
  • B. a short
  • C. a byte
  • D. a long
Answer:

D

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 13 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

Discussions
0 / 1000

Question 14 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/

Discussions
0 / 1000

Question 15 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

Discussions
0 / 1000
To page 2