HOTSPOT
You are interviewing for a job as a Java developer.
You are presented with the following code. Line numbers are included for reference only.
You need to evaluate what happens when the code runs.
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:
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:
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:
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:
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:
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:
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:
HOTSPOT
You write the following Java program for Munson's 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:
DRAG DROP
You are interviewing for a job at Adventure Works, Inc. The hiring manager asks you to create a single console program.
The program takes multiple arguments from the command line and writes them to the screen in the same order as they were typed on the command line.
Which three code segments should you use to develop the solution? To answer, move the appropriate code segments from the list of code segments to the answer area and arrange them in the correct order.
Select and Place:
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: