microsoft 98-388 practice test

Introduction to Programming Using Java

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

Question 1 Topic 5, Topic 5, Compile and debug code

HOTSPOT
You need to evaluate the output of the following code segment. Line numbers are included for reference only.

For each of the following outputs, select Yes if the output is displayed. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:


Explanation:
References: https://www.w3schools.com/java/java_try_catch.asp

Discussions
0 / 1000

Question 2 Topic 5, Topic 5, Compile and debug code

HOTSPOT
You write the following Java program for Munsons Pickles and Preserves Farm. Line numbers are included for reference
only.

You encounter error messages when you attempt to compile the program.
You need to ensure the program compiles successfully.
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 3 Topic 5, Topic 5, Compile and debug code

The question requires that you evaluate the underlined text to determine if it is correct.
You have the following class definition:

The logError method can be invoked by code in all classes in the same package as the Logger class.
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. only by the Logger class
  • C. only by the Logger class and classes in the same package that inherit from it
  • D. by all classes in all packages
Answer:

C

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

Question 4 Topic 4, Topic 4, Perform object-oriented programming

HOTSPOT
You are writing a Java class named SavingsAccount.
The class must meet the following requirements:
Inherit from an existing class named Account

Include a constructor that uses the base class constructor to initialize the starting balance Include a substitute toString()


method
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.tutorialspoint.com/java/java_inheritance.htm
Topic 5, Topic 5, Compile and debug code

Discussions
0 / 1000

Question 5 Topic 4, Topic 4, Perform object-oriented programming

HOTSPOT
You work on a team that develops e-commerce applications. A member of the team creates a class named DB that connects
to a database. The class contains a method named query.
You need to initiate the DB class and invoke the query method.
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/8/docs/api/java/lang/reflect/Method.html#invoke-java.lang.Objectjava.lang.Object...-

Discussions
0 / 1000

Question 6 Topic 4, Topic 4, Perform object-oriented programming

DRAG DROP
You have a Java class named InsurancePolicy.
You need to define a constant data member named RATE. The data member must be accessible by any class without
instantiating the InsurancePolicy class.
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: https://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html

Discussions
0 / 1000

Question 7 Topic 4, Topic 4, Perform object-oriented programming

HOTSPOT
You have the following code segment. Line numbers are included for reference only.

The code does not compile.
For each of the following statements, select Yes if the action is required to resolve the compilation error. Otherwise, select
No.
NOTE: Each correct selection is worth one point.
Hot Area:

Answer:


Explanation:
References:
https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html

Discussions
0 / 1000

Question 8 Topic 4, Topic 4, Perform object-oriented programming

HOTSPOT
You work for Woodgrove Bank as a Java programmer.
You need to evaluate the following class. 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://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html

Discussions
0 / 1000

Question 9 Topic 3, Topic 3, Implement flow control

HOTSPOT
You need to evaluate the following code. Line numbers are included for reference only.

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:


Explanation:
Topic 4, Topic 4, Perform object-oriented programming

Discussions
0 / 1000

Question 10 Topic 3, Topic 3, Implement flow control

HOTSPOT
You are writing a Java console program.
The program must meet the following requirements:
Read a line of text entered by the user

Print each word in the text to the console on a separate line

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/util/Scanner.html

Discussions
0 / 1000

Question 11 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 12 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 13 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 14 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 15 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
To page 2