exam questions

Exam 1z0-809 All Questions

View all questions & answers for the 1z0-809 exam

Exam 1z0-809 topic 1 question 25 discussion

Actual exam question from Oracle's 1z0-809
Question #: 29
Topic #: 2
[All 1z0-809 Questions]

Given:

Item table -
ID, INTEGER: PK
DESCRIP, VARCHAR(100)
PRICE, REAL
QUANTITY< INTEGER
And given the code fragment:
9. try {
10. Connection conn = DriveManager.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.
dbURL, userName, and passWord exists.
The appropriate database is accessible with the
The SQL query is valid.
What is the result?

  • A. An exception is thrown at runtime.
  • B. Compilation fails. Error.
  • C. The code prints
  • D. The code prints information about Item 110.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
thetech
Highly Voted 4 years, 8 months ago
Answer is D. Tested
upvoted 14 times
...
steefaand
Most Recent 5 months, 3 weeks ago
Selected Answer: D
D is true assuming there is record in database.
upvoted 1 times
...
iSnover
5 months, 3 weeks ago
Selected Answer: D
Answer is D. Tested.
upvoted 1 times
...
Uchiha
2 years, 4 months ago
Answer is D
upvoted 1 times
...
johnchen88
4 years, 6 months ago
The correct answer should be C: since it does not say the id 110 is existing in the database, the sql is valid that does not mean it is existing
upvoted 2 times
iSnover
5 months, 3 weeks ago
Sorry, the last line of the question says that the query is valid. The answer is D.
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago