Oracle
1Z0-809 · Question #98
1Z0-809 Question #98: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #98. The question stem and answer options stay visible for context.
Question
Given:
ITEM ID, INTEGER: PK
DESCRIP, VARCHAR (100)
PRICE, REAL
QUANTITY < INTEGER
And given the code fragment:
9. try {
10. Connection conn = DriverManager.getConnection(dbURL, username,
password);
11. String query = "Select * FROM Item WHERE ID = 110";
12. Statement stmt = conn.createStatement();
13. ResultSet rs = stmt.executeQuery(query);
14. while(rs.next()) {
15. System.out.println("ID:" + rs.getInt("ID"));
16. System.out.println("Description:" + rs.getString("Descrip"));
17. System.out.println("Price:" + rs.getDouble("Price"));
18. System.out.println("Quantity:" + rs.getInt("Quantity"));
19. }
20. } catch (SQLException se) {
21. System.out.println("Error");
22. }
Assume that:
- The required database driver is configured in the classpath.
- The appropriate database is accessible with the dbURL, username, and password exists.
- The SQL query is valid. What is the result?
Options
- AAn exception is thrown at runtime.
- BCompilation fails.
- CThe code prints Error.
- DThe code prints information about item 110.
Unlock 1Z0-809 to see the answer
You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.