CIW
1D0-441 · Question #26
Consider the following code fragment: 1. Statement s = conn.createStatement(); 2. 3. s.executeUpdate(CREATE TABLE MyTable ( + 4. ColumnA CHAR(5), + 5. ColumnB CHAR(5))); 6. 7. s.executeUpdate(INSERT…
The correct answer is B. AAAAA. See the full explanation below for the reasoning.
Question
Consider the following code fragment: 1. Statement s = conn.createStatement(); 2. 3. s.executeUpdate(CREATE TABLE MyTable ( + 4. ColumnA CHAR(5), + 5. ColumnB CHAR(5))); 6. 7. s.executeUpdate(INSERT INTO MyTable VALUES ( + 8. '00001', 'AAAAA'); 9. s.executeUpdate(INSERT INTO MyTable VALUES ( + 10. '00002', 'AAAAA'); 11. 12. ResultSet rs = s.executeQuery(SELECT * FROM MyTable + 13. WHERE ColumnB = 'AAAAA'); 14. while(rs.next()) 15. System.out.println(rs.getString(2)); Assume that variable conn references a valid and open Connection object, and that the database does not already contain a table named MyTable. Which output is generated?
Options
- A00001
- BAAAAA
- C1
- DA SQLException is thrown at line 15 and no output is generated.
How the community answered
(34 responses)- A9% (3)
- B74% (25)
- C15% (5)
- D3% (1)
Community Discussion
No community discussion yet for this question.