1. If you need to use a stored procedure with output parameters, which of the following statement type should be used to call the procedure?
A. Statement
B. PreparedStatement
C. CallableStatement
2. Which of the following will not cause a JDBC driver to be loaded and registered with the DriverManager?
A. Class.forName(driverString);
B. new DriverClass();
C. Include driver name in jdbc.drivers system property
D. None of the above
3. From which object do you ask for DatabaseMetaData?
A. Connection
B. ResultSet
C. DriverManager
D. Driver
4. SQLWarnings from multiple Statement method calls (like executeUpdate) will build up until you ask for them all with getWarnings and getNextWarning.
A. True
B. False
5. If one intends to work with a ResultSet, which of these PreparedStatement methods will not work?
A. execute()
B. executeQuery()
C. executeUpdate()
6. Can a ResultSet be reliably returned from a method that creates a Statement and executes a query?
A. Yes
B. No
7. How can I use JDBC to create a database?
A. Include create=true at end of JDBC URL
B. Execute "CREATE DATABASE jGuru" SQL statement
C. Execute "STRSQL" and "CREATE COLLECTION jGuru" SQL statements
D. Database creation is DBMS specific
8. Which character is used to represent an input parameter in a CallableStatement?
A. %
B. *
C. ?
D. #
9. Which one of the following will not get the data from the first column of ResultSet rs, returned from executing the following SQL statement: SELECT name, rank, serialNo FROM employee.
A. rs.getString(0);
B. rs.getString("name");
C. rs.getString(1);
10. Which of the following can you do with a JDBC 2.0 database driver that you cannot with a JDBC 1.x driver?
A. Batch multiple statements, to be sent to the database together
B. Scroll through result sets bi-directionally
C. Work with SQL3 data types directly
D. All of the above
11. Which class contains the transaction control methods setAutoCommit, commit, and rollback?
A. Connection
B. Statement
C. ResultSet
1. What interface must all interfaces for remote services extend?
A. java.rmi.RemoteService
B. java.rmi.Remotable
C. java.rmi.server.Remote
D. java.rmi.Remote
2. When defining a remote interface, what exception is typically thrown as part of each method signature?
A. IOException
B. RemoteException
C. RemoteCollisionException
D. RemoteControlException
3. From which of the following locations can an RMI server NOT load classes?
A. The CLASSPATH of an RMI client
B. The CLASSPATH of the RMI server
C. From an HTTP or FTP server on the network at a location specified by the client
D. From an HTTP or FTP server on the network at a location specified by the server
4. How are remote object parameters transferred between client and server?
A. A proprietary protocol that is determined by the vendor of the RMI implementation
B. Standard Java Serialization
C. Internet Inter-ORB Protocol (IIOP)
D. Java Remote Method Protocol (JRMP)
5. Which of the following is no longer true for the RMI implementation that comes with the Java 2 platform?
A. Services must extend the Remote interface
B. The skeleton file must be present for the server
C. The server must be running before its services can be used
D. All of the above are no longer true
6. How can a client prepare itself for callbacks from the RMI server?
A. Extend java.rmi.server.UnicastRemoteObject
B. Call UnicastRemoteObject.exportObject()
C. Either of the above will work
D. Neither of the above will work
7. To help with distributed garbage collection, how can a remote object be notified when there are no longer any clients holding a reference?
A. There is no way to be notified
B. By implementing the Unreferenced interface
C. By implementing the Deferenced interface
D. By implementing the ExpiredLease interface
8. What is the name for the remote object proxy that is used by the client?
A. Skeleton
B. RemoteRef
C. MarshaledObject
D. Stub
9. Which of the following tools is used to generate the stubs and skeletons for a remote service?
A. javac
B. rmic
C. java
D. rmiregistry
10. Which of the following would not locate the remote "Calculator" service on machine
www.jguru.com (with an IP address is 216.217.9.172), where the standard RMI registry was used?
A. Naming.lookup("rmi://www.jguru.com/Calculator");
B. Naming.lookup("rmi://216.217.9.172/Calculator");
C. Naming.lookup("rmi://www.jguru.com:1199/Calculator") ;
D. Naming.lookup("www.jguru.com:1099/Calculator");
1. What of following features can _not_ be configured in the JSF configuration file?
A. Navigation rules
B. Managed beans
C. Custom components
D. Application name
2. Which tag must enclose all other tags on a Faces JSP page?
A. <f:faces>
B. <f:view>
C. <h:jsf>
D. <h:view>
3. Which JSF component can be used to create tables?
A. HtmlPanelGroup
B. HtmlTable
C. UITable
D. HtmlPanelGrid
4. How do you declare a text label for an input control?
A. Use the HtmlOutputLabel component
B. Use the HtmlOutputLabel component with a child HtmlOutputText component
C. Use the HtmlOutputText component
D. Use the OutputLabel component
5. What type of events does the HtmlCommandButton generate?
A. Command events
B. Submit events
C. Action events
D. Click events
6. Why does the HtmlForm component render a <hidden> field?
A. To keep track of its identifier
B. To keep track of the components in tree
C. To set its submitted property
D. For JavaScript integration
7. Which JSF expression references an application's context path?
A. #{contextPath}
B. #{requestContextPath}
C. #{facesContext.externalContext.requestContextPath}
D. ${request.contextPath}
8. How do you integrate JSF components with custom JavaScript?
A. Write a new renderer
B. Through faces-config.xml
C. With HTML pass-through attributes
D. No specific integration is necessary
9. How do you integrate JSF components with cascading style sheets (CSS)?
A. With the JSF configuration file
B. With the styleClass property
C. With the cssClass property
D. With the class property
10. How do you customize validation messages with JSF?
A. Create a resource bundle with specific keys and specify its name in faces-config.xml
B. Create a resource bundle with specific keys
C. Create a properties file with custom keys and specify its name in web.xml
D. Specify the custom messages in faces-config.xml
1. Choose the statement that best describes the relationship between JSP and servlets:
A. Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime usage.
B. JSP and servlets are unrelated technologies.
C. Servlets and JSP are competing technologies for handling web requests. Servlets are being superseded by JSP, which is preferred. The two technologies are not useful in combination.
D. JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime usage.
2. What is a benefit of using JavaBeans to separate business logic from presentation markup within the JSP environment?
A. It allows the JSP to access middleware.
B. It creates a cleaner role separation between the web-production team and the software development team, so that the web-production team can focus on presentation markup, while the software team can focus on building reusable software components for helping to generate dynamic displays.
C. It provides a dynamic markup environment, such that JavaBeans are integrated seamlessly with the template presentation content, in order to create the dynamic display for the client.
D. It provides the developer with full access to the Java 2 Platform Enterprise Edition (J2EE), which is unavailable from outside the JavaBean environment.
3. Why use RequestDispatcher to forward a request to another resource, instead of using a sendRedirect?
A. Redirects are no longer supported in the current servlet API.
B. Redirects are not a cross-platform portable mechanism.
C. The RequestDispatcher does not use the reflection API.
D. The RequestDispatcher does not require a round trip to the client, and thus is more efficient and allows the server to maintain request state.
4. What alternatives exist to embedding Java code directly within the HTML markup of your JSP page?
A. Moving the code into your session manager.
B. Moving the code into scriptlets.
C. Moving the code into JavaBeans and servlets.
D. Moving the code into a transaction manager.
5. What type of scriptlet code is better-suited to being factored forward into a servlet?
A. Code that deals with logic that is common across requests.
B. Code that deals with logic that is vendor specific.
C. Code that deals with logic that relates to database access.
D. Code that deals with logic that relates to client scope.
6. Choose the statement that best describes how to connect JSP pages and Enterprise JavaBeans (EJBs):
A. Lookup the EJBs from within a JSP, but use the EJBs from within a basic JavaBean.
B. Lookup and use the EJBs from a separate business delegate. The JavaBeans that work with JSP pages are clients to these business delegates and know nothing about EJB specifics.
C. Lookup and use the EJBs from within a JSP page, but only as remote references.
D. Lookup the EJBs from within a servlet, delegating usage to specific JSP pages.
7. Are custom tags available in JSP 1.0? If not, how else might you implement iteration from within a JSP?
A. Yes, but the only tags available relate to database access.
B. No. To iterate over a collection of values, one must use scriptlet code.
C. No, but there is a standard <iterate> tag that may be used.
D. Yes, but custom tags will not help developers create tags for use in iterating over a collection.
8. What is the initial contact point for handling a web request in a Page-Centric architecture?
A. A JSP page.
B. A JavaBean.
C. A servlet.
D. A session manager.
9. What is the difference between doing an include or a forward with a RequestDispatcher?
A. The forward method transfers control to the designated resource, while the include method invokes the designated resource, substitutes its output dynamically in the display, and returns control to the calling page.
B. The two methods provide the same functionality, but with different levels of persistence.
C. The forward method is deprecated as of JSP 1.1 and the include method should be used in order to substitute portions of a dynamic display at runtime.
D. The include method transfers control to a dynamic resource, while the forward method allows for dynamic substitution of another JPS pages output, returning control to the calling resource.
10. What line of code below might be combined in the same JSP page with a validation guard (for example, <% bean.validationGuard(); %> ), in order to create an alternate flow of control for scenarios in which exceptions arise. The validationGaurd method might throw an exception, which should cause the flow of control to continue in another user-defined page (assume JSP 1.0).
A. <jsp:error page="errorPage.jsp" guard="true" />
B. <%@ page language="java" buffer="8k" %>
C. <jsp:useBean id="bean" class="examples.Bean" scope="request" />
D. <%@ page language="java" errorPage="errorPage.jsp" buffer="8k" %>
1. If you need to use a stored procedure with output parameters, which of the following statement type should be used to call the procedure?
A. Statement
B. PreparedStatement
C. CallableStatement
2. Which of the following will not cause a JDBC driver to be loaded and registered with the DriverManager?
A. Class.forName(driverString);
B. new DriverClass();
C. Include driver name in jdbc.drivers system property
D. None of the above
3. From which object do you ask for DatabaseMetaData?
A. Connection
B. ResultSet
C. DriverManager
D. Driver
4. SQLWarnings from multiple Statement method calls (like executeUpdate) will build up until you ask for them all with getWarnings and getNextWarning.
A. True
B. False
5. If one intends to work with a ResultSet, which of these PreparedStatement methods will not work?
A. execute()
B. executeQuery()
C. executeUpdate()
6. Can a ResultSet be reliably returned from a method that creates a Statement and executes a query?
A. Yes
B. No
7. How can I use JDBC to create a database?
A. Include create=true at end of JDBC URL
B. Execute "CREATE DATABASE jGuru" SQL statement
C. Execute "STRSQL" and "CREATE COLLECTION jGuru" SQL statements
D. Database creation is DBMS specific
8. Which character is used to represent an input parameter in a CallableStatement?
A. %
B. *
C. ?
D. #
9. Which one of the following will not get the data from the first column of ResultSet rs, returned from executing the following SQL statement: SELECT name, rank, serialNo FROM employee.
A. rs.getString(0);
B. rs.getString("name");
C. rs.getString(1);
10. Which of the following can you do with a JDBC 2.0 database driver that you cannot with a JDBC 1.x driver?
A. Batch multiple statements, to be sent to the database together
B. Scroll through result sets bi-directionally
C. Work with SQL3 data types directly
D. All of the above
11. Which class contains the transaction control methods setAutoCommit, commit, and rollback?
A. Connection
B. Statement
C. ResultSet
1. A session bean does not survive server crashes.
A. True
B. False
2. What happens during data marshaling?
A. The remote server object is created and its data echoed back to the client.
B. RMI APIs are called on the thin client, the data is serialized, and sent to the remote server object.
C. Methods that are called on a remote server object are wrapped with their data and sent to the remote server object, where they are unwrapped and executed.
D. Data is serialized and stored in the database, where it can be reached by the remote server for processing the object as needed.
3. If you want a bean to manage its own transactions, you have to configure the Enterprise JavaBeans server with which kind of settings?
A. JDBC service type, isolation level, commit mode
B. Transaction attribute, commit mode, isolation level
C. Transaction type, commit mode, RMI service type
D. Isolation level, transaction attribute, transaction type
4. When would you use an Interoperable Object Reference (IOR)?
A. As a backup protocol for data marshaling.
B. When a naming service is not compatible among all Object Request Brokers (ORBs).
C. To bind the remote server object to an ORB.
D. When a naming service is not compatible across remote method invocations.
5. What is the RMI-IIOP API used for?
A. To look up an object written in something other than the Java programming language.
B. To create a two-stage lookup.
C. To plug lookup services from various providers into a program written in the Java programming language.
D. To transmit Interoperable Object References (IORs) between RMI clients.
6. How does RMI prevent potential memory leaks from client references to remote objects when the clients have aborted or the network connection has dropped?
A. The remote server object sets an expiration time on all exported objects, and when the time reaches -1, theJava virtual machine1 sets the remote object for garbage collection if it cannot locate the client.
B. The virtual machine sets an expiration time on all exported object, and when the time reaches -1, the remote object is set for garbage collection.
C. The remote server object's container continually checks for references, and when a remote object has no more references, it is set for garbage collection.
D. The Java virtual machine sets an expiration time on all exported objects, and when the time reaches 0, the remote object is set for garbage collection.
7. What kind of exception is raised if you try to map a java.lang.String to a fixed size or bounded IDL string?
A. MARSHAL exception
B. DATA_CONVERSION exception
C. RMI exception
D. CORBA exception
8. CORBA does not have a distributed garbage collection mechanism.
A. True
B. False
9. When you use the Java Native Interface (JNI) to retrieve a reference to an array residing in your program, what does the Java virtual machine do to prevent the array from being moved by the garbage collector when it compacts heap memory?
A. Marshals the reference.
B. Serializes and stores the array data.
C. Pins the array into memory.
D. Uses a weak reference to deny the garbage collector access to the array.
10. In JNI, how do you make an object persist across native method calls?
A. By calling NewInstanceVariable on the local reference.
B. By calling NewGlobalPersist on the local reference.
C. By calling NewInstanceGlobal on the local reference.
D. By calling NewGlobalReference on the local reference.
1. At what stage of the software development process should you worry about performance?
A. Analysis
B. Design
C. Coding
D. Testing
E. All of the above
2. Which tool is most useful for optimizing the speed of your code?
A. Source-level debugger
B. Profiler
C. Disassembler
D. Optimizing source code to bytecode compiler
3. Which of the following technologies depend on the "Serialization" mechanism?
A. Jini technology
B. JavaSpaces technology
C. RMI
D. All of the above
E. None of the above
4. Which Java language keyword is most important for tuning serialization performance?
A. final
B. private
C. transient
D. synchronized
5. What is the key difference between the java.util.Vector and java.util.ArrayList classes?
A. Vector requires less memory.
B. ArrayList implements the Collection interface.
C. Vector is heavily synchronized, while ArrayList is not.
D. All of the above.
6. What guarantees does the Java Virtual Machine1 Specification make regarding objects that provide a finalize method?
A. These objects are given priority during garbage collection.
B. The finalize method is called before the object is collected.
C. The finalize method is called after the object is collected
D. The object is collected directly after the finalize method is called.
7. In Project Swing you can create your own Renderer objects. These can be used to enhance display, as well as improve performance. When creating a custom TableCellRenderer, what must you be sure to do?
A. Always return a new Component from the getTableCellRendererComponent method.
B. Always return a Component that is an instance of JComponent.
C. Recycle objects returned from the getTableCellRendererComponent method.
D. None of the above.
8. Swing programs should be single threaded.
A. True
B. False
9. Java archives (aka JAR files) can be used to improve the download speed of your applets. What types of files can be stored in JAR archives?
A. XML files
B. Graphics files
C. Class files
D. B and C
E. All of the above
10. What does the -server flag in J2SE 1.3 do?
A. Tells HotSpot to create small thread stacks to allow for higher numbers of threads.
B. Tells HotSpot to use its most advanced code generation techniques to achieve maximum performance.
C. Tells the java.net. package to use asynchronous socket connections.
D. All of the above.
E. None of the above.