***********************************STRING HANDLING**************************************
1. What sort of thing is "Nothing New" as in the following: String str = "Nothing New";
a. A String shortcut
b. A String literal
c. A quoted String
d. An optimized String
ANS: b.
2) String myString;
What is the data type of myString?
a. String
b. reference to String
c. null
d. Object
ANS: b
3) What type of object cannot be altered after it is constructed?
a. unchangable
b. eternal
c. immutable
d. mallable
ANS: C.
4) What is the result of the following:
String stringA = " Wild " ;
String stringB = " Irish ";
String stringC = " Rose ";
String result = stringA.trim() + stringB + stringC.trim();
a. "WildIrishRose"
b. " Wild Irish Rose "
c. "Wild Irish Rose"
d. "Wild Irish Rose"
ANS: D
5) When an object no longer has any reference variables referring to it, what happens to it?
a. It sits around in main memory forever.
b. It is swapped out to disk.
c. The garbage collector makes the memory it occupies available for new objects.
d. It is sent to the Dumpster.
ANS: C.
6)What is the return value of "SELECT".substring(0, 5)?
A. "SELECT"
B. "SELEC"
C. "SELE"
D. "ELECT"
ANS: B.
7)What is the output of the following code?
String s = "University";
s.replace("i", "ABC");
System.out.println(s);
A. UnABCversity
B. UnABCversABCty
C. UniversABCty
D. University
ANS: D
8)"abc".compareTo("aba") returns ___________.
A. 1
B. 2
C. -1
D. -2
E. 0
ANS: B.
9)How can you get the word "abc" in the main method from the following call?
java Test "+" 3 "abc" 2
A. args[0]
B. args[1]
C. args[2]
D. args[3]
ANS: C.
10) Which correctly creates an array of five empty Strings?
A. String[] a = new String [5];
B. String[] a = {"", "", "", "", ""};
C. String[5] a;
D. String[ ] a = new String [5]; for (int i = 0; i < 5; a[i++] = null);
ANS: B.
********************************* EXCEPTION HANDLING****************************************
1) A Java exception is an instance of __________.
A. RuntimeException
B. Exception
C. Error
D. Throwable
E. NumberFormatException
ANS: D
2)Analyze the following code:
class Test {
public static void main(String[] args)
throws MyException {
System.out.println("Welcome to Java");
}
}
class MyException extends Error {
}
A. You should not declare a class that extends Error, because Error raises a fatal error that terminates the program.
B. You cannot declare an exception in the main method.
C. You declared an exception in the main method, but you did not throw it.
D. The program has a compilation error.
ANS: A
3) What exception type does the following program throw?
public class Test {
public static void main(String[] args) {
String s = "abc";
System.out.println(s.charAt(3));
}
}
A. ArithmeticException
B. ArrayIndexOutOfBoundsException
C. StringIndexOutOfBoundsException
D. ClassCastException
E. No exception
ANS:C
4) What exception type does the following program throw?
public class Test {
public static void main(String[] args) {
int[] list = new int[5];
System.out.println(list[5]);
}
}
A. ArithmeticException
B. ArrayIndexOutOfBoundsException
C. StringIndexOutOfBoundsException
D. ClassCastException
E. No exception
ANS: A
5) Which of the following is not an advantage of Java exception handling?
A. Java separates exception handling from normal processing tasks.
B. Exception handling improves performance.
C. Exception handling makes it possible for the caller's caller to handle the exception.
D. Exception handling simplifies programming because the error-reporting and error-handling code can be placed at the catch block.
ANS:B
6) What exception type does the following program throw?
public class Test {
public static void main(String[] args) {
Object o = null;
System.out.println(o.toString());
}
}
A. ArithmeticException
B. ArrayIndexOutOfBoundsException
C. StringIndexOutOfBoundsException
D. ClassCastException
E. NullPointerException
ANS:E
7)A method must declare to throw ________.
A. unchecked exceptions
B. checked exceptions
C. Error
D. RuntimeException
ANS:B
8)Which of the following is not an advantage of Java exception handling?
A. Java separates exception handling from normal processing tasks.
B. Exception handling improves performance.
C. Exception handling makes it possible for the caller's caller to handle the exception.
D. Exception handling simplifies programming because the error-reporting and error-handling code can be placed at the catch block.
ANS:B
9) What is wrong in the following program?
class Test {
public static void main (String[] args) {
try {
System.out.println("Welcome to Java");
}
}
}
A. You cannot have a try block without a catch block.
B. You cannot have a try block without a catch block or a finally block.
C. A method call that does not declare exceptions cannot be placed inside a try block.
D. Nothing is wrong.
ANS:B
10) Which of the following statements are true?
A. You use the keyword throws to declare exceptions in the method heading.
B. A method may declare to throw multiple exceptions.
C. To throw an exception, use the key word throw.
D. If a checked exception occurs in a method, it must be either caught or declared to be thrown from the method.
E. All of the above
ANS: E
****************************** JDBC*************************************
1) _________ specify the permissible values for an attribute.
A. Domain constraints
B. Primary key constraints
C. Foreign key constraints
D. intra-relational constraints
E. inter-relational constraints
ANS: A
2) Where is com.mysql.jdbc.Driver located?
A. in the standard Java library bundled with JDK
B. in a JAR file mysqljdbc.jar downloadable from the book's Companion Website
C. in a JAR file classes12.jar downloadable from the book's Companion Website
D. in a JAR file ojdbc14.jar downloadable from the book's Companion Website
ANS:B
3)Invoking Class.forName method may throw ___________.
A. RuntimeException
B. ClassNotFoundException
C. IOException
D. SQLException
ANS: B
4) Which of the following statements are true?
A. You may load multiple JDBC drivers in a program.
B. You may create multiple connections to a database.
C. You can send queries and update statements through a Statement object.
D. All of the above
ANS: D
5)The statement ___________ removes the records from the table, but keeps in definition of the table in the database.
A. destory table Course;
B. drop table Course;
C. delete * from Course;
D. delete Course;
ANS: D
6) Which of the following statements loads the JDBC-ODBC driver?
A. Class.forName(sun.jdbc.odbc.JdbcOdbcDriver)
B. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
C. Class.loadClass(sun.jdbc.odbc.JdbcOdbcDriver)
D. Class.loadClass("sun.jdbc.odbc.JdbcOdbcDriver")
ANS:B
7) Invoking Class.forName method may throw ___________.
A. RuntimeException
B. ClassNotFoundException
C. IOException
D. SQLException
ANS:B
8) To create a statement on a Connection object conn, use
A. Statement statement = conn.statement();
B. Statement statement = Connection.createStatement();
C. Statement statement = conn.createStatement();
D. Statement statement = connection.create();
ANS:C
9)Which of the following are interfaces?
A. Connection
B. Statement
C. ResultSet
D. All of the above
ANS:D
10)What is the return value from
stmt.executeUpdate("insert into T values (100, 'Smith')")
A. void
B. an int value indicating how many rows are effected from the invocation
C. a value indicating whether the SQL statement has been executed successfully
D. an object that contains the status of the execution
ANS:B
***************************************SERVLETS **********************************
1) The GET and POST methods are specified in _________.
A. a CGI program
B. a Java program
C. an HTML form
D. a URL string
ANS: A.
2)The _________ interface defines the methods that all servlets must implement.
A. javax.servlet.Servlet
B. HttpServlet
C. ServletRequest
D. ServletResponse
ANS: A
3) A servlet is an instance of __________.
A. the Object class
B. the Applet class
C. the HttpServlet class
D. the HTTPServlet class
ANS: C
4) _________ is a subinterface of ServletRequest.
A. HttpServletRequest
B. HttpServletResponse
C. HttpServlet
D. Servlet
ANS: A
5) Suppose the two parameters in the doGet or doPost method are request and response. To send output to a client, create a PrintWriter using _____________.
A. response.getWriter()
B. response.getPrintWriter()
C. response.writer()
D. response.getWrite()
ANS: A
6)To compile a Java servlet program, the ___________ file must be in the classpath.
A. TomcatRootDir\servlet.jar
B. TomcatRootDir\common\servlet.jar
C. TomcatRootDir\common\lib\servlet.jar
D. TomcatRootDir\common\bin\lib\servlet.jar
ANS:C
7)The _______ method is called when the servlet is first created, and is not called again as long as the servlet is not destroyed.
A. init
B. service
C. destroy
D. getServletInfo
ANS:A
8) Suppose the two parameters in the doGet or doPost method are request and response. To specify HTML content type sent to the client, invoke ___________.
A. response.setContentType("text/html")
B. request.setContentType("text/html")
C. response.setContentType("html")
D. request.setContentType("html")
ANS:A
9)You can use __________ to implement session tracking in servlets.
A. HTML hidden values in a form
B. the Cookie class
C. the HttpSession class
D.All of the above
ANS:D
10)To create a cookie for lastName with value Smith, use ____________.
A. new Cookie("Smith", "lastName");
B. new Cookie(Smith, lastName);
C. new Cookie("lastName", "Smith");
D. new Cookie(lastName, \Smith);
ANS:C
*********************************JSP*******************************************
1)You can run JSP from _____________.
A. any Web server.
B. any JVM.
C. any Web server that supports Java servlet and JSP.
D. any Web browser.
ANS C
2) Which of the following statements are true?
A. JSP is translated into Java servlet by a Web server when a JSP is called.
B. JSP is translated into HTML by a Web server when a JSP is called.
C. JSP is translated into XML by a Web server when a JSP is called.
D. All of the above
ANS: A
3) _______________ is a JSP scriptlet.
A. <%= i %>
B. <%= Math.pow(2, 3) %>
C. <%! private long computeFactorial(int n) { if (n == 0)return 1;else return n * computeFactorial(n - 1); } %>
D. <% for (int i = 0; i <= 10; i++) { %>
E. <!-- HTML Comment --%>
ANS: D
4) _______________ is a JSP comment.
A. <%= i %>
B. <%-- i --%>
C. <%! private long computeFactorial(int n) { if (n == 0) return 1; else return n * computeFactorial(n - 1); } %>
D. <% for (int i = 0; i <= 10; i++) { %>
E. <!-- HTML Comment -->
ANS: B
5)Which of the following is a JSP implicit object?
A. request
B. response
C. out
D. session
E. All of the above
ANS: E
6)_______________ is a JSP expression.
A. <%= i %>
B. <%= Math.pow(2, 3) %>
C. <%= new Date().toString() %>
D. <% for (int i = 0; i <= 10; i++) { %>
E. A,B,and C
ANS: E
7) _______________ is a JSP declaration.
A. <%= i %>
B. <%= Math.pow(2, 3) %>
C. <%! private long computeFactorial(int n) { if (n == 0) return 1; else return n * computeFactorial(n - 1); } %>
D. <% for (int i = 0; i <= 10; i++) { %>
E. <!-- HTML Comment -->
ANS:C
8)The ________ directive lets you provide information for the page, such as importing classes and setting up content type. The page directive can appear anywhere in
the JSP file.
A. page
B. include
C. tablib
D. import
ANS: A
9)A class is a JavaBeans component if ____________________.
A. it is a public class
B. it has a public constructor with no arguments
C. it is serializable.
D. All of the above
ANS: D
10) The JSP explicit object out is actually _________.
A. response.getOutputStream()
B. response.getWriter()
C. request.getOutputStream()
D. request.getWriter()
E. application
ANS : B
*************************************TOMCAT********************************
1) Apache Tomcat is a ________.
A. Servlet
B. Java program
C. Web server
D. Web server that is capable of running Java programs.
ANS: D
2) Before starting Tomcat, you have to set the environment variable JAVA_HOME to _______
A. JDKHomeDir
B. JDKHomeDir/bin
C. JDKHomeDir/bin/java
D. JDKHomeDir/java
ANS: A
3)To start the Tomcat servlet engine, use the command __________ from the TomcatRootDir\bin directory.
A. java TomcatServlet
B. start Tomcat
C. start
D. startup
ANS: D
4) By default, Tomcat runs on port ___________.
A. 8080
B. 80
C. 1080
D. 8888
ANS: A
5) If your servlet class file does not have a package statement, the servlet .class file must be placed in ________ by default.
A. the same directory with the .java file.
B. TomcatRootDir\webapps\WEB-INF\classes
C. TomcatRootDir\webapps\examples\WEB-INF
D. TomcatRootDir\webapps\examples\WEB-INF\classes
ANS: D
6) Suppose the servlet class named Test does not have the package statement, by default, you use ________ to invoke it.
A. http://localhost:8080/examples/servlet/Test
B. http://localhost:8080/examples/servlet/test
C. http://localhost:8080/Test
D. http://localhost:8080/test
ANS:A
7) If your servlet class file has a package statement package chapter, the servlet .class file must be placed in ________ by default.
A. the same directory with the .java file.
B. TomcatRootDir\webapps\WEB-INF\classes
C. TomcatRootDir\webapps\examples\WEB-INF\classes
D. TomcatRootDir\webapps\examples\WEB-INF\classes\chapter
ANS:D
8)To access Oracle or MySQL from servlet, where the Oracle and MySQL jar files should be placed?
A. in the class directory of the servlet source code
B. in the class directory of the servlet class code
C. TomcatRootDir\webapps\WEB-INF\classes
D. TomcatRootDir\common\lib
ANS:D
1. What sort of thing is "Nothing New" as in the following: String str = "Nothing New";
a. A String shortcut
b. A String literal
c. A quoted String
d. An optimized String
ANS: b.
2) String myString;
What is the data type of myString?
a. String
b. reference to String
c. null
d. Object
ANS: b
3) What type of object cannot be altered after it is constructed?
a. unchangable
b. eternal
c. immutable
d. mallable
ANS: C.
4) What is the result of the following:
String stringA = " Wild " ;
String stringB = " Irish ";
String stringC = " Rose ";
String result = stringA.trim() + stringB + stringC.trim();
a. "WildIrishRose"
b. " Wild Irish Rose "
c. "Wild Irish Rose"
d. "Wild Irish Rose"
ANS: D
5) When an object no longer has any reference variables referring to it, what happens to it?
a. It sits around in main memory forever.
b. It is swapped out to disk.
c. The garbage collector makes the memory it occupies available for new objects.
d. It is sent to the Dumpster.
ANS: C.
6)What is the return value of "SELECT".substring(0, 5)?
A. "SELECT"
B. "SELEC"
C. "SELE"
D. "ELECT"
ANS: B.
7)What is the output of the following code?
String s = "University";
s.replace("i", "ABC");
System.out.println(s);
A. UnABCversity
B. UnABCversABCty
C. UniversABCty
D. University
ANS: D
8)"abc".compareTo("aba") returns ___________.
A. 1
B. 2
C. -1
D. -2
E. 0
ANS: B.
9)How can you get the word "abc" in the main method from the following call?
java Test "+" 3 "abc" 2
A. args[0]
B. args[1]
C. args[2]
D. args[3]
ANS: C.
10) Which correctly creates an array of five empty Strings?
A. String[] a = new String [5];
B. String[] a = {"", "", "", "", ""};
C. String[5] a;
D. String[ ] a = new String [5]; for (int i = 0; i < 5; a[i++] = null);
ANS: B.
********************************* EXCEPTION HANDLING****************************************
1) A Java exception is an instance of __________.
A. RuntimeException
B. Exception
C. Error
D. Throwable
E. NumberFormatException
ANS: D
2)Analyze the following code:
class Test {
public static void main(String[] args)
throws MyException {
System.out.println("Welcome to Java");
}
}
class MyException extends Error {
}
A. You should not declare a class that extends Error, because Error raises a fatal error that terminates the program.
B. You cannot declare an exception in the main method.
C. You declared an exception in the main method, but you did not throw it.
D. The program has a compilation error.
ANS: A
3) What exception type does the following program throw?
public class Test {
public static void main(String[] args) {
String s = "abc";
System.out.println(s.charAt(3));
}
}
A. ArithmeticException
B. ArrayIndexOutOfBoundsException
C. StringIndexOutOfBoundsException
D. ClassCastException
E. No exception
ANS:C
4) What exception type does the following program throw?
public class Test {
public static void main(String[] args) {
int[] list = new int[5];
System.out.println(list[5]);
}
}
A. ArithmeticException
B. ArrayIndexOutOfBoundsException
C. StringIndexOutOfBoundsException
D. ClassCastException
E. No exception
ANS: A
5) Which of the following is not an advantage of Java exception handling?
A. Java separates exception handling from normal processing tasks.
B. Exception handling improves performance.
C. Exception handling makes it possible for the caller's caller to handle the exception.
D. Exception handling simplifies programming because the error-reporting and error-handling code can be placed at the catch block.
ANS:B
6) What exception type does the following program throw?
public class Test {
public static void main(String[] args) {
Object o = null;
System.out.println(o.toString());
}
}
A. ArithmeticException
B. ArrayIndexOutOfBoundsException
C. StringIndexOutOfBoundsException
D. ClassCastException
E. NullPointerException
ANS:E
7)A method must declare to throw ________.
A. unchecked exceptions
B. checked exceptions
C. Error
D. RuntimeException
ANS:B
8)Which of the following is not an advantage of Java exception handling?
A. Java separates exception handling from normal processing tasks.
B. Exception handling improves performance.
C. Exception handling makes it possible for the caller's caller to handle the exception.
D. Exception handling simplifies programming because the error-reporting and error-handling code can be placed at the catch block.
ANS:B
9) What is wrong in the following program?
class Test {
public static void main (String[] args) {
try {
System.out.println("Welcome to Java");
}
}
}
A. You cannot have a try block without a catch block.
B. You cannot have a try block without a catch block or a finally block.
C. A method call that does not declare exceptions cannot be placed inside a try block.
D. Nothing is wrong.
ANS:B
10) Which of the following statements are true?
A. You use the keyword throws to declare exceptions in the method heading.
B. A method may declare to throw multiple exceptions.
C. To throw an exception, use the key word throw.
D. If a checked exception occurs in a method, it must be either caught or declared to be thrown from the method.
E. All of the above
ANS: E
****************************** JDBC*************************************
1) _________ specify the permissible values for an attribute.
A. Domain constraints
B. Primary key constraints
C. Foreign key constraints
D. intra-relational constraints
E. inter-relational constraints
ANS: A
2) Where is com.mysql.jdbc.Driver located?
A. in the standard Java library bundled with JDK
B. in a JAR file mysqljdbc.jar downloadable from the book's Companion Website
C. in a JAR file classes12.jar downloadable from the book's Companion Website
D. in a JAR file ojdbc14.jar downloadable from the book's Companion Website
ANS:B
3)Invoking Class.forName method may throw ___________.
A. RuntimeException
B. ClassNotFoundException
C. IOException
D. SQLException
ANS: B
4) Which of the following statements are true?
A. You may load multiple JDBC drivers in a program.
B. You may create multiple connections to a database.
C. You can send queries and update statements through a Statement object.
D. All of the above
ANS: D
5)The statement ___________ removes the records from the table, but keeps in definition of the table in the database.
A. destory table Course;
B. drop table Course;
C. delete * from Course;
D. delete Course;
ANS: D
6) Which of the following statements loads the JDBC-ODBC driver?
A. Class.forName(sun.jdbc.odbc.JdbcOdbcDriver)
B. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
C. Class.loadClass(sun.jdbc.odbc.JdbcOdbcDriver)
D. Class.loadClass("sun.jdbc.odbc.JdbcOdbcDriver")
ANS:B
7) Invoking Class.forName method may throw ___________.
A. RuntimeException
B. ClassNotFoundException
C. IOException
D. SQLException
ANS:B
8) To create a statement on a Connection object conn, use
A. Statement statement = conn.statement();
B. Statement statement = Connection.createStatement();
C. Statement statement = conn.createStatement();
D. Statement statement = connection.create();
ANS:C
9)Which of the following are interfaces?
A. Connection
B. Statement
C. ResultSet
D. All of the above
ANS:D
10)What is the return value from
stmt.executeUpdate("insert into T values (100, 'Smith')")
A. void
B. an int value indicating how many rows are effected from the invocation
C. a value indicating whether the SQL statement has been executed successfully
D. an object that contains the status of the execution
ANS:B
***************************************SERVLETS **********************************
1) The GET and POST methods are specified in _________.
A. a CGI program
B. a Java program
C. an HTML form
D. a URL string
ANS: A.
2)The _________ interface defines the methods that all servlets must implement.
A. javax.servlet.Servlet
B. HttpServlet
C. ServletRequest
D. ServletResponse
ANS: A
3) A servlet is an instance of __________.
A. the Object class
B. the Applet class
C. the HttpServlet class
D. the HTTPServlet class
ANS: C
4) _________ is a subinterface of ServletRequest.
A. HttpServletRequest
B. HttpServletResponse
C. HttpServlet
D. Servlet
ANS: A
5) Suppose the two parameters in the doGet or doPost method are request and response. To send output to a client, create a PrintWriter using _____________.
A. response.getWriter()
B. response.getPrintWriter()
C. response.writer()
D. response.getWrite()
ANS: A
6)To compile a Java servlet program, the ___________ file must be in the classpath.
A. TomcatRootDir\servlet.jar
B. TomcatRootDir\common\servlet.jar
C. TomcatRootDir\common\lib\servlet.jar
D. TomcatRootDir\common\bin\lib\servlet.jar
ANS:C
7)The _______ method is called when the servlet is first created, and is not called again as long as the servlet is not destroyed.
A. init
B. service
C. destroy
D. getServletInfo
ANS:A
8) Suppose the two parameters in the doGet or doPost method are request and response. To specify HTML content type sent to the client, invoke ___________.
A. response.setContentType("text/html")
B. request.setContentType("text/html")
C. response.setContentType("html")
D. request.setContentType("html")
ANS:A
9)You can use __________ to implement session tracking in servlets.
A. HTML hidden values in a form
B. the Cookie class
C. the HttpSession class
D.All of the above
ANS:D
10)To create a cookie for lastName with value Smith, use ____________.
A. new Cookie("Smith", "lastName");
B. new Cookie(Smith, lastName);
C. new Cookie("lastName", "Smith");
D. new Cookie(lastName, \Smith);
ANS:C
*********************************JSP*******************************************
1)You can run JSP from _____________.
A. any Web server.
B. any JVM.
C. any Web server that supports Java servlet and JSP.
D. any Web browser.
ANS C
2) Which of the following statements are true?
A. JSP is translated into Java servlet by a Web server when a JSP is called.
B. JSP is translated into HTML by a Web server when a JSP is called.
C. JSP is translated into XML by a Web server when a JSP is called.
D. All of the above
ANS: A
3) _______________ is a JSP scriptlet.
A. <%= i %>
B. <%= Math.pow(2, 3) %>
C. <%! private long computeFactorial(int n) { if (n == 0)return 1;else return n * computeFactorial(n - 1); } %>
D. <% for (int i = 0; i <= 10; i++) { %>
E. <!-- HTML Comment --%>
ANS: D
4) _______________ is a JSP comment.
A. <%= i %>
B. <%-- i --%>
C. <%! private long computeFactorial(int n) { if (n == 0) return 1; else return n * computeFactorial(n - 1); } %>
D. <% for (int i = 0; i <= 10; i++) { %>
E. <!-- HTML Comment -->
ANS: B
5)Which of the following is a JSP implicit object?
A. request
B. response
C. out
D. session
E. All of the above
ANS: E
6)_______________ is a JSP expression.
A. <%= i %>
B. <%= Math.pow(2, 3) %>
C. <%= new Date().toString() %>
D. <% for (int i = 0; i <= 10; i++) { %>
E. A,B,and C
ANS: E
7) _______________ is a JSP declaration.
A. <%= i %>
B. <%= Math.pow(2, 3) %>
C. <%! private long computeFactorial(int n) { if (n == 0) return 1; else return n * computeFactorial(n - 1); } %>
D. <% for (int i = 0; i <= 10; i++) { %>
E. <!-- HTML Comment -->
ANS:C
8)The ________ directive lets you provide information for the page, such as importing classes and setting up content type. The page directive can appear anywhere in
the JSP file.
A. page
B. include
C. tablib
D. import
ANS: A
9)A class is a JavaBeans component if ____________________.
A. it is a public class
B. it has a public constructor with no arguments
C. it is serializable.
D. All of the above
ANS: D
10) The JSP explicit object out is actually _________.
A. response.getOutputStream()
B. response.getWriter()
C. request.getOutputStream()
D. request.getWriter()
E. application
ANS : B
*************************************TOMCAT********************************
1) Apache Tomcat is a ________.
A. Servlet
B. Java program
C. Web server
D. Web server that is capable of running Java programs.
ANS: D
2) Before starting Tomcat, you have to set the environment variable JAVA_HOME to _______
A. JDKHomeDir
B. JDKHomeDir/bin
C. JDKHomeDir/bin/java
D. JDKHomeDir/java
ANS: A
3)To start the Tomcat servlet engine, use the command __________ from the TomcatRootDir\bin directory.
A. java TomcatServlet
B. start Tomcat
C. start
D. startup
ANS: D
4) By default, Tomcat runs on port ___________.
A. 8080
B. 80
C. 1080
D. 8888
ANS: A
5) If your servlet class file does not have a package statement, the servlet .class file must be placed in ________ by default.
A. the same directory with the .java file.
B. TomcatRootDir\webapps\WEB-INF\classes
C. TomcatRootDir\webapps\examples\WEB-INF
D. TomcatRootDir\webapps\examples\WEB-INF\classes
ANS: D
6) Suppose the servlet class named Test does not have the package statement, by default, you use ________ to invoke it.
A. http://localhost:8080/examples/servlet/Test
B. http://localhost:8080/examples/servlet/test
C. http://localhost:8080/Test
D. http://localhost:8080/test
ANS:A
7) If your servlet class file has a package statement package chapter, the servlet .class file must be placed in ________ by default.
A. the same directory with the .java file.
B. TomcatRootDir\webapps\WEB-INF\classes
C. TomcatRootDir\webapps\examples\WEB-INF\classes
D. TomcatRootDir\webapps\examples\WEB-INF\classes\chapter
ANS:D
8)To access Oracle or MySQL from servlet, where the Oracle and MySQL jar files should be placed?
A. in the class directory of the servlet source code
B. in the class directory of the servlet class code
C. TomcatRootDir\webapps\WEB-INF\classes
D. TomcatRootDir\common\lib
ANS:D
I appreciate that you produced this wonderful article to help us get more knowledge about this topic.
ReplyDeleteI know, it is not an easy task to write such a big article in one day, I've tried that and I've failed. But, here you are, trying the big task and finishing it off and getting good comments and ratings. That is one hell of a job done!
Selenium training in bangalore
Selenium training in Chennai
Selenium training in Bangalore
Selenium training in Pune
Selenium Online training
Some us know all relating to the compelling medium you present powerful steps on this blog and therefore strongly encourage contribution from other ones on this subject while our own child is truly discovering a great deal. Have fun with the remaining portion of the year.
ReplyDeletePython Online certification training
python Training institute in Chennai
Python training institute in Bangalore
Wonderful article, very useful and well explanation. Your post is extremely incredible. I will refer this to my candidates...
ReplyDeletepython training in chennai
Python Online training in usa
python course institute in chennai
Thanks For Sharing The Information The information shared Is Very Valuable Please Keep Updating Us Time just went On reading The article Python Online Training Aws Online Training Hadoop Online Training Data Science Online Training
ReplyDeleteThe casino at the city centre - DrmCD
ReplyDelete› › Home › Gaming 창원 출장샵 › › Home › Gaming All About 충청남도 출장마사지 Hotel 평택 출장마사지 · Hotel · Casino · Hotel 삼척 출장안마 · 고양 출장마사지 More Info. Hours, Accepts Credit Cards, Wi-Fi · More Information.