This set of Database Multiple Choice Questions & Answers (MCQs) focuses on “Servlets and JSP”.
1. 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
Explanation: Servlets are commonly used to generate dynamic responses to HTTP requests.
2. 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
Explanation: These methods uses these values to run a query against a database.
3. How many JDBC driver types does Sun define?
a) One
b) Two
c) Three
d) Four
View Answer
Explanation: JBDB.DriverManager.getConnection() is used to get the connection to the database.
4. 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
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. 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
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. 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
Explanation: Servlets are commonly used to generate dynamic responses to HTTP requests.
7. 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
Explanation: In a Type 1 driver, a JDBC bridge is used to access ODBC drivers installed on each client machine.
8. 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
Explanation: JSP primarily uses Java for certain codes.
9. What is bytecode?
a) Machine-specific code
b) Java code
c) Machine-independent code
d) None of the mentioned
View Answer
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. 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
Explanation: Metadata contains data about other data which is given in the <meta>…</meta> tags.
Sanfoundry Global Education & Learning Series – Database Management System.
- Practice Programming MCQs
- Apply for Computer Science Internship
- Check Computer Science Books
- Practice RDBMS MCQ
- Practice Computer Science MCQs