Sei sulla pagina 1di 61

Sun_Prepking_310-051_v2011-06-06_136q_By-Erika

Number: 310-051 Passing Score: 800 Time Limit: 120 min File Version: 2011-06-06 Exam : Sun Code : 310-051 Version : 2011-06-06 Question : 136 Modified Material for exam which one is so important.. Good Luck Guys By : Erika

Exam A QUESTION 1 Your company's employee assistance program (EAP) application is now required to be deployed on the Web. The following are characteristics and requirements of the new system: The UI is an off-the-shelf, unsigned terminal-emulator applet. The applet communicates with a terminal server using a proprietary TCP/IP-based protocol. The terminal server sits behind the corporate firewall and listens on port 10001. The only configurable items for the applet are the host IP and port of the terminal server. You company's firewall only allows traffic through on port 80 for HTTP and port 443 for HTTPS. Problem: The applet is unable to communicate through the firewall. Which two statements about this architecture are false? (Choose two) A. If the applet were signed, it could communicate directly with the terminal server. B. If the terminal server were signed, the applet could communicate with it directly on port 10001. C. The applet can communicate with the terminal server if the firewall is modified to allow traffic through on port 10001. D. The applet can communicate with the terminal server if it is configured to communicate with the terminal server on port 80 or 443. Answer: AB Section: (none) Explanation/Reference:

QUESTION 2 Exhibit:

The current architecture consists of one Web server, three application servers, and a database. The new architecture will add more Web servers. Which two statements about the new architecture are false? (Choose two) A. B. C. D. Adding more webservers will have a negative impact on scalability. DNS round-robin can be used to load-distribute HTTP traffic to the Web servers. When using HTTP, a load-balancer takes care of managing Web-server session states. When using HTTPS, a load-balancer must route all traffic in the same session to the same Web server.

Answer: AC Section: (none)

Explanation/Reference:

QUESTION 3 Which two improve software maintainability? (Choose two) A. B. C. D. Code factoring Reusing components Public instance variables Dependencies between components

Answer: AB Section: (none) Explanation/Reference:

QUESTION 4 Exhibit:

In the exhibit, what is the relationship between A and C? A. B. C. D. E. F. G. H. C depends on A A depends on C. A is a realization of C. C is a realization of A. C is an aggregation of A. A is a specialization of C. A is a generalization of C. C is a specialization of A.

Answer: D

Section: (none) Explanation/Reference:

QUESTION 5 Exhibit:

Which two statements about the exhibit are true? (Choose two) A. B. C. D. E. The object method doBaz() is self-called. getBar() is a method in the C class. getBar() is a class B accessor method. The method doBaz() calls the getBar() method. doBaz() will return its result to the method getFoo().

Answer: AB Section: (none) Explanation/Reference:

QUESTION 6 Exhibit:

The exhibit shows the communication between four EJBs.

Which change to the existing architecture helps increase performance? A. B. C. D. Convert all entity beans to stateful session beans. Convert all entity beans to stateless session beans. Use bean-managed persistence for each entity bean. Have each EJB hold a reference to the EJB it calls, instead of calling findByPrimaryKey().

Answer: D Section: (none) Explanation/Reference:

QUESTION 7 Your supply chain software currently runs a standalone application which communicates to the backend services using IIOP. The new requirements for the software are: * The client software must run as an applet. * The user's firewall will only allow port 80 and 443 traffic through its firewall. * All the backend services will be CORBA-based. * A Web server sits in front of the COBRA services. * The backend Web server runs on port 80 and 443. Which two solutions support the new requirements? (Choose two) A. You convert the application to an applet and use IIOP to communicate with the backend services. B. You convert the application to an applet running outside the browser and send XML through port 443. C. You convert the application to an applet and use IIOP tunneled through HTTP to communicate with the backend services. D. You convert the application to an applet and use HTTPS to communicate with a servlet which communicates with the backend services using IIOP. Answer: CD Section: (none) Explanation/Reference:

QUESTION 8 Exhibit:

In the exhibit, what is the relationship between C and F? A. B. C. D. E. F. G. H. C depends on F. F depends on C. F is a realization of C. C is a realization of F. C is an aggregation of F. F is a specialization of C. F is a generalization of C. C is a specialization of F.

Answer: A Section: (none) Explanation/Reference:

QUESTION 9 Exhibit:

What type of diagram is displayed in the exhibit? A. B. C. D. E. F. G. State diagram Activity diagram Class diagram Use case diagram Sequence diagram Interaction diagram Collaboration diagram

Answer: B Section: (none) Explanation/Reference:

QUESTION 10 Exhibit:

The exhibit shows the communication between four EJBs. Which two changes to the existing architecture will increase performance? (Choose two)

A. B. C. D.

Convert all entity beans to stateless session beans. Use bean-managed persistence for each entity bean. Have Customer call Account, Order, and ShoppingCart directly. Have each EJB hold a reference to the EJB it calls, instead of calling findByPrimaryKey().

Answer: CD Section: (none) Explanation/Reference:

QUESTION 11 What decreases software maintainability? (Choose two) A. B. C. D. Code reuse Data sharing High coupling Code factoring

Answer: BC Section: (none) Explanation/Reference:

QUESTION 12 Exhibit:

Which two statements about the exhibit are true? A. B. C. D. E. The object method doBaz() is self-called. getBar() is a method in the class C. getBar() is a class B accessor method. The method doBaz() calls the getBar() method. doBaz() will return its results to the method getFoo().

Answer: AB Section: (none)

Explanation/Reference:

QUESTION 13 You are in the process of migrating your existing system to a new architecture to support your growing user base. The current system consists of: * Browser-based HTML./JavaScript UI. * One Web server instance. * One J2EE application server instance. * A database The new architecture has the following requirements: * Browser-based HTML./JavaScript UI. * Cluster of Web servers. * Cluster of J2EE application servers. * A database. Which two statements are true? (Choose two) A. B. C. D. Clustering increases scalability. Clustering impacts availability, not scalability. DNS round-robin can be used to load-balance the Web servers. Clustering the application servers provides automatic EJB fault-tolerance.

Answer: AC Section: (none) Explanation/Reference:

QUESTION 14 What increase software maintainability? (Choose two) A. B. C. D. Code reuse Data sharing High coupling Code factoring

Answer: AD Section: (none) Explanation/Reference:

QUESTION 15 Exhibit:

Which type of diagram is displayed in the exhibit? A. B. C. D. E. F. G. State diagram Class diagram Activity diagram Use case diagram Sequence diagram Interaction diagram Collaboration diagram

Answer: E Section: (none) Explanation/Reference:

QUESTION 16 Exhibit:

The current architecture consists of one Web server, three application servers, and a database. The new architecture will add more Web servers. Which three statements about the new architecture are true? (Choose three) A. B. C. D. Adding multiple Web servers will have a positive impact on scalability. DNS round-robin can be used to load-distribute HTTP traffic to the Web servers. When using HTTP, a load balancer takes care of managing Web server session states. When using HTTPS, a load-balancer must route all traffic in the same session to the same Web server.

Answer: ABD Section: (none)

Explanation/Reference:

QUESTION 17 Exhibit:

Which diagram in the exhibit reflects the relationship: "A is always associated with one B"? A. B. C. D. E. F. A B C D E F

Answer: E Section: (none) Explanation/Reference:

QUESTION 18 Exhibit:

Which diagram in the exhibit reflects the relationship: "A is associated with zero, one or more Bs"? A. B. C. D. E. F. A B C D E F

Answer: D Section: (none) Explanation/Reference:

QUESTION 19 Which two features of a firewall might interfere with the operation of IIOP? (Choose two) A. B. C. D. Port filtering Load balancing Address filtering Network address translation

Answer: AC Section: (none) Explanation/Reference:

QUESTION 20 As an architect, you are interested in the architecture characteristics of a system. Which two are architectural characteristics? (Choose two)

A. B. C. D.

Liability Reliability Inheritance Performance

Answer: BD Section: (none) Explanation/Reference:

QUESTION 21 Which two statements are true about management of an EJB's resources? (Choose two) A. The reference to the remote object is obtained through JNDI to improve maintainability and flexibility. B. The reference to home object is obtained through JNDI to improve maintainability and flexibility. C. The EJB container can manage the instance's access to its resources because the home object acts as a proxy. D. The EJB container can manage the instance's access to its resourced because the remote object acts as a proxy. Answer: BD Section: (none) Explanation/Reference:

QUESTION 22 What is a benefit of bean pooling in an EJB container? A. B. C. D. It improves the portability between databases. It reduces the number of database connections. It provides better support to object-oriented databases. It reduces the memory allocation and garbage-collection cycles.

Answer: D Section: (none) Explanation/Reference:

QUESTION 23 Which statement about an EJB container's lifecycle management of session beans is true? A. B. C. D. The client is responsible for the object identity for session beans. The client can passivate a session bean after a specified timeout period. The container can passivate a stateful session bean to free limited resources. The container can passivate a stateless session bean to free limited resources.

Answer: C

Section: (none) Explanation/Reference:

QUESTION 24 Which statement about passivating session beans is true? A. The passivated stateful session bean should close all connections before being passivated. B. The passivated stateless session bean should close all connections before being passivated. C. The container ensures that the passivated bean's open connections are closed or returned to the connection pool. D. The container ensures that the passivated stateless session bean is reassigned to the remote object upon activation. Answer: A Section: (none) Explanation/Reference:

QUESTION 25 A telecommunications company, Certkiller , is building an enterprise system to allow the Certkiller support staff to access customer information over an intranet. All of the customer information is stored in a legacy system and can only be accessed using a VT100 terminal session. You must create an architecture to access the legacy system. What should you use to encapsulate access to the legacy system? A. B. C. D. A JDBC connection that uses SQL to query the legacy system. AN EJB entity bean that uses JMS to interact with the legacy system. A distributed CORBA object that uses IIOP to interact with the legacy system. An EJB session bean that uses a screen-scraping tool to interact with the legacy system.

Answer: A Section: (none) Explanation/Reference:

QUESTION 26 Exhibit:

Certkiller Ltd has purchased a B2B system to run on a manufacturing trading hub. The protocol of choice is HTTPS and the data representation mechanism is XML. You have been tasked with integrating all of your customer's manufacturing systems into your trading hub. The manufacturing systems are integrated using custom adapters. The adapters are responsible for: Sending and receiving XML using HTTPS. Converting XML into data required by the customer system. Which statement best labels the architecture in the exhibit? A. B. C. D. A - adapter, B - hub, C - adapter, D - XML A - adapter, B - hub, C - HTTPS, D - adapter A - XML, B - manufacturing system, C - adapter. D - hub A - manufacturing system, B - hub, C - adapter, D _ HTTPS

Answer: D Section: (none) Explanation/Reference:

QUESTION 27 A manufacturing company, Certkiller GmBh, is building an enterprise system to allow the sales staff to place customer orders over an intranet. All orders must be placed using a legacy system running MQSeries. You must create an architecture to interact with the legacy system. How would you encapsulate interaction with that legacy system? A. B. C. D. With an EJB session bean that uses JMS to message the legacy system. With a Java class that uses a screen-scraping tool to interact with the legacy system. With a distributed CORBA object that uses IIOP to interact directly with the legacy system. With an EJB entity bean that uses container-managed persistence to encapsulate the legacy system.

Answer: A Section: (none)

Explanation/Reference:

QUESTION 28 Certkiller .com, a shipping company, is building an enterprise system to track the location of packages. One part of the tracking system is a network of wireless inventory devices. The devices can only be accessed using a custom, synchronous TCP/IP protocol. How should you encapsulate interaction with the wireless inventory system? A. B. C. D. With an EJB session bean that uses a JMS to interact with the inventory system. With a Java class that uses custom Java networking to interact with the inventory system. With a distributed CORBA object that uses IIOP to interact directly with the inventory system. With an EJB entity bean that uses container-managed persistence to encapsulate the inventory system.

Answer: C Section: (none) Explanation/Reference:

QUESTION 29 What are two features of JRMP? (Choose two) A. B. C. D. E. F. It is secure. It is connectionless. It is connection-based. It is used for load balancing. It is used for hypermedia requests. It is used for remote-object communications.

Answer: CF Section: (none) Explanation/Reference:

QUESTION 30 A steel industry association has hired you, a Certkiller network consultant, to create a B2B architecture for the steel industry. What does this mean? A. You have to create a portal to allow consumers to order steel products. B. You have to create a portal to exchange news and information about the steel industry. C. You have to create an infrastructure to allow the exchange of product catalog information between steel companies.

D. You have to create an architecture to allow the exchange of order information between steel companies order systems. Answer: D Section: (none) Explanation/Reference:

QUESTION 31 Which items provides tools to allow the formatting of currency and date information according to local conventions? A. B. C. D. E. java.text package java.util.Locale class javla.lang.String class Pluggable look and feel in Swing Readers and Writers in the java.io package

Answer: A Section: (none) Explanation/Reference:

QUESTION 32 Which three are aspects of an application are most likely to be determined at runtime based on the user's declared nationality of locale? (Choose three) A. B. C. D. E. Currency formats. Network protocols. Textual output messages. Calculations and/or algorithms. Server host names and/or addresses

Answer: ACE Section: (none) Explanation/Reference:

QUESTION 33 Which three statements about container-managed persistence are true? (Choose three) A. B. C. D. A container-managed enterprise bean requires less code. Container-managed persistence provides less bean control. Container-managed persistence can require complex mapping techniques. Container-managed persistence manages a session bean's conversational state.

Answer: ABC Section: (none)

Explanation/Reference:

QUESTION 34 What acts as a proxy to an EJB? A. B. C. D. IDL instance Home instance Bean instance Remote instance

Answer: D Section: (none) Explanation/Reference:

QUESTION 35 Certkiller 's application uses several entity beans accessing each other for information. The company found the architecture to be low in flexibility because they embedded entity relationships in the entity beans. What is an alternative solution? A. B. C. D. Use a stateful session bean as a Mediator to the entity beans. Use a stateful session bean as a Faade to other session beans. Use a servlet to give clients direct access to data in a database table. Use a stateless session bean to access the database directly instead of using entity beans.

Answer: A Section: (none) Explanation/Reference:

QUESTION 36 A client makes a transactionless method call to an EJB that has a transaction attribute of Required in the deployment descriptor. Which statement is true? A. B. C. D. The container creates a new transaction. The EJB throws an EJBException since it requires transaction context. The EJB throws a RemoteException since it requires a transaction context. The container throws a RemoteException since the EJB must have a transaction context.

Answer: A Section: (none) Explanation/Reference:

QUESTION 37 Which two statements about stateless session beans are true? (Choose two) A. B. C. D. They provide a generic service. They maintain a cached state on behalf of a specific client. They maintain a conversational state on behalf of several clients. They may provide high performance by being available for multiple clients.

Answer: AD Section: (none) Explanation/Reference:

QUESTION 38 You are creating an architecture for an online ordering system with the following requirements: * Users will order products over the Internet. * Business objects will reside on a local application server. * All product information is stored in a local RDBMS. * Credit card information must be validated by an external system. * All local systems will be secured behind a firewall. * All communications with the external systems must be secure. Which two design decisions will increase the flexibility of the system? (Choose two) A. B. C. D. Using an entity bean to track the user's shopping cart. Using an entity bean to encapsulate product information. Using a stateless session bean to validate user ID and password. Using an entity bean to encapsulate the external credit card system.

Answer: BC Section: (none) Explanation/Reference:

QUESTION 39 The following statement is true about which type of EJB? "All bean instances are equivalent when they are not involved in serving a client-invoked method". A. B. C. D. Stateful session bean Stateless session bean Entity bean with bean-managed persistence Entity bean with container-managed persistence

Answer: B Section: (none) Explanation/Reference:

QUESTION 40 Your client is a bank that wants to allow its customers to access their bank accounts over the Internet. Given the following requirements, which protocol communicates with the Web browser? Confidential information must be protected. Customers will access their accounts using only a simple Web browser with no extension. A. B. C. D. IIOP HTTP SNMP HTTPS

Answer: D Section: (none) Explanation/Reference:

QUESTION 41 A department of Certkiller Inc uses entity beans with bean-managed persistence to access an RDBMS. The entity beans contain the code to access the database directory. Certkiller decides that other departments can reuse the business logic to access their database, which include an OODBMS and a different type of RDBMS. Which statement best describes how Certkiller can integrate their departmental business logic to access the various databases, and to ensure that the entity bean code is easy to read? A. B. C. D. Use session beans to access an entity bean through a data access object. Move the data-access code out of the entity beans into a data-access object. Distribute the data-access code among several entity beans to access different databases. Use session beans to access several entity beans that represents the data in all three databases.

Answer: B Section: (none) Explanation/Reference:

QUESTION 42 Certkiller Grapes, a vineyard, is developing an online ordering system to sell wine online. Because of local sales restrictions, the vineyard is working with local wine stored to deliver wine to the customers. The requirements for the system are: Customers keep their choices in a "wine list". Requests are fulfilled as the vintage become available. Local wine shops track wines that have been ordered by customers in their area. All order and product data is stored in an RDBMS. Both customers and local wine shops use the Internet to access the system. The system must be scalable and secure.

Which two interactions must be secure? (Choose two) A. B. C. D. Customers adding wine to their wine list. The application server generating a sales report. The application server updating the order information into the DB. The local wine stop checking what wines have been ordered locally.

Answer: AD Section: (none) Explanation/Reference:

QUESTION 43 Which pattern provides a means to access the elements on an aggregate object sequentially without exposing the underlying structure? A. B. C. D. E. Proxy Iterator Strategy Observer Singleton

Answer: B Section: (none) Explanation/Reference:

QUESTION 44 You have determined that the interactions between objects in a system are complex, and that the objects are tightly coupled. Furthermore, additional functionality would require the modification of many objects in the system. Which pattern will solve this problem? A. B. C. D. E. Faade Mediator Template Prototype Command

Answer: B Section: (none) Explanation/Reference:

QUESTION 45 What are two benefits of the Faade pattern? (Choose two)

A. B. C. D.

It hides complex subsystems from clients. It allows objects to masquerade as different objects. It decouples the object interface from the implementation. It encourages weak coupling between the client and the subsystem.

Answer: AD Section: (none) Explanation/Reference:

QUESTION 46 Which design pattern is represented by the EJB Home interface? A. B. C. D. Proxy Visitor Faade Abstract Factory

Answer: D Section: (none) Explanation/Reference:

QUESTION 47 What are three benefits of design patterns? (Choose three) A. B. C. D. E. They act as a learning aid. They provide standard code libraries. They provide a common design vocabulary. They standardize the way designs are developed. They describe an object-oriented development process.

Answer: ACD Section: (none) Explanation/Reference:

QUESTION 48 What are two clear advantages to using message services in an application? (Choose two) A. B. C. D. Provides scalability Provides secure communication services. Allows loose coupling between components. Allows clients and servers to communicate directly.

Answer: AC

Section: (none) Explanation/Reference:

QUESTION 49 The requirements for an online shopping application are: 1 It must support millions of customers. 2 The invocation must be transactional. 3 The shopping cart must be persistent. Which technology is required to support these requirements? A. B. C. D. JNI JMS EJB JMX

Answer: C Section: (none) Explanation/Reference:

QUESTION 50 Which two statements about JMS are true? (Choose two) A. B. C. D. JMS supports Publish/Subscribe. JMS uses JNDI to find the destination. JMS enhances access to email services. JMS uses JMX to create a connectionFactory.

Answer: AB Section: (none) Explanation/Reference:

QUESTION 51 Which statement describes a normal default security restriction applied to untrusted classes by a Java enabled browser? A. B. C. D. E. Untrusted classes cannot read data from arbitrary files. Untrusted classes cannot initiate any network connections. Untrusted classes cannot write sensitive data to the screen. Untrusted classes cannot make unrestricted use of CPU power. Untrusted classes cannot read sensitive data from the keyboard.

Answer: A Section: (none)

Explanation/Reference:

QUESTION 52 These are the requirements for your new system: 1 All current business logic is in the form of database-stored procedures. 2 All current and new business logic is to be migrated to EJB. 3 The system is an online, Web-based system. The UI is HTML-based. 4 There are three EJBs: Customer, Order, and Account. There is one Java object, ShoppingList, which holds the current list of ordered items. 5 Only account and order data are stored in the database. 6 The Customer EJB maintains a reference to the ShoppingList. Which three architectural decisions adhere to the requirements? (Choose three) A. B. C. D. E. F. Make Order and Account an entity EJB. Make Customer a stateful-session EJB. Make Customer a stateless-session EJB. Make Customer an entity EJB and put business logic in it. Make Customer a session EJB and put business logic in it. Use the Container Managed Persistence policy for the Customer session EJB.

Answer: ABE Section: (none) Explanation/Reference:

QUESTION 53 You are developing an HR application with the following requirements: Users access the systems over an intranet, using a standard Web browser. Organization information is stored in LDAP. Benefits information is stored in an RDBMS. Complaints are sent directly to a third-party system for compliance. Which J2EE technology would allow the system to interact with the LDAP server? A. B. C. D. E. F. EJB JSP JMS JTA JNDI JDBC

Answer: E Section: (none) Explanation/Reference:

QUESTION 54 Which two services does EJB provide? (Choose two) A. B. C. D. HTML generation Transaction services Lifecycle management Remote-method invocation

Answer: BC Section: (none) Explanation/Reference:

QUESTION 55 Which statement describes a normal default security restriction applied to classes loaded from untrusted sourced by Java-enabled browsers? A. B. C. D. E. Untrusted classes cannot load trusted classes. Untrusted classes cannot create server sockets. Untrusted classes cannot load untrusted classes. Untrusted classes cannot initiate any network connections. Untrusted classes cannot display windows outside of the browser.

Answer: B Section: (none) Explanation/Reference:

QUESTION 56 Given: 1. public class X { 2. public static void main(String [] args) { 3. int [] a = new int[1]; 4. modify(a); 5. System.out.println(a[0]); 6. } 7. 8. public static void modify(int [] a) { 9. a[0]++; 10. } 11. } What is the result?

A. B. C. D. E.

The program runs and prints "0". The program runs and prints "1". The program runs but aborts with an exception. An error "possible undefined variable" at line 4 caused compilation to fail. An error "possible undefined variable" at line 9 causes compilation to fail.

Answer: B Section: (none) Explanation/Reference:

QUESTION 57 Given: Integer i = new Integer(42); Long 1 = new Long(42); Double d = new Double(42.0); Which two expressions evaluate to true? (Choose two) A. B. C. D. E. F. (i==1) (i==d) (d==1) (i.equals(d)) (d.equals(i)) (i.equals(42))

Answer: DE Section: (none) Explanation/Reference:

QUESTION 58 Which two are equivalent? (Choose two) A. B. C. D. E. F. 3/2 3<2 3*4 3 << 2 3 * 22 3 <<< 2

Answer: CD Section: (none) Explanation/Reference:

QUESTION 59 Which three are valid declarations of a float? (Choose three)

A. B. C. D. E. F.

float foo = -1; float foo = 1.0; float foo = 42e1; float foo = 2.02f; float foo = 3.03d; float foo = 0x0123;

Answer: ADF Section: (none) Explanation/Reference:

QUESTION 60 Given: 1. String foo = "blue"; 2. boolean[] bar = new boolean[1]; 3. if (bar[0]) { 4. foo = "green"; 5. } What is the result? A. B. C. D. E. F. foo has the value of "". foo has the value of null. foo has the value of "blue". foo has the value of "green". An exception is thrown. The code will not compile.

Answer: C Section: (none) Explanation/Reference:

QUESTION 61 Which is a valid identifier? A. B. C. D. false default _object a-class

Answer: C Section: (none) Explanation/Reference:

QUESTION 62

Given: 1. public class Test { 2. public static main( String[] args) { 3. String foo = args[1]; 4. String bar = args[2]; 5. String baz = args[3]; 6. } 7. } And command line invocation: java Test red green blue What is the result? A. B. C. D. E. F. G. baz had the value of "". baz had the value of null. baz has the value of "red". baz has the value of "blue". baz has the value of "green". The code does not compile. The program throws an exception.

Answer: G Section: (none) Explanation/Reference:

QUESTION 63 Given: 1. // Point X 2. public class Foo { 3. public static void main(String[] args) throws Exception { 4. java.io.PrintWriter out = new java.io.PrintWriter( 5. new java.io.OutputStreamWriter(System.out), true); 6. out.println("Hello"); 7. } 8. } Which statement at Point X on line 1 allows this code to compile and run? A. B. C. D. E. import java.io.*; include java.io.*; import java.io.PrintWriter; include java.io.PrintWriter; No statement is needed.

Answer: E Section: (none) Explanation/Reference:

QUESTION 64 Given: 1. interface Foo {

2. int k = 0; 3. } 4. 5. public class Test implements Foo { 6. public static void main(String args[]) { 7. init i; 8. Test test = new Test(); 9. i = Cert.k; 10. i = Cert.k; 11. i = Foo.k; 12. } 13. } What is the result? A. B. C. D. E. Compilation succeeds. An error at line 2 causes compilation to fail. An error at line 9 cases compilation to fail. An error at line10 causes compilation to fail. An error at line 11 causes compilation to fail.

Answer: A Section: (none) Explanation/Reference:

QUESTION 65 Given: 1.public class Foo { 2. public void main( String[] args ) { 3. System.out.println( "Hello world."); 4. } 5. } What is the result? A. B. C. D. An exception is thrown. The code does not compile. "Hello world." is printed to the terminal. The program exists without printing anything.

Answer: A Section: (none) Explanation/Reference:

QUESTION 66 Which statement is true? A. B. C. D. The Error class is a RuntimeException. No exceptions are subclasses of Error. Any statement that may throw an Error must be enclosed in a try block. Any statement that may throw an Exception must be enclosed in a try block.

E. Any statement that may throw a RuntimeException must be enclosed in a try block. Answer: B Section: (none) Explanation/Reference:

QUESTION 67 Given: 1. import java.io.IOException; 2. public class ExceptionTest { 3. public static void main(String[] args) { 4. try { 5. methodA(); 6. } catch (IOException e) { 7. System.out.println("Caught IOException"); 8. } catch (Exception e) { 9. System.out.println("Caught Exception"); 10. } 11. } 12. public void methodA(){ 13. throw new IOException(); 14. } 15. } What is the result? A. B. C. D. The code will not complete. The output is Caught Exception. The output is Caught IOException. The program executes normally without printing a message.

Answer: A Section: (none) Explanation/Reference:

QUESTION 68 Given: 1. int i = 1,j = 10 2. do { 3. if (i>j) continue; 4. j--; 5. }while(++i<6); After execution, what are the values for i and j? A. B. C. D. E. i = 6 and j = 5 i = 5 and j = 5 i = 6 and j = 4 i = 5 and j = 6 i = 6 and j = 6

Answer: A Section: (none) Explanation/Reference:

QUESTION 69 Given: 1. public class SwitchTest { 2. public static void main(String[] args) { 3. System.out.println("value = "+ switchlt(4)); 4. } 5. public static int switchlt(int x) { 6. int j = 1; 7. switch (x) { 8. case 1: j++; 9. case 2: j++; 10. case 3: j++; 11. case 4: j++; 12. case 5: j++; 13. default: j++; 14. } 15. return j + x; 16. } 17. } What is the output from line 3? A. B. C. D. E. F. value = 3 value = 4 value = 5 value = 6 value = 7 value = 8

Answer: F Section: (none) Explanation/Reference:

QUESTION 70 Given: 1. class Super { 2. public Integer GetLenght() { return new Integer(4); } 3. } 4. 5. public class Sub extends Super { 6. public Long getLenght() { return new Long(5); } 7. 8. public static void main(String[] args) { 9. Super sooper = new Super(); 10. Sub sub = new Sub(); 11. System.out.println( 12. sooper.getLenght().toString()+","+

13. sub.getLenght().toString()); 14. } 15. } What is the output? A. B. C. D. E. 4,4 4,5 5,4 5,5 The code will not compile.

Answer: E Section: (none) Explanation/Reference:

QUESTION 71 Given: 1. public class Test { 2. public static void add3(Integer i) { 3. int val = i.intValue(); 4. val +=3; 5. i = new Integer(val); 6. } 7. 8. public static void main(String args[]) { 9. Integer i = new Integer(0); 10. add3(i); 11. System.out.println(i.intValue()); 12. } 13. } What is the result? A. B. C. D. Compilation will fail. The program prints "0". The program prints "3". Compilation will succeed but an exception will be thrown at line 3.

Answer: B Section: (none) Explanation/Reference:

QUESTION 72 Given: 1. public class Foo { 2. public static void main(String[] args) { 3. int i = 1; 4. init j = i++; 5. if ((i == ++j) | (i++ ==j)) { 6. i+=j;

7. } 8. } 9. } What is the final value of i? A. B. C. D. E. 1 2 3 4 5

Answer: E Section: (none) Explanation/Reference:

QUESTION 73 Which two are equivalent? (Choose two) A. B. C. D. E. F. 16 > 4 16 / 2 16 * 4 16 >> 2 16 / 22 16 >>> 2

Answer: DF Section: (none) Explanation/Reference:

QUESTION 74 What is the numerical range of a char? A. B. C. D. E. 0 ... 32767 0 ... 65535 -256 ... 255 -32768 ... 32767 Range is platform dependent.

Answer: B Section: (none) Explanation/Reference:

QUESTION 75 Given: 1. int index = 1;

2. String[] test = new String[3]; 3. String foo = test[index]; What is the result? A. B. C. D. foo has the value "". foo has the value null. An exception is thrown. The code will not compile.

Answer: B Section: (none) Explanation/Reference:

QUESTION 76 Given: 1. public class Test { 2. public static void main( String[] args ) { 3. String foo = args[0]; 4. String bar = args[0]; 5. String baz = args[2]; 6. } 7. } And command line invocation: java Test red green blue What is the result? A. B. C. D. E. F. G. baz has the value of "" baz has the value of null. baz has the value of "red". baz has the value of "blue". baz has the value of "green". The code does not compile. The program throws an exception.

Answer: D Section: (none) Explanation/Reference:

QUESTION 77 Which will declare a method that is available to all members of the same package and can be referenced without any class? A. B. C. D. E. abstract public void methoda(); public abstract double methoda(); static void methoda(double d1) {} public native double methoda() {} protected void methoda(double d1) {}

Answer: C Section: (none) Explanation/Reference:

QUESTION 78 Given: 1. package foo; 2. 3. import java.util.Vector; 4. 5. protected class MyVector extends Vector { 6. int i = 1; 7. public MyVector() { 8. i = 2; 9. } 10. } 11. 12. public class MyNewVector extends MyVector { 13. public MyNewVector() { 14. i = 4; 15. } 16. public static void main(String args[]) { 17. MyVector v = new MyNewVector(); 18. } 19. } The file MyNewVector.java is shown in the exhibit. What is the result? A. B. C. D. E. Compilation will succeed. Compilation will fail at line 5. Compilation will fail at line 6. Compilation will fail at line 14. Compilation will fail at line 17.

Answer: B Section: (none) Explanation/Reference:

QUESTION 79 Which four types of objects can be thrown using the throw statement? (Choose four) A. B. C. D. E. F. Error Event Object Exception Throwable RuntimeException

Answer: ADEF Section: (none) Explanation/Reference:

QUESTION 80 Given: 1. public class ForBar { 2. public class void main(String[] args) { 3. int i = 0,j = 5; 4. tp: for(;;) { 5. i++; 6. for(;;) 7. if (i>--j) break tp; 8. } 9. System.out.println("i="+i+",j="+j); 10. } 11. } What is the result? A. B. C. D. E. F. The program runs and prints "i=1, j=0". The program runs and prints "i=1, j=4". The program runs and prints "i=3, j=4". The program runs and prints "i=3, j=0". An error at line 4 caused compilation to fail. An error at line 7 caused compilation to fail.

Answer: A Section: (none) Explanation/Reference:

QUESTION 81 Given: 1. public class Test { 2. public static main(String args[]){ 3. int i=0; 4. while(1) { 5. if(i==4) { 6. break; 7. } 8. ++i; 9. } 10. 11. } 12. } What is the value of i at line 10? A. 0 B. 3

C. 4 D. 5 E. The code will not compile. Answer: E Section: (none) Explanation/Reference:

QUESTION 82 Given: 1. switch(i) { 2. default: 3. System.out.prinln("Hello"); 4. } What are the two acceptable types for the variable i? (Choose two) A. B. C. D. E. char byte float double Object

Answer: AB Section: (none) Explanation/Reference:

QUESTION 83 Given: 1. public class X { 2. public static void main(String [] args) { 3. String s = new String("Hello"); 4. modify(s); 5. System.out.println(s); 6. } 7. 8. public static void modify(String s) { 9. s+="world!"; 10. } 11. } What is the result? A. B. C. D. The program runs and prints "Hello". An error causes compilation to fail. The program runs and prints "Hello world!" The program runs but aborts with an exception.

Answer: A Section: (none)

Explanation/Reference:

QUESTION 84 Given: 1. public class X { 2. public static void main(String [] args) { 3. String s1 = new String("true"); 4. Boolean b1 = new Boolean(true); 5. if (s1.equals(b1)) { 6. System.out.println("Equal"); 7. } 8. } 9. } What is the result? A. B. C. D. The program runs and prints nothing. The program runs and prints "Equal". An error at line 5 causes compilation to fail. The program runs but aborts with an exception.

Answer: A Section: (none) Explanation/Reference:

QUESTION 85 Given: 1. public class X { 2. public static void main(String[] args) { 3. byte b = 127; 4. byte c = 126; 5. byte d = b + c; 6. } 7. } Which statement is true? A. B. C. D. E. Compilation succeeds and d takes the value 253. Line 5 contains an error that prevents compilation. Line 5 throws an exception indicating "out of range". Lines 3 and 4 contains errors that prevent compilation. The compilation succeeds and d takes the value of 1.

Answer: B Section: (none) Explanation/Reference:

QUESTION 86 Given:

1. public class Test { 2. public static void main( String[] args ) { 3. unsigned byte b = 0; 4. b--; 5. 6. } 7. } What is the value of b at line 5? A. B. C. D. -1 255 Compilation will fail. Compilation will succeed but the program will throw an exception at line 4.

Answer: DC Section: (none) Explanation/Reference: Note on C: The compilation fails on line 3. Unsigned is not for Java.

QUESTION 87 Given: 1. public class Foo { 2. static String s; 3. public static void main(String[] args) { 4. System.out.println( "s="+s ); 5. } 6. } What is the result? A. B. C. D. E. The code compiles and "s=" is printed. The code compiles and "s=null" is printed. The code does not compile because String s is not initialized. The code does not compile because String s cannot be referenced. The code compiles, but a NullPointerException is thrown when toString is called.

Answer: B Section: (none) Explanation/Reference:

QUESTION 88 Given: 1. public interface Foo { 2. int k = 4: 3. } Which three are equivalent to line 2? (Choose three) A. B. C. D. final int k = 4: public int k = 4; static int k = 4; private int k = 4:

E. abstract int k = 4; F. volatile int k = 4: G. transient int k = 4; Answer: ABC Section: (none) Explanation/Reference:

QUESTION 89 Given: 1. public class ExceptionTest { 2. class TestException extends Exception {} 3. public void runTest() throws TestException {} 4. public void test()/* Point X */{ 5. runTest(); 6. } 7. } At Point X on line4, which code can be added to make the code compile? A. B. C. D. E. throws Exception catch ( Exception e ) throws RuntimeException catch ( TestException e) No code is necessary.

Answer: A Section: (none) Explanation/Reference:

QUESTION 90 Given: 1. int i = 1,j = 10; 2. do { 3. if(i++>) continue; 4. } while (i<5); After execution, what are the values for i and j? A. B. C. D. E. i = 6 and j = 5 i = 5 and j = 5 i = 6 and j = 4 i = 5 and j = 6 i = 6 and j = 6

Answer: D Section: (none) Explanation/Reference:

QUESTION 91 Given: 1. switch(i) { 2. default: 3. System.out.println("Hello"); 4. } What is the acceptable type for the variable i? A. B. C. D. E. F. G. byte long float double Object A and B C and D

Answer: A Section: (none) Explanation/Reference:

QUESTION 92 Given: 1. public class X { 2. private static int a; 3. 4. public static void main(String [] args) { 5. modify(a); 6. System.out.println(a); 7. } 8. 9. public static void modify(int a) { 10. a++; 11. } 12. } What is the result? A. B. C. D. E. The program runs and prints "0". The program runs and prints "1". The program runs but aborts with an exception. An error "possible undefined variable" at line 5 causes compilation to fail. An error "possible undefined variable" at line 10 causes compilation to fail.

Answer: A Section: (none) Explanation/Reference:

QUESTION 93 Given: 1. public class Foo { 2. private int val; 3. public Foo(int v) { val = v; } 4. public static void main( String[] args ) { 5. Foo a = new Foo(10); 6. Foo b = new Foo(10); 7. Foo c = a; 8. int d = 10; 9. double e = 10.0; 10. } 11. } Which three logical expressions evaluate to true? (Choose three) A. B. C. D. E. F. (a == c) (d == e) (b == d) (a == b) (b == c) (d == 10.0)

Answer: ABF Section: (none) Explanation/Reference:

QUESTION 94 Which two are valid declarations of a char? (Choose two) A. B. C. D. E. F. G. char ch = "a"; char ch = '\"; char ch = 'cage'; char ch = "cafe; char ch = '\ucafe'; char ch = '\u10100'; char ch = (char)true;

Answer: BE Section: (none) Explanation/Reference:

QUESTION 95 Which two are reserved words in Java? (Choose two) A. run B. import C. default

D. implement Answer: BC Section: (none) Explanation/Reference:

QUESTION 96 1. // Point X 2. public class Foo { 3. public static void main(String[] args) throws Exception { 4. PrintWriter out = new PrintWriter(new 5. java.io.OutStreamWriter(System.out), true); 6. out.println("Hello"); 7. } 8. } Which statement at Point X on line 1 allows this code to compile and run? A. B. C. D. E. import java.io.PrintWriter; include java.io.PrintWriter; import java.io.OutputStreamWriter; include java.io.OutStreamWriter No statement is needed.

Answer: A Section: (none) Explanation/Reference:

QUESTION 97 Given: 1. package foo; 2. 3. import java.util.Vector; 4. 5. private class MyVector extends Vector { 6. int i = 1; 7. public MyVector() { 8. i = 2; 9. } 10. } 11. 12. public class MyNewVector extends MyVector { 13. public MyNewVector() { 14. i = 4; 15. } 16. public static void main(String args[]) { 17. My Vector v = new MyNewVector(); 18. } 19. } The file MyNewVector.java is shown in the exhibit.

What is the result? A. B. C. D. E. Compilation will succeed. Compilation will fail at line 5. Compilation will fail at line 6. Compilation will fail at line 14. Compilation will fail at line 17.

Answer: B Section: (none) Explanation/Reference:

QUESTION 98 Given: 1. public class Foo { 2. public static void main(String[] args) { 3. try { return; } 4. finally { System.out.println( "Finally" ); } 5. } 6. } What is the result? A. B. C. D. The program runs and prints nothing. The program runs and prints "Finally". The code compiles, but an exception is thrown at runtime. The code will not complete because the catch block is missing.

Answer: B Section: (none) Explanation/Reference:

QUESTION 99 Given: 3. int i =1,j = 10; 4. do { 5. if(i>j) 6. break; 7. j--; 8. } while (++i<5); After execution, what are the values for i and j? A. B. C. D. E. i = 6 and j = 5 i = 5 and j = 5 i = 6 and j = 4 i = 5 and j = 6 i = 6 and j = 6

Answer: D Section: (none) Explanation/Reference:

QUESTION 100 Given: 1. class Super { 2. public int getLenght() { return 4; } 3. } 4. 5. public class Sub extends Super { 6. public long getLenght() { return 5; } 7. 8. public static void main(String[] args) { 9. Super sooper = new Super(); 10. Sub sub = new Sub(); 11. System.out.println( 12. sooper.getLenght()+","+ sub.getLenght()); 13. } 14. } What is the output? A. B. C. D. E. 4,4 4,5 5,4 5,5 The code will not compile.

Answer: E Section: (none) Explanation/Reference:

QUESTION 101 Given: 1. public class Foo { 2. public static void main(String[] args) { 3. int i = 1; 4. int j = i++; 5. if ((I > ++j) && (i++ ==j)) { 6. i +=j; 7. } 8. } 9. } What is the final value of i? A. 1 B. 2 C. 3

D. 4 E. 5 Answer: B Section: (none) Explanation/Reference:

QUESTION 102 Which three are valid declarations of a float? (Choose three) G. float foo = -1; H. float foo = 1.0; I. float foo = 42e1; J. float foo = 2.02f; K. float foo = 3.03d; L. float foo = 0x0123; A. B. C. D. Answer: Section: (none) Explanation/Reference:

QUESTION 103 Given: 1. public class Test { 2. public static void main( String[] args ) { 3. String foo = args[1]; 4. String bar = args[2]; 5. String baz = args[3]; 6. System.out.println( "baz = " + baz ); 7. } 8. } And the output: baz = 2 Which command line invocation will produce the output? A. B. C. D. java Test 2222 java Test 1 2 3 4 java Test 4 2 4 2 java Test 4321

Answer: C Section: (none) Explanation/Reference:

QUESTION 104 Which two method declarations are valid for an interface? (Choose two) A. B. C. D. E. public double methoda(); static void methoda(double d1); public final double methoda(); abstract public void methoda(); protected void methoda(double d1);

Answer: AD Section: (none) Explanation/Reference:

QUESTION 105 Given: 1. public class Foo { 2. public static void(String[] args) { 3. try { System.exit(0); } 4. finally { System.out.println( "Finally" ); } 5. } 6. } What is the result? A. B. C. D. The program runs and prints nothing. The program runs and prints "Finally". The code compiles, but can exception is thrown at runetime. The code will not compile because the catch block is missing.

Answer: A Section: (none) Explanation/Reference:

QUESTION 106 Given: 1. public class IfTest { 2. public static void main(String[] args) { 3. int x = 3; 4. int y = 1; 5. if (x = y) 6. System.out.println("Not equal"); 7. else 8. System.out.println("Equal"); 9. } 10. } What is the result?

A. B. C. D.

The output is "Equal". The output is "Not equal". An error at line 5 causes compilation to fail. The program executes but does not print a message.

Answer: C Section: (none) Explanation/Reference:

QUESTION 107 Given: 1. public class Test { 2. private static int j = 0; 3. 4. public static boolean methodB(int k) { 5. j += k; 6. return true; 7. } 8. 9. public static void methodA(int i) { 10. boolean b; 11. b = i < 10 | methodB(4); 12. b = i < 10 || methodB(8); 13. } 14. 15. public static void main(String args[]) { 16. methodA(0); 17. System.out.println(j); 18. } 19. } What is the result? A. B. C. D. E. The program prints "0". The program prints "4". The program prints "8". The program prints "12". The code does not compile.

Answer: B Section: (none) Explanation/Reference:

QUESTION 108 Given: 1. int index = 1 2. boolean[] test = new boolean[3]; 3. boolean foo = test[index]; What is the result?

A. B. C. D. E. F.

foo has the value of 0. foo has the value of null. foo has the value of true. foo has the value of false. An exception is thrown. The code will not compile.

Answer: D Section: (none) Explanation/Reference:

QUESTION 109 Given: 1. public class X { 2. public Object m() { 3. Object o = new Float(3.14F); 4. Object [] oa = new Object[1]; 5. oa[0] = o; 6. o = null; 7. return oa[0]; 8. } 9. } When is the Float object, created in line 3, eligible for garbage collection? A. B. C. D. Just after line 5. Just after line 6. Just after line 7 (that is, as the method returns) Never in this method.

Answer: D Section: (none) Explanation/Reference:

QUESTION 110 Given: 1. int i = 1,j=0; 2. 3. switch(i) { 4. case 2: 5. j+=6; 6. 7. case 4: 8. j+=1; 9. 10. default: 11. j+=2; 12. 13. case 0: 14. j+=4;

15. } 16. What is the value of j at line 16? A. B. C. D. E. 0 2 3 4 6

Answer: E Section: (none) Explanation/Reference:

QUESTION 111 You are designing a container class that will allow flexible storage of objects and access to those objects, specifically for sorting and traversing large data sets. Which two statements must be true to allow the storage mechanisms to be placed without impacting the interface of the class? (Choose two) A. B. C. D. All accessor methods must be static. The storage mechanism must be private to the container class. The storage mechanism can be modified by a class in the same package. The objects stored in the container class can only be accessed using accessor methods.

Answer: BD Section: (none) Explanation/Reference:

QUESTION 112 1. public class Test { 2. public static void main(String args[]) { 3. int i = 0xFFFFFFF1; 4. int j = ~i; 5. 6. } 7. } What is the decimal value of j at line 5? A. B. C. D. E. F. 0 1 14 -15 An error at line 3 causes compilation to fail. An error at line 4 causes compilation to fail.

Answer: C

Section: (none) Explanation/Reference:

QUESTION 113 Given: 1. public class Foo { 2. public static void main(String[] args) { 3. String s; 4. System 5. } 6. } What is the result? A. B. C. D. E. The code compiles and "s=" is printed. The code compiles and "s=null" is printed. The code does not compile because String s is not initialized. The code does not compile because String s cannot be referenced. The code compiles, but a NullPointerException is thrown when toString is called.

Answer: C Section: (none) Explanation/Reference:

QUESTION 114 Given: 1. public class WhileFoo { 2. public static void main(String[] args) { 3. int x = 1,y = 6; 4. while (y--) {x++;) 5. System.out.println("x="+x+"y="xy); 6. } 7. } What is the result? A. B. C. D. E. The output is x = 6 y = 0. The output is x = 7 y = 0. The output is x = 6 y = -1. The output is x = 7 y = -1. Compilation fail.

Answer: E Section: (none) Explanation/Reference:

QUESTION 115

The current architecture has servlets making calls to EJB. The system has grown to over 200 servlets causing development and configuration problems. Because the system is still evolving, the APIs to the EJB have changed quite often. This has caused the servlet writers to adapt the new APIs every time a change is made. Which two statements about this problem are true? (Choose two) A. B. C. D. E. Introducing a configuration control system will fix the problem. This is an example of brittle code dependencies and tight coupling. This problem can be corrected by converting all entity EJB to stateless session EJB. Introducing a client-side abstraction which sits between the servlet and FJB will break the tight coupling. Having the servlets communicate with EJB using JMS will prevent changing servlet code every time an EJB API changes. F. Introducing a session bean, in front of all EJB, which mimics the EJB APIs will prevent changing servlet code every time an EJB API changes. Answer: BD Section: (none) Explanation/Reference:

QUESTION 116 Given: 1. int index = 1; 2. int[] foo = new int[3]; 3. int bar = foo[index]; 4. int baz = bar + index; What is the result? A. B. C. D. E. baz has the value of 0. baz has the value of 1. baz has the value of 2. An exception is thrown. The code will not compile.

Answer: B Section: (none) Explanation/Reference:

QUESTION 117 Given: 1. public interface Foo { 2. int k = 4: 3. } Which three are equivalent to line 2? (Choose three) A. B. C. D. final int k = 4: public int k = 4; static int k = 4; private int k = 4:

E. abstract int k = 4; F. volatile int k = 4: G. transient int k = 4; Answer: ABC Section: (none) Explanation/Reference:

QUESTION 118 Given: 1. public class X { 2. public Object m() { 3. Object o = new Float(3.14F); 4. Object [] oa = new Object[1]; 5. oa[0] = o; 6. o = null; 7. oa[0] = null; 8. return o; 9. } 10. } When is the Float object, created in line 3, eligible for garbage collection? A. B. C. D. Just after line 5. Just after line 6. Just after line 7. Just after line 8 (that is, as the method returns)

Answer: C Section: (none) Explanation/Reference:

QUESTION 119 Given: 1. class Super { 2. public float getNum() { return 3.of; } 3. ] 4. 5. public class Sub extends Super { 6. 7. } Which method, places at line 6, will cause a compiler error? A. B. C. D. public float getNum() { return 4.0f; } public void getNum() {} public void getNum(double d) {} public double getNum(float d) { return 4.0d; }

Answer: B

Section: (none) Explanation/Reference:

QUESTION 120 Exhibit: 1. public class Test { 2. public static String output = ""; 3. 4. public static void foo(int i) { 5. try { 6. if(I == 1) { 7. throw new Exception(); 8. } 9. output += "1"; 10. } 11. catch(Exception e) { 12. output += "2"; 13. return; 14. } 15. finally { 16. output += "3"; 17. } 18. output += "4"; 19. } 20. 21. public static void main(String args[]) { 22. foo(0); 23. foo(1); 24. 25. } 26. } What is the value of the variable output at line 24? A. B. C. D. Answer: Section: (none) Explanation/Reference:

QUESTION 121 Which will declare a method that forces a subclass to implement it? A. B. C. D. public double methoda(); static void methoda(double d1) {} public native double methoda(); abstract public void methoda();

E. protected void methoda(double d1){} Answer: D Section: (none) Explanation/Reference:

QUESTION 122 Given: 1. public class Test { 2. public static void main(String args[]) { 3. System.out.println(6 3); 4. } 5. } What is the output? A. B. C. D. Answer: Section: (none) Explanation/Reference:

QUESTION 123 What increase software maintainability? (Choose two) A. B. C. D. Code reuse Data sharing High coupling Code factoring

Answer: AD Section: (none) Explanation/Reference:

QUESTION 124 The requirements for an online shopping application are: 1 It must support millions of customers. 2 The invocation must be transactional. 3 The shopping cart must be persistent. Which technology is required to support these requirements? A. JNI

B. JMS C. EJB D. JMX Answer: C Section: (none) Explanation/Reference:

QUESTION 125 Given: 1. public interface Foo { 2. int k = 4: 3. } Which three are equivalent to line 2? (Choose three) A. B. C. D. E. F. G. final int k = 4: public int k = 4; static int k = 4; private int k = 4: abstract int k = 4; volatile int k = 4: transient int k = 4;

Answer: ABC Section: (none) Explanation/Reference:

QUESTION 126 Exhibit: 1. public class Test { 2. public static String output = ""; 3. 4. public static void foo(int i) { 5. try { 6. if(I == 1) { 7. throw new Exception(); 8. } 9. output += "1"; 10. } 11. catch(Exception e) { 12. output += "2"; 13. return; 14. } 15. finally { 16. output += "3"; 17. } 18. output += "4"; 19. }

20. 21. public static void main(String args[]) { 22. foo(0); 23. foo(1); 24. 25. } 26. } What is the value of the variable output at line 24? A. B. C. D. Answer: Section: (none) Explanation/Reference:

QUESTION 127 Your supply chain software currently runs a standalone application which communicates to the backend services using IIOP. The new requirements for the software are: * The client software must run as an applet. * The user's firewall will only allow port 80 and 443 traffic through its firewall. * All the backend services will be CORBA-based. * A Web server sits in front of the COBRA services. * The backend Web server runs on port 80 and 443. Which two solutions support the new requirements? (Choose two) A. You convert the application to an applet and use IIOP to communicate with the backend services. B. You convert the application to an applet running outside the browser and send XML through port 443. C. You convert the application to an applet and use IIOP tunneled through HTTP to communicate with the backend services. D. You convert the application to an applet and use HTTPS to communicate with a servlet which communicates with the backend services using IIOP. Answer: CD Section: (none) Explanation/Reference:

QUESTION 128 Exhibit:

The exhibit shows the communication between four EJBs. Which two changes to the existing architecture will increase performance? (Choose two) A. B. C. D. Convert all entity beans to stateless session beans. Use bean-managed persistence for each entity bean. Have Customer call Account, Order, and ShoppingCart directly. Have each EJB hold a reference to the EJB it calls, instead of calling findByPrimaryKey().

Answer: CD Section: (none) Explanation/Reference:

QUESTION 129 Exhibit:

Which diagram in the exhibit reflects the relationship: "A is associated with zero, one or more Bs"? A. A B. B

C. D. E. F.

C D E F

Answer: D Section: (none) Explanation/Reference:

QUESTION 130 Which statement about passivating session beans is true? A. The passivated stateful session bean should close all connections before being passivated. B. The passivated stateless session bean should close all connections before being passivated. C. The container ensures that the passivated bean's open connections are closed or returned to the connection pool. D. The container ensures that the passivated stateless session bean is reassigned to the remote object upon activation. Answer: A Section: (none) Explanation/Reference:

QUESTION 131 Which will declare a method that is available to all members of the same package and can be referenced without any class? A. B. C. D. E. abstract public void methoda(); public abstract double methoda(); static void methoda(double d1) {} public native double methoda() {} protected void methoda(double d1) {}

Answer: C Section: (none) Explanation/Reference:

QUESTION 132 Given: 1. switch(i) { 2. default: 3. System.out.prinln("Hello"); 4. } What are the two acceptable types for the variable i? (Choose two)

A. B. C. D. E.

char byte float double Object

Answer: AB Section: (none) Explanation/Reference:

QUESTION 133 Given: 1. int i = 1,j = 10; 2. do { 3. if(i++>) continue; 4. } while (i<5); After execution, what are the values for i and j? A. B. C. D. E. i = 6 and j = 5 i = 5 and j = 5 i = 6 and j = 4 i = 5 and j = 6 i = 6 and j = 6

Answer: D Section: (none) Explanation/Reference:

QUESTION 134 Exhibit:

The exhibit shows the communication between four EJBs. Which change to the existing architecture helps increase performance?

A. B. C. D.

Convert all entity beans to stateful session beans. Convert all entity beans to stateless session beans. Use bean-managed persistence for each entity bean. Have each EJB hold a reference to the EJB it calls, instead of calling findByPrimaryKey().

Answer: D Section: (none) Explanation/Reference:

QUESTION 135 You are in the process of migrating your existing system to a new architecture to support your growing user base. The current system consists of: * Browser-based HTML./JavaScript UI. * One Web server instance. * One J2EE application server instance. * A database The new architecture has the following requirements: * Browser-based HTML./JavaScript UI. * Cluster of Web servers. * Cluster of J2EE application servers. * A database. Which two statements are true? (Choose two) A. B. C. D. Clustering increases scalability. Clustering impacts availability, not scalability. DNS round-robin can be used to load-balance the Web servers. Clustering the application servers provides automatic EJB fault-tolerance.

Answer: AC Section: (none) Explanation/Reference:

QUESTION 136 Which two statements are true about management of an EJB's resources? (Choose two) A. The reference to the remote object is obtained through JNDI to improve maintainability and flexibility. B. The reference to home object is obtained through JNDI to improve maintainability and flexibility. C. The EJB container can manage the instance's access to its resources because the home object acts as a proxy. D. The EJB container can manage the instance's access to its resourced because the remote object acts as a proxy. Answer: BD Section: (none) Explanation/Reference:

Potrebbero piacerti anche