nerdexam
Oracle

1Z0-805 · Question #59

Consider the following database table: Inventory Table Item_ID, Integer: PK Item_name, Varchar (20) Price, Numeric (10, 2) Quan, Integer Consider the following method that updates the prices in the…

The correct answer is D. 1. HashMap<Integer, Float> newPrices. The first line should be HashMap<Integer, Float> newPrices, as in SQL numeric represent a float number, not an integeror string. We also make sure to use floatValue() both in appropriate places Note: Map is an object that maps keys to values. A map cannot contain duplicate…

Building Database Applications with JDBC

Question

Consider the following database table:

Inventory Table

  • Item_ID, Integer: PK
  • Item_name, Varchar (20)
  • Price, Numeric (10, 2)
  • Quan, Integer

Consider the following method that updates the prices in the Inventory table:

public static void updatePrices{ // #1: missing line Connection con) throws SQLException { // #2: missing line PreparedStatement updatePrices = con.prepareStatement (updatePricesString); // #3: missing line { // #4: missing line updatePrices.executeUpdate(); } } This method us missing four lines, which group of lines complete this method? Oracle 1Z0-805 Exam

Options

  • A
    1. HashMap<Integer, String> newPrices,
  • B
    1. HashMap<Integer, Float> newPrices,
  • CgetKey().intValue());
  • D
    1. HashMap<Integer, Float> newPrices,
  • E
    1. HashMap<Integer, Float> newPrices,
  • Fgetvalue().floatValue()
  • G
    1. HashMap<Integer, String> newPrices,
  • H
    1. HashMap<Integer> newPrices,

How the community answered

(40 responses)
  • A
    3% (1)
  • B
    5% (2)
  • D
    80% (32)
  • F
    3% (1)
  • G
    10% (4)

Explanation

The first line should be HashMap<Integer, Float> newPrices, as in SQL numeric represent a float number, not an integeror string. We also make sure to use floatValue() both in appropriate places Note: Map is an object that maps keys to values. A map cannot contain duplicate keys: Each key can map to at most one value. It models the mathematical function abstraction.

Topics

#PreparedStatement#JDBC#HashMap#parameterized queries

Community Discussion

No community discussion yet for this question.

Full 1Z0-805 Practice