CIW
1D0-441 · Question #113
Consider the code fragment shown in the exhibit. 1. PreparedStatement ps = conn.prepareStatement 2. (INSERT INTO Orders VALUES (?, ?, ?, ?, ?)); 3. 4. ps.setInt(1, 3000); 5. ps.setString(2…
The correct answer is B. 3002. See the full explanation below for the reasoning.
Question
Consider the code fragment shown in the exhibit. 1. PreparedStatement ps = conn.prepareStatement 2. (INSERT INTO Orders VALUES (?, ?, ?, ?, ?)); 3. 4. ps.setInt(1, 3000); 5. ps.setString(2, 01-01-05); 6. ps.setInt(3, 1010); 7. ps.setInt(4, 200); 8. ps.setDouble(5, 1050.00); 9. 10. ps.setInt(1, 3001); 11. ps.setInt(3, 2010); 12. 13. ps.setInt(1, 3002); 14. ps.setInt(3, 3010); 15. ps.executeUpdate(); 16. 17. Statement s = conn.createStatement(); 18. ResultSet rs = s.executeQuery(SELECT * FROM Orders + 19. WHERE Sales_Rep_no = 200); 20. while(rs.next()) 21. { 22. System.out.print(rs.getString(Order_No) + ); 23. } 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
- A3000
- B3002
- C3000 3001 3002
- DNo output is generated because a runtime error occurs at line 10.
How the community answered
(37 responses)- A8% (3)
- B76% (28)
- C3% (1)
- D14% (5)
Community Discussion
No community discussion yet for this question.
