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

JDBC, Java Server Pages, and MySQL Questions and Answers

21.

What servlet processor was developed by Apache Foundation and Sun?

Answer: A

Correct answer: Apache Tomcat

Tomcat is the servlet container produced by the Apache Foundation with Sun, and it is the reference implementation of the servlet and JSP specifications. The Apache web server itself serves HTTP and does not run servlets, so the two are usually deployed together with requests for JSPs passed through to Tomcat.

Please log in or register to report this question.

22.

What is invoked via HTTP on the Web server computer when it responds to requests from a user's Web browser?

Answer: C

Correct answer: A Java servlet

A servlet is Java bytecode that runs on the server, invoked over HTTP when a request arrives from a browser, and returns a response. An applet is its mirror image, sent to the browser and run on the user’s machine, and an ordinary application has nothing to do with HTTP.

Please log in or register to report this question.

Answer: C

Correct answer: Machine-independent code

Bytecode is the instruction set of the Java virtual machine rather than of any real processor, so the same compiled file runs anywhere a JVM exists. That is precisely what makes Java portable, and it is why a JVM must be present on the machine before a compiled program can run at all.

Please log in or register to report this question.

Answer: A

Correct answer: Java Database Connectivity

JDBC is the standard API by which a Java program issues SQL to any database for which a driver exists, and its role in Java is what ODBC’s is elsewhere. The driver, loaded at run time, is what makes the same application code work against different DBMS products.

Please log in or register to report this question.

25.

What MySQL property is used to create a surrogate key in MySQL?

 

Answer: C

Correct answer: AUTO_INCREMENT

Declaring an integer column AUTO_INCREMENT makes MySQL assign the next value on each insert, which is the standard way of creating a surrogate key. Oracle of the same era had no such property and needed a sequence with a trigger instead - a difference worth remembering when porting a schema.

Please log in or register to report this question.

26.

A servlet is a Java program that is invoked via HTTP on the Web server.

Answer: A

Correct answer: True

That is the definition. A servlet is Java bytecode running inside a container on the web server, invoked when an HTTP request arrives and returning the response. It is the server-side counterpart of the applet, which runs on the user’s machine instead.

Please log in or register to report this question.

Answer: C

Correct answer: Sun

Java was developed at Sun Microsystems, released in 1995, and the language, the virtual machine and the JDBC specification all came from there. Sun was acquired by Oracle in 2010, which is why current Java documentation carries Oracle’s name.

Please log in or register to report this question.

28.

Which JDBC driver Type(s) is(are) the JDBC-ODBC bridge?

Answer: A

Correct answer: Type 1

Type 1 is the JDBC-ODBC bridge: it translates JDBC calls into ODBC calls and relies on an ODBC driver and data source being configured on the machine. That dependency makes it the least portable of the four, and it was intended as a stopgap for databases with no native JDBC driver.

Please log in or register to report this question.

29.

Java and C/C++ are so close that there are no incompatibilities between them. Therefore, a driver is not necessary.

Answer: B

Correct answer: False

The two languages differ in memory management, in object model and in calling conventions, so Java cannot call a C library directly and a driver or a native interface layer is required. This is exactly why the JDBC driver types exist: Types 1 and 2 bridge to native code, and Types 3 and 4 avoid it altogether.

Please log in or register to report this question.

30.

Java programs are compiled into bytecode.

Answer: A

Correct answer: True

The Java compiler produces bytecode, the instruction set of the virtual machine, rather than machine code for a particular processor. That intermediate form is what a JVM reads and executes, and it is why one compiled file runs on any platform with a JVM.

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