CIW
1D0-441 · Question #53
Consider the following code fragment: 1. PreparedStatement ps = conn.prepareStatement( 2. SELECT Order_Date, Customer_No + 3. FROM Orders WHERE + 4. Customer_No = ?); 5. 6. ps.setShort(1, 1009) 7…
The correct answer is A. 03-01-02 1009. See the full explanation below for the reasoning.
Question
Consider the following code fragment: 1. PreparedStatement ps = conn.prepareStatement( 2. SELECT Order_Date, Customer_No + 3. FROM Orders WHERE + 4. Customer_No = ?); 5. 6. ps.setShort(1, 1009) 7. 8. ResultSet rs = ps.executeQuery(); 9. while(rs.next()) 10. { 11. System.out.print(rs.getString(1) + ); 12. System.out.println(rs.getString(2)); 13. } 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?
Options
- A03-01-02 1009
- B2025 1009
- C2025 03-01-02
- DNo output is generated because a runtime error occurs at line 6.
How the community answered
(22 responses)- A82% (18)
- B5% (1)
- C9% (2)
- D5% (1)
Community Discussion
No community discussion yet for this question.