Report - Responses
Report - Responses
Points:
1/1
Statement
DatabaseMetaData
ResultSet
Connection
Points:
1/1
Represents the servlet configuration
Represents the client request
Used to get client information
Used to send the response to the client
Points:
0/1
Load("com.mysql.jdbc.Driver");
LoadDriver("com.mysql.jdbc.Driver");
Class.forName("com.mysql.jdbc.Driver");
DriverManager.loadDriver("com.mysql.jdbc.Driver");
Points:
1/1
createConnection()
openConnection()
connect()
DriverManager.getConnection()
Points:
0/1
Statement.create(con);
Statement stmt = con.createStatement();
Statement stmt = createStatement(con);
Statement stmt = new Statement();
7. What is a notable advantage of using the JDBC-ODBC driver? (Select Three Right Options)
Points:
0/1
Initialize, Service, Destroy
Start, Execute, Stop
Create, Process, Terminate
Initiate, Execute, Destroy
9. What is the correct method signature for the init method in a servlet?
Points:
1/1
init(ServletConfig config)
void init()
void initialize()
initiate()
10. What is a notable advantage and disadvantage of using the JDBC-ODBC driver? (Select Two Right Answers)
11. Select the two appropritate misisng key words in the below program code:
Points:
1/1
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class MyServlet extends HttpServlet {
public void ______(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// Fetch the parameter "name" from the request
String name = request.________(name);
Points:
0/1
Servlets cannot generate dynamic content
Servlets are only used for client-side processing
Servlets can only be written in scripting languages
Servlets are platform-independent
13. How can you retrieve a parameter named "username" from the client request in a servlet?
Points:
0/1
getParameter("name")
getRequestParameter("username")
getParameter("username")
getParameter("user")
14. How can a servlet obtain client information, such as IP address and browser type?
Points:
0/1
Using the getParameter() method
Using the response.getWriter() method
Using the request.getHeader() method
Using the getSession() method
Points:
0/1
To handle GET requests
To handle POST requests
To initialize the servlet
To destroy the servlet object
Points:
0/2
Platform Independence
Performance
Ease of Deployment
Direct Communication with the Database Server
17. What is the correct syntax for retrieving data from a ResultSet in JDBC?
Points:
0/1
Points:
0/1
DriverManager.connect("jdbc:mysql://localhost:3306/mydatabase", "user", "password");
Connection con = new Connection("jdbc:mysql://localhost:3306/mydatabase", "user", "password");
DatabaseConnection con = DriverManager.connect("jdbc:mysql://localhost:3306/mydatabase", "user",
"password");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydatabase", "user", "password");
19. Which HTTP method is primarily used by the doGet method in HttpServlet?
Points:
1/1
GET
PUT
DELETE
POST
Points:
1/1
To initialize the servlet
To handle the POST requests
To destroy the servlet object
To handle the GET requests
21. Which method is used to obtain the PrintWriter object for sending data to the client?
Points:
0/1
getPrintWriter()
printWriter()
getResponseWriter()
getWriter()
22.
Points:
0/1
con.closeConnection();
closeConnection(con);
con.close();
Close.connection();
24. What does JDBC stand for?
Points:
1/1
Java Database Controller
Java Database Connection
Java Database Connectivity
Java Database Compiler
Points:
0/1
To execute SQL queries
To handle transaction management
To retrieve metadata about the database
To represent a database connection
27. Which protocol is used for communication between a client and a servlet?
Points:
0/1
FTP
TCP
HTTP
SMTP
Points:
0/1
Statement
Connection
ResultSet
DatabaseMetaData
Points:
1/1
To execute SQL queries
To handle transaction management
To retrieve data from a database
To represent a database connection
30. Which method is called by the servlet container to initialize a servlet?
Points:
1/1
start()
begin()
init()
initialize()
31. Which of the following statements is used to execute an SQL query in JDBC?
Points:
0/1
executeUpdate()
executeInsert()
execute()
executeQuery()
Points:
0/1
Application server
FTP server
Web server
Database server
Points:
1/1
To destroy the servlet object
To handle POST requests
To initialize the servlet
To handle GET requests
Points:
0/1
Servlet
HttpServlet
Both a and b
None of the above
Points:
1/1
To get the servlet configuration
To obtain the servlet context
To obtain the client's IP address
To initialize the servlet
36. In a servlet, what does the doPost method handle?
Points:
1/1
GET requests
Both GET and POST requests
Servlet initialization
POST requests