Engineering Questions with Answers - Multiple Choice Questions

Database MCQ – Servlets and JSP

1 - Question

The Java __________ specification defines an application programming interface for communication between the Web server and the application program.
a) Servlet
b) Server
c) Program
d) Randomize

View Answer

Answer: a
Explanation: Servlets are commonly used to generate dynamic responses to HTTP requests.




2 - Question

The doGet() method in the example extracts values of the parameter’s type and number by using __________
a) request.getParameter()
b) request.setParameter()
c) responce.getParameter()
d) responce.getAttribute()

View Answer

Answer: a
Explanation: These methods uses these values to run a query against a database.




3 - Question

How many JDBC driver types does Sun define?
a) One
b) Two
c) Three
d) Four

View Answer

Answer: d
Explanation: JBDB.DriverManager.getConnection() is used to get the connection to the database.




4 - Question

Which JDBC driver Type(s) can be used in either applet or servlet code?
a) Both Type 1 and Type 2
b) Both Type 1 and Type 3
c) Both Type 3 and Type 4
d) Type 4 only

View Answer

Answer: c
Explanation: In a Type 3 driver, a three-tier approach is used to accessing databases. The JDBC clients use standard network sockets to communicate with an middleware application server. In a Type 4 driver, a pure Java-based driver that communicates directly with vendor’s database through socket connection.




5 - Question

What MySQL property is used to create a surrogate key in MySQL?
a) UNIQUE
b) SEQUENCE
c) AUTO_INCREMENT
d) None of the mentioned

View Answer

Answer: c
Explanation: A surrogate key in a database is a unique identifier for either an entity in the modeled world or an object in the database.




6 - Question

A JSP is transformed into a(n):
a) Java applet
b) Java servlet
c) Either 1 or 2 above
d) Neither 1 nor 2 above

View Answer

Answer: b
Explanation: Servlets are commonly used to generate dynamic responses to HTTP requests.




7 - Question

Which JDBC driver Type(s) is(are) the JDBC-ODBC bridge?
a) Type 1
b) Type 2
c) Type 3
d) Type 4

View Answer

Answer: a
Explanation: In a Type 1 driver, a JDBC bridge is used to access ODBC drivers installed on each client machine.




8 - Question

What programming language(s) or scripting language(s) does Java Server Pages (JSP) support?
a) VBScript only
b) Jscript only
c) Java only
d) All of the mentioned

View Answer

Answer: c
Explanation: JSP primarily uses Java for certain codes.




9 - Question

What is bytecode?
a) Machine-specific code
b) Java code
c) Machine-independent code
d) None of the mentioned

View Answer

Answer: c
Explanation: Java bytecode is the form of instructions that the Java virtual machine executes. Each bytecode opcode is one byte in length, although some require parameters, resulting in some multi-byte instructions.




10 - Question

Where is metadata stored in MySQL?
a) In the MySQL database metadata
b) In the MySQL database metasql
c) In the MySQL database mysql
d) None of the mentioned

View Answer

Answer: c
Explanation: Metadata contains data about other data which is given in the… tags.

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners