nerdexam
Oracle

1Z0-804 · Question #66

ITEM Table ID, INTEGER: PK DESCRIP, VARCHAR(100) PRICE, REAL QUALITY, INTEGER And given the code fragment (assuming that the SQL query is valid): What is the result of compiling and executing this…

The correct answer is C. The code prints Error. Compiles successfully ! Not B ! D is correct, if Column Quantity instead of Quality Table Item Column Quality --- System.out.println("Quantity: " + rs.getInt("Quantity")); wenn jedoch so gewollt: die Zeile gibt Error aus (die anderen funktionieren) !!! The connection conn is…

Building Database Applications with JDBC

Question

ITEM Table

  • ID, INTEGER: PK
  • DESCRIP, VARCHAR(100)
  • PRICE, REAL
  • QUALITY, INTEGER

And given the code fragment (assuming that the SQL query is valid):

What is the result of compiling and executing this code?

Exhibit

1Z0-804 question #66 exhibit

Options

  • AAn exception is thrown at runtime
  • BCompile fails
  • CThe code prints Error
  • DThe code prints information about Item 110

How the community answered

(41 responses)
  • A
    5% (2)
  • B
    2% (1)
  • C
    80% (33)
  • D
    12% (5)

Explanation

Compiles successfully ! Not B ! D is correct, if Column Quantity instead of Quality Table Item Column Quality --- System.out.println("Quantity: " + rs.getInt("Quantity")); wenn jedoch so gewollt: die Zeile gibt Error aus (die anderen funktionieren) !!! The connection conn is not defined. The code will not compile.

Topics

#ResultSet#JDBC#SQLException#column access

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice