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

JDBC, Java Server Pages, and MySQL Questions and Answers

21.

JSP pages provide a means to create dynamic Web pages using HTML and the Java programming language.

Answer: A

Correct answer: True

A JSP page is HTML with Java embedded in it, translated by the container into a servlet that generates the page when requested. The point of the arrangement is that the static part of the page is written as ordinary HTML and only the varying part as code, which is the reverse of writing a servlet that prints HTML.

Please log in or register to report this question.

22.

JDBC Type 1 drivers are JDBC-ODBC bridge drivers.

Answer: A

Correct answer: True

Type 1 is the bridge: it translates JDBC calls into ODBC calls and depends on an ODBC driver and a configured data source on the machine. It was provided so that Java could reach databases with no JDBC driver of their own, and its local dependency makes it the least portable of the four.

Please log in or register to report this question.

23.

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.

24.

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.

27.

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.

28.

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.

30.

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.

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