13/11/2024, 15:28 Programming in Java - - Unit 14 - Week 11 :
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
[email protected]
NPTEL (https://swayam.gov.in/explorer?ncCode=NPTEL) » Programming in Java (course)
Course Week 11: Assignment 11
outline The due date for submitting this assignment has passed.
Due on 2024-10-09, 23:59 IST.
About
NPTEL ()
Assignment submitted on 2024-10-02, 17:36 IST
How does an 1) How do you establish a connection to a database using JDBC? 1 point
NPTEL
online a. By creating an instance of the Connection interface
course b. By using the DriverManager.getConnection() method
work? ()
c. By implementing the Connection interface
Week 0 : () d. By extending the Connection class
Yes, the answer is correct.
Week 1 : () Score: 1
Accepted Answers:
b. By using the DriverManager.getConnection() method
Week 2 : ()
Week 3 : () 2) Which method executes a simple query and returns a single Result Set object? 1 point
a. executeQuery()
Week 4 : ()
b. executeUpdate()
Week 5 : () c. execute()
d. run()
Week 6 : ()
Yes, the answer is correct.
Score: 1
Week 7 : () Accepted Answers:
a. executeQuery()
Week 8 : ()
3) What is the correct order to close database resources? 1 point
Week 9 : ()
a. Connection then Statement then ResultSet
b. ResultSet then Statement then Connection
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=98&assessment=444 1/4
13/11/2024, 15:28 Programming in Java - - Unit 14 - Week 11 :
Week 10 : () c. Statement then Connection then ResultSet
d. Statement then ResultSet then Connection
Week 11 : () Yes, the answer is correct.
Score: 1
Lecture 51 : Accepted Answers:
JDBC—II b. ResultSet then Statement then Connection
(unit?
unit=98&lesso 4) Which of the following ensures that the correct driver is used to access each data 1 point
n=99) source.
Lecture 52 :
a. java.sql.Connection
JDBC—III
(unit? b. java.sql.DriverManager
unit=98&lesso c. java.sql.Statement
n=100)
d. java.sql.Driver
Lecture 53 : Yes, the answer is correct.
Demonstration Score: 1
—XX (unit? Accepted Answers:
unit=98&lesso b. java.sql.DriverManager
n=101)
Lecture 54 : 5) What is the purpose of the ResultSet interface in JDBC? 1 point
Demonstration
—XXI (unit? a. To store the result of a query
unit=98&lesso b. To execute SQL queries
n=102)
c. To manage database connections
Lecture 55 : d. To update data in the database
Demonstration
—XXII (unit? Yes, the answer is correct.
Score: 1
unit=98&lesso
Accepted Answers:
n=103)
a. To store the result of a query
Feedback
Form (unit? 6) The following is a statement in Java using JDBC. 1 point
unit=98&lesso
n=104)
Week 11 :
Programming
Assignment 1
(/noc24_cs105 Which of the following statement is FALSE?
/progassignme
nt?name=424) a. 3306 is the default MySQL port.
b. Database name is ‘nptel’
Week 11 :
Programming c. The database server is hosted on IP 127.0.0.1
Assignment 2 d. Password for ‘java’ user is ‘joy’
(/noc24_cs105
/progassignme Yes, the answer is correct.
Score: 1
nt?name=425)
Accepted Answers:
Week 11 : d. Password for ‘java’ user is ‘joy’
Programming
Assignment 3 7) Which resources have their close() method called when this code runs? 1 point
(/noc24_cs105
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=98&assessment=444 2/4
13/11/2024, 15:28 Programming in Java - - Unit 14 - Week 11 :
/progassignme
nt?name=426)
Week 11 :
Programming
Assignment 4
(/noc24_cs105
/progassignme
a. No close() methods are called
nt?name=427) b. Only Statement
Week 11 : c. Only Statement and Connection
Programming d. Only Statement and ResultSet
Assignment 5
Yes, the answer is correct.
(/noc24_cs105
Score: 1
/progassignme
Accepted Answers:
nt?name=428)
d. Only Statement and ResultSet
Quiz: Week
8) Which of the following is used to call stored procedure? 1 point
11:
Assignment
a. Statement
11
(assessment? b. PreparedStatement
name=444) c. CallableStatment
Week 11 : d. CalledStatement
Assignment
Yes, the answer is correct.
Solution (unit? Score: 1
unit=98&lesso Accepted Answers:
n=448) c. CallableStatment
Week 12 : ()
9) The executeUpdate method can be used with 1 point
Books () a. Statements(Select and Update both)
b. Select statement.
Text
Transcripts () c. Update/delete/insert operations in the database.
d. Only insert operation.
Yes, the answer is correct.
Score: 1
Accepted Answers:
c. Update/delete/insert operations in the database.
10) What does setAutoCommit(false) do? 1 point
a. commits transaction after each query
b. explicitly commits transaction
c. does not commit transaction automatically after each query
d. never commits transaction
Yes, the answer is correct.
Score: 1
Accepted Answers:
c. does not commit transaction automatically after each query
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=98&assessment=444 3/4
13/11/2024, 15:28 Programming in Java - - Unit 14 - Week 11 :
https://onlinecourses.nptel.ac.in/noc24_cs105/unit?unit=98&assessment=444 4/4