Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

IBM 154 q&a passed: 66.7%

Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1.) In the following scenario: Servlet A creates a session and returns the results to the client. Servlet B is called by the client. In the code for servlet b, the session is called using: HttpSession session = request.getSession(true); Which of the following methods could be used in a servlet to test to see that the client was successfully able to create a session in Servlet A?
A. session.isValid()
B. if (session != null)
C. session.exists()
d. session.isNew()

2). A filter can NOT be used for which of the following tasks?
A. Accessing external resources
B. Creating a response
C. Blocking the passage of the response
D. Calling other filters

3). Which of the following is NOT a recommended practice for a servlet according to the J2EE MVC model?
A. Generate and return HTML content to the user via a PrintWriter
B. Generate and return binary content to the user
C. Delegate business services to a business agent
D. Delegate display to an appropriate view agent
E. provide a common layout by acting as a template

4). Which of the following methods would return the name of an object stored in the servlet context that has been removed or replaced?
A. ServletContextAttributeEvent.getName();
B. ServletContextAttributeEvent.getValue();
C. ServletContextEvent.getName();
D. ServletContextEvent.getValue();
E. ServletContextListenerEvent.getName();
F. ServletContextListenerEvent.getValue();

5). A servlet is to handle requests made to a specific non-default URL specified at deployment time. Which three deployment descriptor entries in the web.xml file are mandatory when registering an HttpServlet in order to enable this behavior?
(Select 3)
A. Filter name
B. Servlet name
C. Welcome file list
D. Servlet to URL mapping
E. Class name of the servlet
F. Servlet initialization parameters

6). Sessions can be used to store which of the following types of information?
A. Enterprise data, often accessed lists of data such as catalog information
B. Personal preference and language information
C. Information required for the current servlet/jsp's activities only
D. Client-specific application state or incomplete business state information

7).A client is accessing a servlet directly from their browser. Which of the following CANNOT by default be obtained by the servlet by querying the request object?
A. Protocol used to access the servlet
B. URL used by the client to make the request
C. Number of times the client has accessed the servlet
D. Parameters passed in through a POST request

8). A servlet called via a getNamedDispatcher().forward() method will have which of the following request attributes automatically set for it?
(Select 2)
A. request uri
B. context path
C. remote host
D. servlet path
E. locales

9). When a servlet is mapped in the WAR file, which entry will best ensure that all requests with the extension .work will be directed to a single servlet named MasterController?
A. <servlet-mapping> <servlet-name>MasterController</servlet-name> <url-pattern>/MasterController/*</url-pattern> </servlet-mapping>
B. <servlet-mapping> <servlet-name>MasterController</servlet-name> <url-pattern>/MasterController.*</url-pattern> </servlet-mapping>
C. <servlet-mapping> <servlet-name>MasterController</servlet-name> <url-pattern>/*.work</url-pattern> </servlet-mapping>
D. <servlet-mapping> <servlet-name>MasterController</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>

10). Which three terms identify the ways an HTML author may set the width of a table?
(Select 3)
A. Selected
B. Weighted
C. Fixed
D. Percentage
E. Proportional

11). A servlet instantiates a JavaBean and stores it in the request object using the following code: com.mybean.Employee worker = new com.mybean.Employee(); request.setAttribute("employee", worker); The servlet then forwards the request on to a JSP for further processing. Which of the following allows the JSP to retrieve the JavaBean that the servlet stored in the request?
A. <%@ include file="com.mybean.Employee" %>
B. <jsp:useBean id="employee" class="com.mybean.Employee" scope="session" />
C. <jsp:useBean id="worker" class="com.mybean.Employee" scope="session" />
D. <jsp:useBean id="employee" class="com.mybean.Employee" scope="request" />
E. <jsp:useBean id="worker" class="com.mybean.Employee" scope="request" />
F. <jsp:useBean id="worker" class="com.mybean.Employee" />

12).Which tag associates a CSS to a HTML page?
A. link
B. import
D. br
E. A Ref

13). <wml> <card id="1" title="one"> Alpha </card> <card id="2" title="two"> Beta </card> <card id="3" title="three"> Gamma </card> </wml> When the document described above is opened, what will be displayed on the WML enabled device?
A. Alpha
B. Alpha Beta Gamma
C. one two three
D. one Alpha two Beta three Gamma
E. 1 2 3

14). JSP directives can be used for which of the following?
(Select 2)
A. To instantiate a JavaBean
B. To change a JSP's thread safe setting
C. To produce output to the current output stream
D. To statically include HTML in the current JSP

15). A JSP scripting variable called count of type int is to be declared with local scope within the service method of the generated servlet. What is the appropriate JSP scripting element to be used?
A. <@page="count" value="0" />
B. <% int count = 0; %>
C. <%= int count = 0; %>
D. <%! int count = 0; %>
E. <jsp:setProperty name="count" property="0" />

16). PRAGMA header settings usually specify implementation-specific directives EXCEPT for
A. no-cache
B. date
C. method
D. upgrade

17). A banking web application contains a JSP called account.jsp. What technique can the JSP developer use in order to have ONLY exceptions of type InsufficientFundsException caught and automatically handled by an error page called insufficentFundsError.jsp?
A. Use an include page directive.
B. Use an error page directive in account.jsp.
C. Use an error page directive in insufficentFundsError.jsp.
D. Declare the exception type and error page in the deployment descriptor (web.xml).

18). Program X and program Z communicate asynchronously through JMS messaging. Therefore, a request message from X to Z and a response message from Z to X are not automatically linked in any way. Which two of the following describe how program X can associate a message it consumes with a message it previously sent?
(Select 2)
A. Program X specifies a URL and port in the JMSReplyTo header field of the request message and program Z the sends the response message to URL and port specified in the JMSReplyTo field.
B. Program X sets the JMSCorrelationID header field of the request message and Program Z returns the same value in the JMSCorrelationID header field of the response message.
C. Program X specifies the JNDI name of Program Z in the message selector associated with the listener for the response to accept only messages from program Z.
D. Option B, but program X additionally sets the message selector associated with the listener for the response to accept only messages with the desired JMSCorrelationID.

19). Which of the following methods can be used to obtain a JNDI name?
A. InitialContext.getURLOrDefaultInitCtx()
B. InitialContext.lookup()
C. InitialContext.getDefaultInitCtx()
D. InitialContext.getNameParser()
E. InitialContext.list()

20). Consider the following Java code segment: PreparedStatement ps = con.prepareStatement( "SELECT * FROM Products WHERE " + "ProductID = ? OR (Price < ? AND Cost > ?)"); Which of the following properly sets the parameters for prepared statement ps assuming column ProductID is of SQL type SMALLINT and columns Price and Cost are of SQL type FLOAT?
A. ps.setShort(1, 1004); ps.setDouble(2, 5d); ps.setDouble(3, 20d);
B. ps.setDouble(0, 1004d); ps.setDouble(1, 5d); ps.setDouble(2, 20d);
C. ps.setDouble(1, 1004d); ps.setDouble(2, 5d); ps.setDouble(3, 20d);
D. ps.setShort(0, 1004); ps.setDouble(1, 5d); ps.setDouble(2, 20d);

21). A JMSException object provides which of the following pieces of information?
(Select 3)
A. A vendor-specific description of the error that occurred
B. A vendor-specific error code
C. An industry standard error code
D. A link to another exception
E. An error code conforming to the XOPEN standard

22). Besides javax.mail, which of the following packages are the minimum required to work with JavaMail?
A. javax.http
B. javax.swing
C. java.util
D. javax.naming

23). How must the data be structured in the records sent to and returned from an Enterprise Information System (EIS) through the J2C architecture?
A. The records must contain well formed XML documents.
B. The record body must be a byte array that can be read as COBOL COMMAREAs, and typically is built using helper classes generated by vendor-specific tools from COBOL source files that define the COMMAREAs.
C. Records must contain bytes that can be interpreted as printable characters according to the code page (character encoding scheme) specified in a header field.
D. The J2C specification allows for a wide variety of formats controlled by EIS-specific and tool-specific metadata.

24). Which of the following best describes the difference between an EJB home interface and an EJB remote interface?
A. A remote interface provides facilities for creating and obtaining EJBs, while a home interface defines the methods available through an EJB.
B. A remote interface is only available to the container, while a home interface is available to clients.
C. A home interface is only available to the container, while a remote interface is available to clients.
D. A home interface provides facilities for creating and obtaining EJBs, while a remote interface defines the methods available through an EJB.

25). Use the Employees relation defined in the exhibit to answer this question. Assuming variable con references a valid and open connection to a database containing the Employees relation, what output is generated by the following Java code segment? Statement s = con.createStatement(); ResultSet rs = s.executeQuery("SELECT * FROM Employees");; System.out.println(rs.getString(1));
c.James Roos
d.Carlos Ventura

26). Asynchronous Web Services are supported by applications written to which two specifications?
(Select 2)

27). Which tag fragment indicates a document is described by a Schema rather than a DTD?
A. xmlns
B. doctype
C. pcdata
D. element

28). Which two of the following are essential features of a Web Service?
(Select 2)
A. ASCII encoding
B. XML message exchange
C. URI application identification
D. HTTP network protocol

29). What mechanism does a SOAP server use to report an error?
A. A single <fault> element in the message body
B. A single <fault> element in the message header
C. Multiple <fault> elements in the message body
D. Multiple <fault> elements in the message header

30). Which Web Service specification functions most like IIOP or JRMP?
----------------------------------------------------------------------------Section # Questions # Correct
1. Writing Application Control Logic 9 3
2. Writing Application Display Logic 8 6
3. Utilizing Business Services 8 7
4. Exposing Appl'n Components Using Web Services 5 4
passed: 66.7%


Does anybody knows where are errors?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic