Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam 1z0-809 topic 1 question 56 discussion

Actual exam question from Oracle's 1z0-809
Question #: 56
Topic #: 1
[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.
The appropriate database is accessible with the dbURL, userName, and passWord exists.
The SQL query is valid.
What is the result?

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

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Svetleto13
Highly Voted 2 years, 11 months ago
D is correct answer
upvoted 6 times
...
asdfjhfgjuaDCV
Most Recent 1 month, 2 weeks ago
D is the Correct answer
upvoted 1 times
...
steefaand
2 months, 1 week ago
Selected Answer: D
Assuming that DriveManager is typo and is instead DriverManager, correct answer is D.
upvoted 1 times
...
lchowen
1 year, 7 months ago
D is correct. According to the official Java Doc, Column names used as input to getter methods are case insensitive. Reference : https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSet.html
upvoted 2 times
...
WilsonKKerll
2 years, 1 month ago
Answer is D.
upvoted 1 times
...
iamajavacompiler
3 years ago
Is D correct?
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 ...