nerdexam
CIW

1D0-441 · Question #129

Consider the following code fragment: 1. PreparedStatement ps = conn.prepareStatement( 2. SELECT * FROM Orders WHERE + 3. Customer_No = ?); 4. 5. ps.setShort(1, 1001) 6. 7. ResultSet rs =…

The correct answer is C. No output is generated because a compile-time error occurs at line 7. See the full explanation below for the reasoning.

Question

Consider the following code fragment: 1. PreparedStatement ps = conn.prepareStatement( 2. SELECT * FROM Orders WHERE + 3. Customer_No = ?); 4. 5. ps.setShort(1, 1001) 6. 7. ResultSet rs = ps.executeUpdate(); 8. while(rs.next()) 9. { 10. System.out.print(rs.getString(1) + ); 11. System.out.println(rs.getString(2)); 12. } Assume that variable conn references a valid and open Connection object to a database containing the Orders Relation (shown in the exhibit). Which output is generated?

Exhibit

1D0-441 question #129 exhibit

Options

  • A2001 11-04-01
  • B2001 11-04-01
  • CNo output is generated because a compile-time error occurs at line 7.
  • DNo output is generated because a runtime error occurs at line 5.

How the community answered

(31 responses)
  • A
    3% (1)
  • B
    6% (2)
  • C
    77% (24)
  • D
    13% (4)

Community Discussion

No community discussion yet for this question.

Full 1D0-441 Practice