Machine-translated by Google. Questions are authored in English.
Top

JDBC, Java Server Pages, and MySQL Questions and Answers

1.

An applet is a Java bytecode program that is sent to the user via HTTP and is invoked using the HTTP protocol on the user's computer.

Answer: A

Correct answer: True

That is the definition of an applet, and the contrast with a servlet is the point: an applet is sent over HTTP and executed by the JVM in the user’s browser, a servlet is executed by the container on the server. The applet’s dependence on a browser JVM is what eventually made it obsolete.

Please log in or register to report this question.

Answer: C

Correct answer: It may have many constructors as necessary.

A bean must provide a public constructor taking no arguments, because the container creates it by reflection and has no arguments to supply. Additional constructors may exist, but the no-argument one is obligatory, so the statement as written is not true of a bean. The other two - no public instance variables, access through get and set methods - are the other defining requirements.

Please log in or register to report this question.

3.

JSP and ASP not only look alike but their underlying technology is quite similar.

Answer: B

Correct answer: False

They look alike on the page, both embedding code in HTML, and there the resemblance ends. JSP is translated into a Java servlet and runs on the JVM in a servlet container; ASP runs under the Microsoft web server and accepts VBScript and JScript rather than Java. The similarity is of appearance only.

Please log in or register to report this question.

4.

MySQL is pronounced "my See-quel."

Answer: B

Correct answer: False

It is pronounced My Ess Cue Ell, letter by letter, and the manual says so explicitly. The See-quel pronunciation belongs to SQL Server and to SQL informally, and the distinction is a point the MySQL documentation has always been particular about.

Please log in or register to report this question.

5.

Which JDBC driver Types are for use over communications networks?

Answer: C

Correct answer: Both Type 3 and Type 4

Types 3 and 4 are pure Java and communicate over a network, Type 3 to a middleware server and Type 4 straight to the DBMS in its own protocol. Neither needs anything installed on the client, which is what makes them the types usable from applets and from servlets on machines separate from the database.

Please log in or register to report this question.

6.

MySQL surrogate keys are given the property AUTO_INCREMENT.

Answer: A

Correct answer: True

AUTO_INCREMENT on an integer column makes MySQL supply the next value automatically on each insert, which is precisely what a surrogate key needs: a unique value with no meaning, generated by the system rather than by the application.

Please log in or register to report this question.

7.

JDBC Type 2 drivers connect to the native API of the DBMS.

Answer: A

Correct answer: True

A Type 2 driver converts JDBC calls into calls on the DBMS vendor’s own client library, so part of it is native code that must be installed on the machine. It is generally faster than the Type 1 bridge for that reason, and less portable for the same one.

Please log in or register to report this question.

8.

How many copies of a JSP page can be in memory at a time?

Answer: A

Correct answer: One

The container keeps a single instance of the translated servlet and serves every concurrent request from it, each on its own thread. This is why a JSP must be written to be thread-safe: an instance variable is shared across all users, and only local variables within the service method are private to a request.

Please log in or register to report this question.

Answer: C

Correct answer: In the MySQL database mysql

MySQL keeps its own catalogue in a database called mysql, which holds the user accounts, privileges and other server metadata. It is an ordinary database and can be queried like any other, which is how privileges are inspected, though they are normally changed through GRANT rather than by writing to the tables directly.

Please log in or register to report this question.

10.

To run a compiled Java program, the machine must have what loaded and running?

Answer: A

Correct answer: Java virtual machine

Compilation produces bytecode rather than machine code, and bytecode is not executable by any processor directly. The Java virtual machine reads it and executes it, and it is the JVM that differs from platform to platform while the bytecode does not - which is the whole of the write once, run anywhere claim.

Please log in or register to report this question.

Loading…
Tags: JDBC, Java Server Pages, and MySQL Questions and Answers || JDBC, Java Server Pages, and MySQL MCQ Questions and Answers || JDBC, Java Server Pages, and MySQL GK Questions and Answers || JDBC, Java Server Pages, and MySQL GK MCQ Questions || JDBC, Java Server Pages, and MySQL Multiple Choice Questions and Answers || JDBC, Java Server Pages, and MySQL GK || GK on JDBC, Java Server Pages, and MySQL || Database Questions and Answers || Database MCQ Questions and Answers || Database GK Questions and Answers || GK on Database