CIW
1D0-441 · Question #96
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
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
(24 responses)- A4% (1)
- B4% (1)
- C79% (19)
- D13% (3)
Community Discussion
No community discussion yet for this question.
