98-388 : Introduction to Programming Using Java : Part 02

  1. 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.
    • No change is needed.
    • a short
    • a byte
    • a long
  2. You need to evaluate the following code segment:

    98-388 Part02 Q02 048
    98-388 Part02 Q02 048

    What happens when the code segment is run?

    • iNum has a value of 0.
    • An exception is thrown.
    • iNum has a value of 2.
    • iNum has a value of 3.
  3. 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.

    98-388 Part02 Q03 049
    98-388 Part02 Q03 049
    98-388 Part02 Q03 050
    98-388 Part02 Q03 050

     

  4. You work as a Java programmer.

    You need to convert a numeric String to a primitive double value.

    What code segment should you use?

    • Double.valueOf(numberString);
    • double.parseDouble(numberString);
    • String.parseDouble(numberString);
    • Double.parseDouble(numberString);
  5. 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.

    98-388 Part02 Q05 051
    98-388 Part02 Q05 051
    98-388 Part02 Q05 052
    98-388 Part02 Q05 052

     

  6. 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.

    98-388 Part02 Q06 053
    98-388 Part02 Q06 053
    98-388 Part02 Q06 054
    98-388 Part02 Q06 054

     

  7. 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.

    98-388 Part02 Q07 055
    98-388 Part02 Q07 055
    98-388 Part02 Q07 056
    98-388 Part02 Q07 056
  8. 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.

    98-388 Part02 Q08 057
    98-388 Part02 Q08 057
    98-388 Part02 Q08 058
    98-388 Part02 Q08 058

     

  9. 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.

    98-388 Part02 Q09 059
    98-388 Part02 Q09 059
    98-388 Part02 Q09 060
    98-388 Part02 Q09 060

     

  10. 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.

    98-388 Part02 Q10 061
    98-388 Part02 Q10 061
    98-388 Part02 Q10 062
    98-388 Part02 Q10 062
  11. 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.

    98-388 Part02 Q11 063
    98-388 Part02 Q11 063
    98-388 Part02 Q11 064
    98-388 Part02 Q11 064

     

  12. HOTSPOT

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

    98-388 Part02 Q12 065
    98-388 Part02 Q12 065

    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.

    98-388 Part02 Q12 066
    98-388 Part02 Q12 066
    98-388 Part02 Q12 067
    98-388 Part02 Q12 067

     

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

    98-388 Part02 Q13 068
    98-388 Part02 Q13 068
    98-388 Part02 Q13 069
    98-388 Part02 Q13 069

     

  14. HOTSPOT

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

    98-388 Part02 Q14 070
    98-388 Part02 Q14 070

    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.

    98-388 Part02 Q14 071
    98-388 Part02 Q14 071
    98-388 Part02 Q14 072
    98-388 Part02 Q14 072

     

  15. HOTSPOT

    You work for Woodgrove Bank as a Java programmer.

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

    98-388 Part02 Q15 073
    98-388 Part02 Q15 073

    For each of the following statements, select Yes if the statement is true. Otherwise, select No.

    NOTE: Each correct selection is worth one point.

    98-388 Part02 Q15 074
    98-388 Part02 Q15 074
    98-388 Part02 Q15 075
    98-388 Part02 Q15 075

     

  16. HOTSPOT

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

    98-388 Part02 Q16 076
    98-388 Part02 Q16 076

    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.

    98-388 Part02 Q16 077
    98-388 Part02 Q16 077
    98-388 Part02 Q16 078
    98-388 Part02 Q16 078

     

  17. 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.

    98-388 Part02 Q17 079
    98-388 Part02 Q17 079
    98-388 Part02 Q17 080
    98-388 Part02 Q17 080

     

  18. 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.

    98-388 Part02 Q18 081
    98-388 Part02 Q18 081
    98-388 Part02 Q18 082
    98-388 Part02 Q18 082

     

  19. 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.

    98-388 Part02 Q19 083
    98-388 Part02 Q19 083
    98-388 Part02 Q19 084
    98-388 Part02 Q19 084

     

  20. The question requires that you evaluate the underlined text to determine if it is correct.

    You have the following class definition:

    98-388 Part02 Q20 085
    98-388 Part02 Q20 085

    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.

    • No change is needed
    • only by the Logger class
    • only by the Logger class and classes in the same package that inherit from it
    • by all classes in all packages
  21. HOTSPOT

    You write the following Java program for Munson’s Pickles and Preserves Farm. Line numbers are included for reference only.

    98-388 Part02 Q21 086
    98-388 Part02 Q21 086

    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.

    98-388 Part02 Q21 087
    98-388 Part02 Q21 087
    98-388 Part02 Q21 088
    98-388 Part02 Q21 088

     

  22. HOTSPOT

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

    98-388 Part02 Q22 089
    98-388 Part02 Q22 089

    For each of the following outputs, select Yes if the output is displayed. Otherwise, select No.

    NOTE: Each correct selection is worth one point.

    98-388 Part02 Q22 090
    98-388 Part02 Q22 090
    98-388 Part02 Q22 091
    98-388 Part02 Q22 091

 

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments