Programming in Java | NPTEL 2022 | Week 11 quiz solutions

This set of MCQ(multiple choice questions) focuses on the Programming in Java NPTEL 2022 Week 11 Quiz Solutions.

Course layout (Answers Link)

Answers COMING SOON! Kindly Wait!

NOTE: You can check your answer immediately by clicking show answer button. Programming in Java NPTEL 2022 Week 11 Quiz Solutions” contains 10 questions.

Now, start attempting the quiz.

Programming in Java NPTEL 2022 Week 11 Quiz Solutions

Q1. MySQL is a ___________.

a) Java Database Connectivity Driver
b) Relational Database Management System
c) Java Runtime Environment
d) Java Development Kit

Answer: b) Relational Database Management System

Q2. The _________________ object allows you to execute parametrized queries.

a) ResultSet
b) PreparedStatement
c) ParameterizedStatement
d) Condition

Answer: b) PreparedStatement

Q3. Which of the following best describes about JDBC?

a) JDBC works like a bridge connecting a Java application to a RDBMS, execute SQL commands and return results to the application.
b) JDBC is a software component, which is both network and database independent.
c) JDBC should be installed in the same machine from where the Java application will run.
d) JDBC should be installed in the same server that of the database.

Answer: a)

Q4. Which of the following is not a JDBC drivers?

a) Native – API driver
b) Thin driver
c) Network protocol driver
d) Local Protocol driver

Answer: d) Local Protocol driver

Q5. The package, which is required to be imported for the JDBC programming?

a) java.net
b) java.sql
c) java.lang
d) java.io

Answer: b) java.sql

Q6. How do you know in your Java program that a SQL warning is generated as a result of executing a SQL statement in the database?

a) You must catch the checked SQLException which is thrown by the method which executes the statement
b) You must catch the unchecked SQLWarningExecption which is thrown by the method which executes the statement
c) You must invoke the getWarnings() method on the Statement object (or a sub interface thereof).
d) You must query the ResultSet object about possible warnings generated by the database.

Answer: c)

Q7. Which one of the following contains both date and time information?

a) java.sql.TimeStamp
b) java.sql.Time
c) java.io.Time
d) java.io.TimeStamp

Answer: a) java.sql.TimeStamp

Q8. Which of the following statement(s) is/are true?

a) 3306 is the default MySQL port.
b) Database name is ‘nptel’
c) The database server is hosted on IP 127.0.0.1
d) Password for user ‘java’ is ‘joy’.

Answer: a), b), c)

Q9. Which of the following method is used to perform DML statements in JDBC?

a) executeResult()
b) executeQuery()
c) executeUpdate()
d) execute()

Answer: c) executeUpdate()

Q10. The ___________ method sets the query parameters of the PreparedStatement Object.

a) putString()
b) insertString()
c) setString()
d) setToString()

Answer: c) setString()

Previous Course – Week 11 Quiz Solutions

Q1. Which of the following is not a JDBC drivers?

a) Native – API driver
b) Thin driver
c) Network protocol driver
d) Local Protocol driver

Answer: d) Local Protocol driver

Q2. Which of the following is a JDBC class component?

a) Connection
b) ResultSet
c) Statement
d) Driver

Answer: b) ResultSet

Q3. As with Statement objects, to execute a PreparedStatement object, it need to be call an execute statement. Which of the following statement(s) is/are true regarding this?

a) executeQuery: if the query returns only one ResultSet (such as a SELECT SQL statement).
b) executeUpdate: if the query does not return a ResultSet (such as an UPDATE SQL statement).
c) execute: if the query might return more than one ResultSet object
d) executeupdateQuery: if the query does return a ResultSet (such as an UPDATE SQL statement).

Answer: a), b), c)

Q4. Which of the following statement(s) is/are true, when the return value for executeUpdate is 0?

a) The statement executed was an update statement that affected zero rows.
b) The statement executed was a DDL statement
c) The statement executed was an update statement that affected one row.
d) The statement executed was a DCL statement

Answer: a), b)

Q5. Which of the following statement is used for executing a database stored procedure?

a) Statement
b) PreparedStatement
c) CallableStatement
d) None of these

Answer: c) CallableStatement

Programming in Java NPTEL 2022 Week 11 quiz Solutions

Q6. One a JDBC driver has been registered, which of the following method is used to make a database connection?

a) getConnection(String url, String userID, String password)
b) setConnection(String url, String userID, String password)
c) Connect(String url, String userID, String password)
d) Any one of the above.

Answer: a) getConnection(String url, String userID, String password)

Q7. The SQL command “USE test” implies, which of the following?

a) List all the databases those are there in the database server
b) List all the tables those are there under the database
c) Create a table called test
d) Set test as the current working database, so that any SQL command bind to the test database onhy

Answer: d) Set test as the current working database, so that any SQL command bind to the test database only

Programming in Java NPTEL 2022 Week 11 Quiz solutions

Q8.

Answer: d)

Q9. How do you know in your Java program that a SQL warning is generated as a result of executing a SQL statement in the database?

a) You must catch the checked SQLExecution which is thrown by the method which executes the statement.
b) You must catch the unchecked SQLWarningExecption which is thrown by the method which executes the statement.
c) You must invoke the getWarnings() method on the Statement object (or a sub interface thereof)
d) You must query the ResultSet object about possible warnings generated by the database.

Answer: c) You must invoke the getWarnings() method on the Statement object (or a sub interface thereof)

Q10. Which one of the following SQL type represent getfloat()?

a) FLOAT
b) REAL
c) INTEGER
d) DOUBLE

Answer: b) REAL

>> Prev- Programming in Java Week 10 Assignment Solutions

>> Next- Programming in Java Week 12 Assignment Solutions


DISCLAIMER: Use these answers only for the reference purpose. Quizermania doesn't claim these answers to be 100% correct. So, make sure you submit your assignments on the basis of your knowledge.

For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.

Leave a Comment

Your email address will not be published. Required fields are marked *