Wednesday, September 21, 2011

Selenium 2 or Webdriver for automation of test cases.
======================================
Selenium2 
WebDriver
Page Objects
Test Automation
Java testing automation
Automating Testing.
KEY WORDS: selenium 2 tutorial in java or Web driver tutorial in java or selenium webdriver tutorial

Recently we have automated our application using selenium 2.0 /webdriver and the out come has been very postivie.We have externalized all data that needs to be entered int our app to be read from XLS sheet and using apache POI we are reading this data and drive the application using Selenium 2.0 or Webdriver.

We are very impressed they way selenium has been developed and the ease of use.
The only difficult part was that we have lot of popovers/popups in our application and to get handle on each of these it took a while. Over all its been great.

We are using the Java version of selenium driver.

I am not explaining basic examples instead will share some lessons that we learn when dealing with complex pages , waiting on asynchronous responses, waiting on page loads

(with out hard coding sleep time outs )  and dynamically checking when a page load as completed.

For basic example see the following link .
http://seleniumhq.org/docs/03_webdriver.html

You can execute the same example with Chrome, IE , Firefox or browser less (HTMLUnit Driver). I have tried HTMLUNIT driver and had less luck though  I was able to execute

same test cases using Chrome/IE/Firefox drivers


USING DIFFERENT DRIVERS:
=======================
WebDriver driver = new ChromeDriver();  ====> Chrome
WebDriver driver = new FirefoxDriver();   =====> Fire Fox
WebDriver driver = new InternetExplorerDriver();  ====  IE or Internet Explorer

NOTE: To excuete  on chorme u need to download a plugin from 
ttp://code.google.com/p/chromium/downloads/list
and set the following system property
System.setProperty("webdriver.chrome.driver","drivers\\chromedriver.exe");
(For Fire fox and IE they come with jars)

HTMLUnitDriver  (Will run tests without launching browser by sending HTTP requests)
===========
WebDriver driver = new HtmlUnitDriver(BrowserVersion.INTERNET_EXPLORER_8);
((HtmlUnitDriver)driver).setJavascriptEnabled(true);  ============> If not java script will not be excuted.
driver.manage().timeouts().setScriptTimeout(10,TimeUnit.SECONDS);  ====> any script if it takes more than 10 seconds time out.



you need the following selenium jars  in addition other common jars
selenium-java-2.4.0-srcs.jar
selenium-java-2.4.0.jar

Please download from
http://code.google.com/p/selenium/downloads/list
(Look for selenium-java-2.4.0.zip  or latest version )

Jars I have included in my project :
------------------------------------------------
apache-mime4j-0.6.jar               
cglib-nodep-2.1_3.jar
commons-codec-1.4.jar               
commons-collections-3.2.1.jar
commons-io-1.4.jar                  
commons-lang-2.4.jar
commons-logging-1.1.1.jar           
cssparser-0.9.5.jar
guava-r08.jar                       
hamcrest-all-1.1.jar
htmlunit-2.8.jar                    
htmlunit-core-js-2.8.jar
httpclient-4.0.2.jar                
httpcore-4.0.1.jar
httpmime-4.0.1.jar                  
jna.jar
json-20080701.jar                   
junit-4.9b2-src.jar
junit-4.9b2.jar                    
junit-dep-4.8.1.jar
nekohtml-1.9.14.jar                 
sac-1.3.jar
selenium-java-2.4.0-srcs.jar  <============== Selenium jars     
selenium-java-2.4.0.jar <============== Selenium jars     
serializer-2.7.1.jar                
testng-5.14.1.jar
xalan-2.7.1.jar                     
xercesImpl-2.9.1.jar
xml-apis-1.3.04.jar


PAGE OBJECTS:
=============
They use a design pattern called Page objects in selenium testing. In layman terms as I understand its  java class which represents a particular page in your application.

(More: http://code.google.com/p/selenium/wiki/PageObjects)

Eg: Say you have an html/jsp/JSF page called EmployeeInfo.jsf/EmployeeInfo.jsp/EmployeeInfo.html
and  let says they have the following fields

<html>
    .... //all other html stuff

    //TITLE for the page
    <span id="employementInfoTxt">Employee Information</span>

    <input id="fname"  type="text" />
    <input id="lname"  type="text" />
    <input id="empStatus"  value="Employed" type="checkbox" />
    <input id="nextButton"  type="button" />
</html>

We can have a page object  (a java class or bean which gives an easy way for us to interact with fields in the page )

public class EmploymentInfoPage{

    private WebDriver driver;
      public EmploymentInfoPage( WebDriver driver){
         this.driver = driver;
    }
   
    //<span id="employementInfoTxt">Employee Information</span>
    @FindBy(how = How.ID, using = "employementInfoTxt")
    private WebElement pageTitle;
   
    @FindBy(how = How.ID, using = "fname")
    private WebElement firstName;

    @FindBy(how = How.ID, using = "lname")
    private WebElement lastName;

    @FindBy(how = How.ID, using = "empStatus")
    private WebElement employmentStatus;

    @FindBy(how = How.ID, using = "nextButton")
    private WebElement next;

   
    public void setFirstName(String firstNameStr) {
        //As good as you typing the keys on the text field
        this.firstName.sendKeys(firstNameStr);
    }
   
    public void setLastName(String lastNameAsStr) {
        this.lastName.sendKeys(lastNameAsStr);
    }

    public void setEmploymentStatus() {
        //Say you are employed...so check the check box
        this.employmentStatus.click();
    }
   
    public void clickNext() {
        this.next.click();
    }
}
Look at the WebElement class ( whethere its text or check box or radio button or button all elements are treated as Webelements.
NOTE:
The annotation @FindBy will look for a element and you can specify if the look up should be by ID or Name or LINK_TEXT or Partial link.
These are the options avaliuable on How
public enum How {
  CLASS_NAME,
  CSS,
  ID,
  ID_OR_NAME,
  LINK_TEXT,
  NAME,
  PARTIAL_LINK_TEXT,
  TAG_NAME,
  XPATH,
}



Now You can test your page with the following class.
====================================

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.PageFactory;

public class TestWebDriver {

   
    public static void main(String[] args) {
       
        System.setProperty("webdriver.chrome.driver","drivers\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        //You can point it to a html page o your local as well.
        EmploymentInfoPage empInfoPage = new EmploymentInfoPage(driver);
        driver.get("http://localhost:9080/test/EmployeeInfo.jsf");
        //Load this pageObject with
        PageFactory.initElements(driver,empInfoPage);
       
        //EmploymentInfoPage employmentInfoPage =PageFactory.initElements(this.getDriver(),EmploymentInfoPage.class);
        //WebDriver driver = new FirefoxDriver();
        //WebDriver driver = new InternetExplorerDriver();
        //WebDriver driver = new HtmlUnitDriver(BrowserVersion.INTERNET_EXPLORER_8);
        //((HtmlUnitDriver)driver).setJavascriptEnabled(true);
       
        empInfoPage.setFirstName("Anna");
        empInfoPage.setLastName("Hazare");
        //Checks the check box..
        empInfoPage.setEmploymentStatus();
        //will take you to nect page..
        empInfoPage.clickNext();
    }
}






CASE1 : I have popups how to get handle on them and close
======================================
Solution: Call this method in the Page object which represenst the Main page

private void closePopup(WebDriver driver, int waitTime) {

            //Get handle on main page....
            String mainWindowHandle = driver.getWindowHandle();
            //List all windows           
            Set<String> windowHandles = driver.getWindowHandles();
            System.out.println("Main window:"+ mainWindowHandle);
            for( String window:windowHandles){
                if(mainWindowHandle.compareToIgnoreCase(window) != 0){
                    //Some other window other than main window so it must be pop up
                    System.out.println("Closing window:"+ window);
                    driver.switchTo().window(window).close();
                }
            }
       
        //Switch back to main window and re initialize the values
        driver.switchTo().window(mainWindowHandle);
        //Re load the main page....
        PageFactory.initElements(driver,this);
    }

On the same basis you can even operate on any pop up window.

CASE 2:  I have a I frame in a main page within the ifram they lauch a popup so iframe doesnt have any code but launches a div is opened .
how do I close or have handle on this ( We have Jenia popups in our JSF applications . We used the below approach )
======================================
Solution:

Here is some code snippet where there is popu thats launched through an i frame and our goal is to get handle on the popup and click
the next button on pop up.
protected void clickConfirmationPopup() {
        //We need this for the pop over to appear ( TODO: Can we add some conditional check ???)
        int maxRetries = 5;
        int retryCount = 0;
        while(retryCount < maxRetries){
            try{
                //When the page loads there are frames on the page and for some reason the
                //last frame (that is blank) is getting focus. This call to switch to the default Content
                //is to set the focus back to the main page.
                this.getDriver().switchTo().defaultContent();
                this.getDriver().switchTo().activeElement();
                //Now we should have our control in Iframe
                //System.out.println("PageSource:"+ this.getDriver().getPageSource());
                //Click on pop over button.
                  //
                this.getDriver().findElement(By.id("form1:NextButtonOnPopover")).click();
                //If success lets exit
                break;
            }catch(NoSuchElementException exp){
                retryCount++;
                System.out.println("Failed to find buttont on pop over. " +
                        "May be the pop ovber did not appear in time. Count="+maxRetries);
                System.out.println("====================================");
                //lets try again
                sleep(2000);
                //Lets try again
                if(maxRetries == retryCount){
                    //no more fun to continue again.
                    throw exp;
                }
            }
        }
    }


CASE 3: How to pick a particulare value in a select drop down based on the values of each element (Not dispaly name)
======================================
SOLUTION:
    public void setDropDownValue(WebElement targetElement, String value) {

        List<WebElement> allOptions = targetElement.findElements(By.tagName("option"));
        boolean elementFound = false;

        for (WebElement option : allOptions) {
            //Read the Value attribute for this elemen and see if this what we want   
            if (value.equals(option.getAttribute("value"))) {
                elementFound = true;
                option.click();
                break;
            }
        }

        if (!elementFound) {
            throw new NoSuchElementException("Element: " + targetElement.getTagName() + " value: " + value);
        }
    }


CASE 4 : How to wait for a page to load or how do I know when a page is loaded ?
======================================
SOLUTION:  In the app that i tested we have title page for each page. so when we load each page the page object for that taget page will have String that it will looks for

comparison. But how long to wait to know if the page is loaded. So here is the condition you can use.

Let say you have LoginPage and once you click next on login page you will go to profile page.

//Base class which all pages can use.
abstract Class  BasePage{
   
    private WebDriver driver;
   
    //Max time to wait on page checking the condition
    private static final int DEFAULT_MAX_PAGE_LOAD_SECONDS = 45;
   
    //Check once in every 2 seconds
    private static final int DEFAULT_MILLI_SECONDS_TO_SLEEP_BEFORE_POLLING = 2000;

   
      //Overload in derived class. Tell if there is a some condition
             // that we need to wait for this page.
    abstract public boolean shouldWaitForPageLoad();

    //So what is the condition that needs to be met.
    abstract public boolean isPageLoaded() ;


    public WebDriver getDriver() {
        return driver;
    }

    public void setDriver(WebDriver driver) {
        this.driver = driver;
    }

    protected void waitForCondition(ExpectedCondition<Boolean> expectedCondition) {
        waitForCondition(expectedCondition, DEFAULT_MAX_PAGE_LOAD_SECONDS);
    }

    protected void waitForCondition(ExpectedCondition<Boolean> expectedCondition, int seconds) {
        Wait<WebDriver> w = new WebDriverWait(this.driver, seconds,DEFAULT_MILLI_SECONDS_TO_SLEEP_BEFORE_POLLING);
        w.until(expectedCondition);

    }

    protected void waitForPageLoad() {
        if (shouldWaitForPageLoad()) {
            try {
                PageTransitionExpectedCondition pageTransitionExpectedCondition = new PageTransitionExpectedCondition(this);
                this.waitForCondition(pageTransitionExpectedCondition);
            }
            catch ( Throwable t ) {
                System.out.println("Error Occured during wait:" +t.getCause());
                t.printStackTrace();
            }
        }

    }

}

//Here is the condition checking class
public class PageTransitionExpectedCondition implements ExpectedCondition<Boolean> {

    private Object targetPage = null;
   
    //Are you can use the base class name which all Page object will extend
    //Assuming you have the method isPageLoaded() in the base class and over loaded in sub classes.
    public PageTransitionExpectedCondition( BasePage targetPage) {
        this.targetPage = targetPage;
    }
   
}

//Intentionally left getter and setter out in the code snippet here.
Class LoginPage extends  BasePage {
       
   

    public boolean isPageLoaded() {
    //Ok nothing much here. The first page we are confident will load and
    //We dont want to check any condition. Please next class (ProfilePage)
        return true;
    }
   
    public boolean shouldWaitForPageLoad(){
        //Dont wait for this page as this page has no stuff in it and will load in no time
        return false;
    }


    protected WebElement getNextButton(){
        return this.nextButton;
    }

 //Here we click the next button and wait for profile page to load...So there is no sleep. as such it keeps checking for
             //specified time interval if pga eloads before that it returns..
    public ProfilePage clickNext() {
       
        this.getNextButton().click();

        //Request to Intialize the elements
        ProfilePage profilePage = PageFactory.initElements(this.getDriver(), ProfilePage.class);

        //Call the Wait method thats in base class of every page object   
        profilePage.waitForPageLoad();

        //100% guarnteed your page is loaded here
        return profilePage;
    }

}


//Profile page
Class ProfilePage extends BasePage {
   
    ///This is the title on the page
    private String defaultTitle = "Login Home";
   
    //Element which holds the title on the page
    @FindBy(how = How.ID, using = "form1:financialInfoTxt")
    private WebElement title;

    @FindBy(how = How.ID, using = "form1:nextButton")
    private WebElement nextButton;
   
    public boolean isPageLoaded() {
        boolean isPageLoaded = false;
        isPageLoaded = this.getTitleText().equals(this.getDefaultTitle() );
        return isPageLoaded;
    }

    public boolean shouldWaitForPageLoad(){
        //We need to wait for this page
        return true;
    }

}

So you can apply to each page and when you click on one page and before going to next page you can wait as shown above.


CASE 5:   How do I read a protion of text on a page (eg: I need to get a pin on page which is generated randomly and thats displayed and enter that in another text field)
======================================
Solution :
I have page where the pin number is randomly generated and each time we need to pick the pin and enter in to a text field.
This pin gets generated randomly.

Let Say the Page is Authentication page. Let say it has DIV Section where the pin is displayed and a text field where we need to type the pin thats generate and
then click on the next button.

Class  AuthenticationPage{

    @FindBy(how = How.ID, using = "form1:nextButton")
    private WebElement nextButton;
   
    @FindBy(how = How.ID, using = "securityDiv")
    private WebElement pinHoldingDiv;
   
    //Text field where we need to enter pin
    @FindBy(how = How.ID, using = "form1:authentify:password")
    private WebElement pin;
   

    public String getPin() {
        String pin = null;
        List<WebElement> paragraphs = pinHoldingDiv.findElements(By.tagName("p"));
        for (WebElement paragraph : paragraphs) {
           
            //Ok the Pin is with a paragraph withe text like
            // "Pin:23987 "   
            if (paragraph.getText().startsWith("Pin:") ) {
                //Get the text after String  "Pin:"
                pin = paragraph.getText()..split("Pin:")[0];
                break;
            }
        }
        return pin;
    }

}

Sunday, July 17, 2011

SCEA 5
SCEA 5 part 3 Essay
SCEA 5 part 3 EXAM
Oracle Certified Master PART3 EXAM
Java EE 5 Enterprise Architect PART 3 EXAM
OCMJEA PART 3
OCMJEA 5 PART 3


SCEA 5/
OCMJEA 5
-PART3 - Essay Exam

Earlier we could take part 3 before submitting the part-2 assignment to oracle but now after September 1st 2011 we need to upload part-2 assignment in pearsonvue.com/oracle and then it will allow you to book for part 3 exam.

The part 3 will be based on what you have done in part 2 and why you choose a particular frame work what was the reason etc.
I will list out some topics which if you can correlate to your assignment you will be able to answer most questions in Part3 essay exam.

I personally had prepared notes for each of the questions.
Most importantly make sure you relate this questions to the assignment and ask your self how you have handled in your design.
  1. Why have u chosen framework If any If not why not ?
  2. What technology u have used in presentation and business tier why ?
  3. Set of design patterns on which layer and why ?
  4. Security (network security and application security)
  5. what changes you suggest or how will you handle if the volume increases ?
  6. How you have handled security threats ?
  7. Why you choose EJBS if not why ?
In general prepare for the following.
( I guess I got these below questions from some other blog)
1) How does your design handle Scalability?
2) How does your design handle performance?
3) How does your design handle security?
4) How does your design handle Reliability?
5) How does your design handle Availability?
6) How does your design handle Extensibility?
7) How does your design handle Manageability?
8) How does your design handle Maintainability?

Each of the below question also ask , "Why did you choose?"

1) How does your design support session/state handling?
2) How does your design handle persistence?
3) How does your client tier talk to business tier?
4) How does your design handle Qos 5 Sec in peak time?
5) How does your design handle transactions?
6) How does your design handle authentication and authorization?


I gathered some notes in general for any application which helped a lot. Here are some tips for the above questions.
1) How does your design handle Scalability?
- Scalability by deploying apps on mutiple clusters if Required....??? EXPAND more on this. , The business components and presentation can be deployed on seperate servers if required which supports Scalability.
- Also stateless beans can be more easily load balanced across clusters.
- Use connection pooling for any data base connections to improve Scalability.
- Application is designed to be deployed on mutiple srevers which can be clustered it supports bothe vertical and horizontal scaling.
2) How does your design handle performance?
- One way to improve performance is to reduce the amount of data passed between components. So whereever possible between layers presentation<->business<->Data access layer send or receive only required information and use Data transfer Objects (DTO).
- Use Fast lanereader when browsing the catalog or products as the data is read only and using fast lane reader we can directly access the data using JDBC components.
The improved performance with fast lane reader is due to the fact that the component reads data in a form in which we wnat to use it. Using entity beans will be an over head in such cases.
- Using Service locator to improve performance.Any lookup for remote object (In case if we want to deploy business components on a different server) can be cached and we can eliminate redundant lookups which improves performance.
- If the EJBS are on Same server use Local Interfaces instead of remote interfaces.
- Using Busines Delegate pattern to reduce the number of round trips between presentation and Business logic layer.
- Use connection pooling for any data base connections to improve performance.
- Also the request across server will be evenly distributed by the load balancer to ensure good utilization of resources.

3) How does your design handle security?
- Using HTTPS for all external connections (Explain more)
- The servers itself will be within a DMZ (De militarized Zone)
- For JMs communicataion there are few options.
- Enabling JMS Provider authentication and access control
- JMS Queues and Topics protection, so that the desinations are available for access to privileged applications
- JMS Message-level (Using Encryption and Digital signatures) and Transport-layer security (Using SSL).
These options depends upon JMS provider and not specified by JMS standards.


4) How does your design handle Reliability? (????????????????? correct the numbers here.)
- We have two load balancer so even if one goes down other load balancer can pick and serve the requests.
- If one of the server goes down the loan balancer will ensure the new request will be routed to a server that is running.
- We have total Four clusters on which the application is running and two Hot stand by Databases.
- Session migration will be enabled so that if one server goes down the user will still be able to continue his shopping without any problems as the session will be migrated to the server thats up and running.


5) How does your design handle Availability?
- Application is designed for high avaibility. This is made possible by having two load balancers so that if one goes down the other load balancer will serve the requests/
- We have two clusters each with two nodes and each node can have multiple servers. To start with, each node has one server.
Since Cluster itself is on a seperate physcial machine at any given point of time we will have a server up and running all times even if the physcial machine has issues

6) How does your design handle Extensibility?
- The applicataion is designed with seperation of concerns- Presentation layer, Business layer, Data access layer.
Each layer is loosely coupled with each other with good usage of design patterns, interfaces and best practices of Object oriented design like encapsulation, inheritance.
So any change to sub systems will have less impact on systems which are using it as long the interfaces remain same. Even if there are changes the impact will be minimal for adpating new changes.


7) How does your design handle Manageability?
- Since application uses J2ee we can pluging in any JMX based tools for application and network management and monitoring. In addition we can also have good logging mechanism to indicate any Fatal or Error conditions.
Using JMX we can also trun on different logging levels at run time if required. (Eg: Say if there is some error that happens only in production we can trun on debug levels for a while using JMX modules)

8) How does your design handle Maintainability?
- Due to the layered architecrture each layer address a particular need so any enhancement can be made easily. Also each layer is loosely coupled with best deisgn practices which makes understanding functionality and making changes easier.
This can also be supported with good documentation of the application (Architecture diagrams, Interface agreements with extenal systems, Class diagrams, Sequence diagrams, Java doc etc)


1) How does your design support session/state handling?
- For maintaining the shopping cart application uses stateful session bean.

2) How does your design handle persistence?
- Using JPA and Entity Beans. The access is through Data Access Object (DAO).

3) How does your client tier talk to business tier?
- The presentation tier call's Business Facade <--> Business Delegate <---> DAO. The business facade is used to make sure there is less coupling between
presentation and business layer.The business delegate uses Service locator for invoking any EJB (RMI/IIOP) and DAO's.

4) How does your design handle Qos 5 Sec in peak time?


5) How does your design handle transactions?
- Using EJBs CMT through JPA.

6) How does your design handle authentication and authorization?
- When user completes his shopping we can give a provision to check out as guest or the user can create a profile in which case the the future logins will involve FORM based authentication mechanism.
- For internal users who maintian the applicataion in production, run reports for future projections or analysis etc we have LDAP based authentication mechanism.Here users can be put to different roles
so that not every internal user is authorized to run reports or view some critical data (eg: related to orders placed and payment relatred data)



NOTE/WARNING: After completing part-3 exam I got a message saying completed successfully and that I will get the results in 4-6 weeks with a print out at the exam center. But when I logged into pearson vue account the status for part-3 was showing as error. When I called Pearson initially they said its not an issue but later of my continuous questioning I was informed that the part 3 essay was not uploaded to oracle site due to net work error in Pearson application. Frankly I went though such a pain calling pearson, oracle. Pearson support doesnt have any mail access so the only way is to call them and each time they would tell some story. Finally after 21 days they resolved the problem. (yes it took them 21 days to upload my essay to oracle. I am hoping they have submitted what I have answered and not an empty file).
Hope no one will have this trouble.

Good luck and after September 1st all folks need to take a mandatory Part-4 which is a training from oracle. My personal opinion is it will be to expensive for any one to pay entire certification cost and it may discourage more people. As the Part-4 training I heard is very expensive.

Resources:




SCEA 5/
OCMJEA 5
part 2 assignment or

SCEA 5 part 2 documentation or
Oracle Certified Master or
Java EE 5 Enterprise Architect or
OCMJEA Part2 assign ment or Documentation
OCMJEA 5 Part2 Assigment
Big Smoke Cigar Shop SCEA5 part II Assignment
Big Smoke Cigar Shop OCMJEA 5 part II Assignment

SCEA 5 / OCMJEA 5 PART- 2 Assignment - Designing and Documenting the solution using UML.

Well the assignment I got was designing Big Smokes Cigar Factory.A friend of mine started with class diagrams first and then with component , deployment and Sequence diagram.

I started with Sequence diagram as I felt It would give the list of all possible classes along with there methods. So I drafted these sequence diagrams on paper and then started documenting then with Enterprise Architect tool. Its pretty good. Always import images as .png files as the size is less and clarity is good.
You ca use the java jar command

jar cvf scea-SRxxxxxx.jar index.html part3html

where xxxx is your oracle id and part3html is the sub folder which had all images and remaining html pages.

I Will give you a brief description of Do's and Dont's in each set of diagrams

1. Class Daigram :
  • Don't show any DTO/VO (Data Transfer Objects) as it will pollute your diagram and will divert the digram focus from the actual business problem your are trying to solve. Eg: When I wanted to show payment Information I used paymentInfoDTO which is obvious and also I had an entity bean which was representing PaymentInfo. In this case there is no need to show paymentInfoDTO class but PaymentInfo(@Entity) is a must.
  • I included Business Facades as part of class diagram but not Business Delegate. The reason was most of my methods in Business Facades and Delegates had same names and parameters. (Well you may think then there is no point to include Business Facades as that too may pollute class diagram). But I wanted to highlight the methods so added this.
  • At the top of class diagram I added one controller to indicate front end controller (I did not add any Managed Beans or Backing Beans from JSF Frame work to the Class Diagram)
  • Please make sure your entities all are included and should include all entities as specified in the assignment and feel free to add any entities which you feel are important.Make sure the cardinality is maintained as specified in the assignment. This is very important.
  • In fact I had a separate section to explain the relation ship between entities in the final documentation. (Eg: One Order can have multiple payments. One payment can be made by multiple Credit cards etc)
  • Do not show any DAO'S in class diagram instead put all DAO's and Business Delegates in to component Diagram.
2. Component Diagram:
  • I added UI components and listed the JSF pages in each UI component. Eg: I had Search component and listed the following JSF pages (CategorySearch.xhtml, CategoryResults.xhtml, CiagarProductDetails.xhtml). Similarly I had other UI components like Checkout component, Admin UI component.
  • List all DAOS and any message Driven beans, any webservice components here. (However also mention any integration classes that you need for external systems in class diagram). eg: For payment Web service I had web service helper class called PaymentWebsserviceHelper in class diagram and a Component in called Payment Authorization component in component diagram.
  • List all sub systems at the bottom like - Email server, Ldap server, Database and components representing external APIs (like Merchant Bank, Freight Movers, International Shippers)
  • I had divided entire component diagram in to 3 layers - UI layer, Business Logic Tier and Integration Tier.
3. Deployment Diagram :
  • Show two fire walls - Primary and Back up.
  • Two load balancers
  • Two seperate hard ware device and each device having two clusters (So we can have 4 clusters)
  • Each cluster will have the application deployed. (Show Web container and EJB container in Each cluster) and with in each container show how your war or ear or jar files are deployed. Eg: You can package the WAR file as BIGCigarPresentation.WAR, BigCigInventoryProcessorMDB.JAR - as EJB jar file). So show these deployed artifacts in each container as that helps a lot for the evaluator.
  • Have two hard ware profiles for Databases and have two clusters on each server for Database. So in total you will have 4 instances of DB - 2 primary and 2 as back up.
  • Also explain hardware you want to use for deploying each application (Go to Oracle Website and look for Applicataion and DB hardware servers) . Then explain how memory you need for each applicataion. Start with some assumption like we will process 500 users per day - each user may need around 5mb space on server at run time (Considering thats the amount of data you hold in session bean) and for processing each user server may need another 5mb for book keeping - So in total per user you may need 10 mb.So for 500 users its 10 mb * 500= 5000 Mb or approx 5GB RAM. Since you dont want each server to be overloaded 100% its better you have some buffer and say we can have 8 GB RAM. With this analogy calculate the amount of data you will store in DB each day and how much memory you need for DB storage in a year.
4. Sequence Diagram (The most time consuming )
  • Include any class thats in Class Diagram and component diagram and references to any DTO's that you feel are required to explain a flow.
  • So here you can show any JSF page, Business Delegates, Facades, Entity beans, MDBs' Session beans , Adapters etc
  • Make sure you number each line that you draw (The numbering can be done by the tool which automatically updates the number when we add or remove)
  • Then at the end before final documentation you can explain each diagram by referring these numbers.
TIPS for Part-2 documentation:
I had an index page which had the following details

NAME: RamXXXXXXXXXXX
Prometric Tetsing ID: SRxxxxxx
SCEA Assignment:To Design retail shop for Big Smokes Cigar Shop

1. Back Ground
2. Objective
3. Business Domain Model Interpretation
4. Architecture Overview
5. Design Patterns Used
6. Session Management
7. Security
8. Persistence and Transactions Mechanism
9. Assumptions
10. UML Diagrams
· Class Diagram
· Component Diagram
· Deployment Diagrams
· Sequence Diagrams
10. Top Three Risks and mitigation plan


Now I will give little info about each section (though I am not supposed explain in detail, I wish I could)

Back Ground: Explain what the project is about - Eg Big Smokes Cigar shop is to sell cigars and we need to automate bla bla.

Objective: To Design and represent an online system for Big Smokes using UML Diagrams. Integrate Big Smokes application with third party sub systems ...................etc
The system designed should allow the Customers to
  • Search Catalog
  • Add products to Cart
  • Select shipping method
  • To make payment online and Checkout.
The system designed must meet the following criteria
  • 90% of all transactions to be under 5 seconds and no transaction exceeding 10 seconds.
  • Should support 200 concurrent users
  • 99.99% availability during core working hours.
  • A Minimum of 128 bit encryption for security.
(Basically get information from the Exam objective)

Business Domain Model Interpretation (Explains the multiplicity):
  • 1 customer can have many payments
  • 1 customer can have many orders
  • 1 order has 1 payment
  • ...... and so on......
Architecture Overview:
The proposed solution is based on Java EE 5 technology stack. And explain why you chose j2ee (Becoz of security , Txn management ....etc features)
Then list what frame wrok you are using in each layer (I will mention 3 points here though i had 8-9 bullets in my assignment)
  • EJB 3.0 entity beans and JPA for persistence.
  • JDBC API for connecting to Database
  • Java Mail API for email notification.
  • Then You mention about which layer and what frame work you are using - (hints: JSF, HTTPS, JSSE, etc)

List all design patterns used - like Factory, DTO, DAO etc. I had around 8 design patterns in my assignment
JPA for persistence mechanism and used container managed transactions where ever applicable.
9. Assumptions:
I had around 22 assumptions listed. From the beginning of the project I maintained notes for any assumption that I was making which helped a lot.Also mention any assumption or expectation that you have from the external system
To mention a few
  • The “BigCigFramework” as shown in class diagram will take care of any logging, exception handling, resource injection, authentication, and customer profile maintenance tasks.
  • If a user doesn’t check out and closes the browser the cart will not be saved.
  • The average response time in 99% of cases for Merchant bank payment web service should be within 2 seconds and in 1% of cases cannot be beyond 5 seconds.


Here I added link for each of the UML diagram. I had each diagram in a separate html and some explanation for each diagram.
Here just list out what are the top three problems you can see in the application once its deployed in production and once that problem occurs how you are going to resolve.
An Example:
Risk: Say suppose when a message is dropped in to message queue say the sub system fails to process the message due to database being down in which case we will loose the message.
Mitigation: In case of any exception when a sub system is processing a message and if it cannot complete it should write to a temporary queue. We can monitor the queue depth and alert production support team.
I had identified  4 risks and gave the solution for each to solve. I will given an hint  to find risk in your assignment.Thin on these lines 
- What if sub systems are down ??
- And how do you handle each sub system being down ?? 
-What if  subsytem sends wrong data ?



Monday, July 04, 2011

SCEA 5 Part1 or OCMJEA 5 Questions/Java Enterprise Edition 5 Enterprise Architect Certified Master
Oracle Certified Master Part1/Java EE 5 Enterprise Architect Part1/OCMJEA Part1/


SCEA 5 or OCMJEA 5 Part1 Questions:

I have Around 240 questions which I found it very useful.I found this PDF on net. Please read only at the end once you have completed reading enough stuff as mention in my previous article.At the time of preparation i had noticed one or two answers in this were not correct. I don't remember them in case you notice drop me a message I will correct it in this blog.

Question: 1
What are the three primary roles in a web service interaction? (Choose three.)
A. Broker
B. Facade
C. Provider
D. Decorator
E. Requestor
F. Interceptor
Answer: A, C, E

Question: 2
A stock trading company is writing a new application for stock market forecasting. A significant
portion of the work required by the business logic involves navigating through the persistent
object model. As lead architect on this project, you have chosen JPA over EJB2 entity beans to
implement these persistent objects. You have done this to maximize performance when
navigating through the model. Why does JPA offer better performance for this task?
A. JPA guarantees referential integrity at the object level.
B. JPA allows the application to specify lazy or eager retrievals.
C. JPA simplifies the source code that implements the object model.
D. The guaranteed referential integrity in EJB2 entity beans is expensive.
Answer: B


Question: 3
A developer creates a Java web service to be used by consumers in an SOA. This SOA uses a
UDDI service registry. How can the developer make the new service available to consumers?
A. Deploy to the registry using JAXR
B. Publish to the registry using JAXR
C. Query the registry using JAX-RPC
D. Target the registry using JAX-RPC
Answer: B


Question: 4
With the release of a new product line, there has been a significant increase in the volume of
transactions on your web site. You need to scale your application and manage session failover.
What is the best option for scalability?
A. Add additional web servers and application servers
B. Introduce a High Availability pair and utilize sticky sessions
C. Add additional application servers and implement DNS round robin
D. Add additional application servers and use clustered HttpSession
Answer: D


Question: 5
You are asked to architect an SOA solution that leverages Java web services. The architecture
needs to be flexible and allow for the SOAP 1.1, SOAP 1.2, and REST implementations. Which
Java EE technology should you use?
A. JAXP
B. JAXB
C. JAX-WS
D. JAX-RPC
Answer: C


Question: 6
You are architecting an online ordering application with these requirements:
Users access the system over the Internet using HTML.
An email message is sent to the user confirming the order.
Users must log in and are validated using LDAP.
The product catalog is stored in a relational database.
All orders are logged to the internal fulfillment system.
Orders must not be lost.
Which Java EE technology should be used to send orders to the fulfillment system?
A. JNDI
B. JMS
C. JAX-WS
D. RMI-IIOP
Answer: B


Question: 7
An online sporting goods store's web application uses HTTPSession to store shopping carts.
When the application is initially deployed, the business plan predicts only a few customers will
access the site. Over time, the store projects a steady increase in volume. The deployment plan
calls for a single web container in the initial deployment. As demand increases, the plan calls for
multiple web containers on separate hardware with clustered HTTPSession objects. Which two
principles will help the application meet the requirements and optimize performance? (Choose
two.)
A. The application should store as much as possible in HTTPSession objects.
B. The application should NOT make frequent updates to HTTPSession objects.
C. The application should make coarse-grained updates to HTTPSession objects.
D. The application should create new HTTPSession objects instead of updating existing objects.
Answer: B, C


Question: 8
You are writing a utility that searches for existing web services provided by large companies
through UDDI. Your web site allows the user to input search criteria using event-driven, state
managed GUI screens, performs the search, and displays them in a formatted HTML page.
Which technologies would you use for this application?
A. JSP and JAXB
B. JSF and JAXR
C. JSF and JAX-WS
D. JSP and JAX-WS
Answer: B


Question: 9
A company has a web service that provides the most recent price for stocks, mutual funds, and
commodities. The company has the only web service that allows a person to check prices on all
three financial assets with one call. Its system does not store this information but sends individual
calls to each of the primary vendors for an asset and then aggregates the response to the
requester. The company has committed to support a non-functional requirement (NFR) for
performance that states it must process all requests within three seconds and each of the three
vendors is obligated to support the NFR as dictated by the company. Where, in the message
flow, is it appropriate to measure whether all the NFRs are met?
A. when a request is received and a response is sent to the requester
B. when a request is received, first call to vendor, last response from vendors, response is sent
to a requester
C. when a requester sends a request, the request is received, each call to vendor, each
response from vendor, requester receives response
D. when a request is received, each call to vendor, each response from a vendor, a response is
sent to a requester
Answer: D


Question: 10
A Java web component, EJB component, or another web service can be a client to a web service.
Which Java API can the client use to access the web service through a Service Endpoint
Interface?
A. JAXB
B. JAXR
C. JDBC
D. JAX-WS
Answer: D

Question: 11
Which three are parts of a SOAP message? (Choose three.)
A. SOAP body
B. SOAP endpoint
C. SOAP headers
D. SOAP handlers
E. SOAP attachments
Answer: A, C, E

Question: 12
You are integrating with a single legacy Enterprise Information System. You are interested in the
transaction management capabilities of the Java Connector Architecture. This new system needs
the capability to invoke multiple operations against this single legacy system. These operations
succeed together or fail together as a group. To which minimum level of transaction management
are you going to set your resource adapter?
A. No transaction
B. Local transaction
C. Distributed transaction
D. Container Managed transaction
Answer: B

Question: 13
What is an advantage of XML over HTTP, as compared to SOAP over HTTP, for web services?
A. Guaranteed delivery
B. More security options
C. Smaller message size
D. Strongly typed parameters
Answer: C

Question: 14
An application needs to invoke a service on a remote system over a low latency connection, and
then wait for a response. Which two are best for this type of invocation? (Choose two.)
A. JMS topic
B. JMS queue
C. RMI over IIOP
D. synchronous web service
E. asynchronous web service
Answer: C, D

Question: 15
Your new architecture needs to access the business logic of an Enterprise Information Solution
(EIS). What are three benefits of using the Java Connector Architecture to connect to EIS instead
of implementing a proprietary solution? (Choose three.)
A. Security
B. Performance
C. Loose coupling
D. Connection pooling
E. Common Client Interface
Answer: A, D, E

Question: 16
Your web application requires access to several different services, so you created a Service
Locator class to be used by the UI developers on the team. New services with different interfaces
are occasionally added. Unfortunately, the caching benefits of the Service Locator class are NOT
being realized because a new instance of this class is being created in every backing bean
method that requires a service. Which pattern should you apply to eliminate this problem?
A. Bridge
B. Singleton
C. Prototype
D. Factory Method
E. Business Delegate
Answer: B

Question: 17
What are two benefits of using the Value List Handler pattern? (Choose two.)
A. Improves network performance
B. Facilitates exposing existing services
C. Provides an alternative to potentially inefficient EJB finders
D. Facilitates post-processing across heterogeneous requests
E. Provides a mechanism to support shared elements of composite views
Answer: A, C

Question: 18
What are two capabilities of the Abstract Factory pattern? (Choose two.)
A. Creates whole-part hierarchies
B. Creates families of related objects
C. Enforces dependencies between concrete classes
D. Specifies the types of objects to create using a sample instance
E. Separates the construction of a complex object from its representation
Answer: B, C

Question: 19
A teenage fashion web site, includes a set of pages for displaying and browsing their catalog, as
well as pages for making fashion suggestions that also display tables of catalog entries.
Currently, the JSP code uses scriptlets that perform database SELECT statements and format
the results in HTML tables. You have been hired to help reduce the maintenance overhead when
either the look is modified or the database schema changes. Which two patterns, used together,
do you apply to reduce this maintenance overhead? (Choose two.)
A. View Helper
B. Front Controller
C. Composite View
D. Data Access Object
Answer: A, D

Question: 20
A new security feature has been requested for an existing web application with the following
requirements:
All requests must be logged to a secure database.
Each request must be time-stamped with the start and completion times.
Each request must contain the IP address of the client that made the request.
Which pattern is most applicable for this new feature?
A. Strategy
B. Front Controller
C. Abstract Factory
D. Intercepting Filter
E. Model View Controller
Answer: D

Question: 21
Which two are benefits of using the Intercepting Filter pattern? (Choose two.)
A. Allows the recombination of filters
B. Provides efficient data sharing between filters
C. Facilitates creating a generic command interface
D. Facilitates common processing across heterogeneous requests
E. Helps to minimize coupling between the presentation and business tiers
Answer: A, D

Question: 22
You are building a subsystem that has several complex components, but you want to hide that
complexity from the client code. Which pattern can you apply to hide this complexity?
A. Proxy
B. Bridge
C. Adaptor
D. Facade
E. Decorator
Answer: D

Question: 23
Some media players use a virtual proxy for image loading. What is the benefit of using a virtual
proxy?
A. It controls access to the original object.
B. It defers creation of expensive objects until necessary.
C. It provides a local representation for an object in a different address space.
D. It is a replacement for a bare pointer that performs additional actions when an object is
accessed.
Answer: B

Question: 24
Your company's web site is supported with a cluster of load-balanced web servers and a
database server. To reduce expenses, your company must replace your current cluster of web
servers with a single web server. All servers under consideration have the same specification.
Which three items will be negatively impacted by this re-architecture? (Choose three.)
A. Security
B. Reliability
C. Scalability
D. Availability
E. Manageability
F. Maintainability
Answer: B, C, D

Question: 25
A company manufactures widgets for sale to distributors. Distributors call this company when
they want to order more widgets. The company wants the distributors to send orders using XML
documents over the Internet to reduce the number of data entry personnel needed. It has no
control over the distributor's technologies. The company does not want the orders to impact the
performance of the other users. You have been assigned the task of designing the new API.
Which approach do you take?
A. design the API as a JMS queue
B. design the API as an RMI interface
C. design the API as a synchronous web service
D. design the API as an asynchronous web service
Answer: D

Question: 26
You have been tasked with improving the availability of an existing three-tier application. What is
your first step in evaluating what changes should be made to the architecture to achieve the
goal?
A. Monitor network traffic between tiers
B. Separate presentation from business logic
C. Identify and document all single points of failure
D. Cluster the presentation tier without session replication
Answer: C

Question: 27
Which non-functional requirement is a disadvantage for a two-tier architecture?
A. Security
B. Reliability
C. Availability
D. Manageability
Answer: D

Question: 28
A travel company is designing an application to allow customers to browse for information on any
flights operating domestically and to place new reservations on any of those flights. The company
makes the following assumptions: significant read volume, in terms of operations the customers
will perform significant overlap, in the search criteria of customers simple processing of each
customer browse/update request What advice can you give this company?
A. use a two-tier architecture (rich client directly accessing the database) because running
copies of the business logic in each client provides significant advantages in terms of
processing time per request
B. use a three-tier architecture (thin client -> application server -> database) because executing
business logic remotely on a central location results in better performance per request
C. use a three-tier architecture (thin client -> application server -> database) because the shared
business server allows them to cache information with high likelihood of cache hits, which
reduces the load on the database
D. use a two-tier architecture (rich client directly accessing the database) because each client
can operate on its own business objects, independently of others, which provides significant
advantages from reduced latency due to synchronization
Answer: C

Question: 29
A company provides call center support for corporations world-wide. Each agent in the call center
can be assigned to multiple call center customers. All of the company's customers use Windowsbased
user interfaces and it has just signed a new customer that uses a Java EE backend and
wants a rich interface. The company is developing a user interface for the new customer with the
following requirements: Customer service representatives (CSRs) must be able to work with
minimal training on the application. CSRs must be able to switch between call center systems
quickly. Screens must have a Windows "look and feel." 2000 agents spread across four locations
must be able to use the system. What advice would you give this company on the user interface
(UI)?
A. Write the UI using JSP and JSTL
B. Write the UI using JSPs with embedded scriptlets
C. Write the UI using Ajax, accessing servlets directly
D. Write the UI using Java Swing and distribute using JNLP
Answer: D

Question: 30
A travel company decides to re-architect their two-tier application (where each client ran its own
copy of the application against a shared database) and hires you as their lead architect. You
suggest they re-architect their application as a browser-based, three-tier solution: presentation,
business logic, and persistence. You also suggest they deploy each of the three tiers on its own
computer. Why is the three-tier solution more scalable than the two-tier solution?
A. Every client runs its own GUI application. Clients do not compete for resources for
presentation purposes.
B. Clients share the same business logic tier. Client-specific objects can be stored centrally,
optimizing access.
C. Every client shares the same business logic tier. Each client competes with each other for
resources on that JVM.
D. Clients share the same business logic tier. Duplicate effort can be avoided by sharing
objects, reducing the load on the database.
Answer: D

Question: 31
Which two can be used to maintain conversational state? (Choose two.)
A. Entity beans
B. HTTP session
C. stateful session beans
D. Message-driven beans
E. Stateless session beans
Answer: B, C

Question: 32
You are the architect of a project that will provide an external, low latency, scalable, and highly
available service for handling string translations. Each request consists of a short string ID and a
language key, limited to "EN", "FR", "ES", "DE" and "JP". Each response is a simple unicode
string averaging 256 bytes in size, and there will be no more than 50,000 records for each
language. All the records have already been translated and changes to the records will be rare.
What should you do to ensure that your service will scale and perform well as new clients are
added?
A. Store all the records in an LDAP server and use JNDI to access them from the web tier
B. Deploy a standard 3-tier solution that is supported by a fast and reliable relational database
C. Deploy a single service on many servers in the web tier, each storing all the records in
memory
D. Store all of the records in a network attached file system so they can be served directly from
the file system
Answer: C

Question: 33
You are the architect of a web application that uses JSF as a presentation tier for business
processes coded as stateless session beans. When you add new code to the stateless session
beans to address new accounting requirements, without changing the interface, you discover that
the new business processes are being ignored by some of the JSF components. Which might be
the cause of this problem?
A. The presentation tier is relying on validation logic in the business tier.
B. The browser is caching out-of-date versions of the JSF components.
C. The business processes are not rigorously encapsulated in the session beans.
D. The new session beans have been deployed incorrectly, and proper deployment will resolve
the problem.
Answer: C

Question: 34
You have refactored your legacy Java application into a three-tiered architecture. Your Security
Audit group is concerned that your architecture may be vulnerable to security threats in the
separate tiers. Which two methods can you use to reduce those threats? (Choose two.)
A. Programmatic security in the EJB Entities
B. Intercepting Filters between the view and the controller
C. Intercepting Filters between the controller and the model
D. Role-based security for the EJBs in the deployment descriptor
Answer: B, D
Question: 35































Question: 36
The current architecture of a fashion web site consists of one web server, three application
servers, and a database. You, as the lead architect, recommend adding more web servers. What
are two valid justifications for the new architecture? (Choose two.)
A. New web servers will decrease latency for I/O-bound requests.
B. Adding multiple web servers will have a positive impact on scalability.
C. Adding new web servers will increase the overall availability of the web site.
D. New web servers will increase the number of user accounts that can be supported.
Answer: B, C

Question: 37
Which three statements are true about delegation as an OO design technique? (Choose three.)
A. It is applied to a system only at compile time.
B. It is an essential element of the State pattern.
C. It is an essential element of the Singleton pattern.
D. It allows you to replace inheritance with composition.
E. In Java technology, it is always implemented through the use of generics.
F. It always requires that at least two objects are involved in handling a request.
Answer: B, D, F

Question: 38
Which two statements are true about the Flyweight pattern? (Choose two.)
A. It allows a single instance of a class to virtually represent many instances.
B. When used appropriately it can reduce memory demands on your servers.
C. It allows for many instances of a class to be controlled by a single instance.
D. It allows many tightly related, homogeneous objects to each maintain their own state.
Answer: A, B

Question: 39
Which two techniques can be used to provide polymorphic behavior? (Choose two.)
A. Extending a class and adding a new method
B. Implementing two interfaces in the same class
C. Extending a class and overriding an existing method
D. Implementing an interface with several different classes
Answer: C, D

Question: 40
As a project architect, you are selecting technologies for a complex, n-tier web application's
virtual platform. At this stage in the project, which two technologies should be of primary
consideration? (Choose two.)
A. RMI
B. Linux
C. JDBC
D. Firefox
E. Tomcat
Answer: A, C

Question: 41
A company offers a financial workbench tool that lets users search for a variety of financial
products using an open-ended, variable set of query criteria. The resulting queries can have
widely different structures and use a number of aggregate functions. The actual querying is
performed on the server, so as to take advantage of sophisticated caching technology developed
by the company. The company values ease of development and does not want to see resources
taken away from the company's main specialty, which is financial analysis. Which persistence
technology best supports this company's requirements?
A. JPA
B. JDBC using prepared statements
C. CMP entity bean with DAO pattern
D. BMP entity bean with JDBC layer and DAO pattern
Answer: A

Question: 42
Your company is considering migrating a persistence module implemented using CMP entity
beans to JPA. Which two statements are true? (Choose two.)
A. Each CMP entity bean can be mapped to a single JPA entity class.
B. The client code that accesses the CMP entity beans does not have to change.
C. JPA cannot capture all the kinds of relationships supported by CMP entity beans.
D. The resulting JPA persistence module can be used on both the client and the server.
E. The JNDI name of a JPA entity class can be customized to match that of the corresponding
CMP entity bean.
F. Remote clients of the CMP entity beans must start using web services to access the JPA
entity classes on the server.
Answer: A, D

Question: 43
Which three statements are true about the server programming model for web services in Java
EE? (Choose three.)
A. Stateful session beans can be exposed as web services in the Java EE platform.
B. Stateless session beans can be exposed as web services in the Java EE platform.
C. EJBs that are exposed as web services are considered as normal EJBs by the EJB
container.
D. The Service Endpoint Interface (SEI) must follow the JAX-RPC or JAX-WS rules for WSDL
to-Java mapping.
E. EJBs that are exposed as web services are executed in a restricted sandbox by the EJB
container when compared to an EJB not exposed as a web service.
Answer: B, C, D

Question: 44
A stock company has operations in all major exchanges worldwide. Stockbrokers spend 80
percent of their trading time logged into and using the company's main application -
BuyLowSellHigh. It is redesigning BuyLowSellHigh to use the Java EE platform. Key
requirements are to minimize the size of messages sent between application tiers, and provide a
consistent state mechanism for both Java Swing and HTML-based application clients. Serverside
resources are dedicated to users for the lifetime of their session and the company charges a
premium to its traders to ensure that resources do not need to be pooled or reused. Given these
requirements, what is the best approach to maintaining state in the business logic tier?
A. The HttpSession object accessed from the HttpServletRequest object
B. A handcrafted singleton class accessed by the presentation tier using RMI-IIOP
C. An entity bean acquiring and releasing resources as needed to service requests
D. A stateful session bean created and associated with the client on login until logout, acquiring
and holding all server-side resources needed
Answer: D

Question: 45
Your company is creating a Java EE corporate-wide workflow system in which significant internal
business events are consumed by multiple applications. Due to multi-year development and
deployment plans, many of these applications do not exist yet, even at the design stage. IT has
defined standard data formats for these events in the form of small XML documents. Also, the
rules for how an application filters and processes events are not fixed in advance and can change
over the life of the application. Which combination of technologies is best at distributing and
consuming these events throughout the company?
A. Relational database and JDBC
B. HTTP client library and servlets
C. RMI and stateless session beans
D. JMS topics and message-driven beans
E. JMS queues and message-driven beans
Answer: D

Question: 46
Interceptors provide a way of refactoring code shared by multiple EJB 3 components into a single
unit. This is particularly appealing when the code in question can be described as implementing a
specific aspect, for example, having a well-defined purpose that can be described in a concise
way. Which two actions can be implemented as interceptors? (Choose two.)
A. Logging the IP addresses of all clients of a web application
B. Computing sales tax based on customer ZIP code for a variety of purchase operations
C. Publishing to a JMS topic the arguments to any successful method invocation on an EJB
component
D. Computing a discount percentage based on a customer's profile and the contents of the
customer's shopping cart
E. Logging the identity of any authenticated clients to any of the business methods defined by a
set of EJB components
F. Ensuring that the clients of a web service implemented as a stateless session bean are
authorized to access its operations, based on a WS-Security SOAP message header
Answer: C, E

Question: 47
Your company has supported agile practices and as a policy, all their developers use test-driven
development. Tests are run early and often, starting with the individual developers up to nightly
tests and regularly scheduled durability tests. To make developers more productive in such an
environment, management wants unit tests to run as much as possible outside the container,
without requiring the application to be deployed to an actual server. This would reduce the time
spent waiting for test results. Which components are most thoroughly testable outside a container
without requiring the creation of mock objects?
A. CMP entity bean
B. BMP entity bean using JDBC for persistence
C. Stateless session bean using JPA for persistence
D. Stateless session bean exposing a web service interface
Answer: C

Question: 48
Your company has defined a set of business operations that it makes accessible to client
applications. These operations, which are modeled as methods on a stateless session bean
component, act as building blocks for complex state changing activities that need to possess
atomicity, consistency, isolation, and durability (ACID) semantics. Which remoting technology is
most appropriate out of the box?
A. RMI
B. JMS
C. Web services
D. XML over HTTP
Answer: A

Question: 49
Which programmatic activity is NOT appropriate for an MVC-based enterprise web application
JSP?
A. Iterating over a collection
B. Embedding JavaScript code
C. Setting state on the user's session
D. Getting state from the user's session
E. Conditional logic to show view elements based on state
Answer: C

Question: 50
A company that makes avatar skins for virtual reality environments wants to deliver the textures
that its customers purchase on the company's web site to its customer's avatar profile in-world.
The target virtual reality environment can be communicated with from the outside-world using a
web service. However, the web service invocation will fail if the customer is not online. Which
architecture would be most appropriate to use in this situation?
A. Stateless session beans to attempt delivery
B. Invoke the web service from a JSF managed bean
C. A JCA resource adapter to invoke the web service
D. The EJB timer service to attempt delivery at regular intervals
Answer: D

Question: 51
You must build a network management web application that interacts with a complex data model
on the server. This data model uses strings, integers, and value objects that represent network IP
addresses (represented to the user in the form "10.10.201.42") and port lists (represented in the
form "80, 443"). The web forms and interaction with the backing beans is simple. Also, the web
designer has extended the HTML tag appears in many forms. What is the
simplest architecture to support this web application and reduce redundant HTML code?
A. JavaServer Faces only
B. JavaServer Pages only
C. JavaServer Pages with standard tags
D. JavaServer Faces with custom components
Answer: D

Question: 52




































Question: 53
A small company that sells avatar skins for virtual reality environments, has a static web site for
advertising their wares. The web site was created by a talented graphic artist using a popular
WYSIWYG (What You See Is What You Get) HTML editor and contains a great deal of
JavaScript. The company wants to add server-side processing capabilities for the purpose of
developing a shopping application. They are considering using JavaServer Faces (JSF). What is
a potential disadvantage the JSF framework?
A. The JavaScript will have to be rewritten to conform to JSF standards.
B. JSF tags cannot be integrated into the HTML generated by WYSIWYG editors.
C. The graphic artist cannot accurately preview the web pages offline with a generic WYSIWYG
HTML editor.
D. All the web pages will need to be converted into JSF before going into production, to keep the
end users from losing a session context.
Answer: C

Question: 54
Which application would NOT be a good candidate for an EJB-centric implementation of the
business tier?
A. An application that transfers money between accounts
B. A news-oriented web site that receives millions of hits a day
C. An application with business logic that calls third-party web services
D. A small workflow-oriented application to provision and deprovision employee accounts
Answer: B

Question: 55
You were hired by a company with a teenage fashion web site, to create a portal for their sales
staff that is accessible over the Internet. As part of this web portal your application needs to
generate a sales bar chart dynamically from real-time corporate data at request-time and
streamed to the web browser. Which technology is best suited for creating these PNG-based bar
graphs?
A. JSP page
B. filter class
C. servlet class
D. JSP custom tag
E. JSF standard component
Answer: C

Question: 56
A design company that makes avatar skins for virtual reality environments wants to create an
online catalog system that enables customers to purchase skin textures. The company is
concerned about being ranked well by search engines and therefore wants their entire catalog to
be easily parsed by the search engine bots. Which view generation strategy is the most
problematic for this endeavor?
A. using servlets
B. using JSF tags
C. using JSP tags
D. using PHP tags
Answer: B

Question: 57
Which two actions limit the negative consequences of a successful attack? (Choose two.)
A. Implementing the principle of least privilege
B. Installing a firewall at the outer boundary of your systems
C. Placing Internet-accessible servers in a demilitarized zone
D. Using a single sign-on system so that administrators do not have to log in to each server
separately
E. Giving servers administrative rights to the databases they need, and ensure that the
password is not hard-coded
Answer: A, C

Question: 58
Your company's new Internet application has complex requirements for the restriction of web
page access, and you know the site's current security requirements are subject to change. You
have recommended to your Chief Technology Officer that the Java Authentication and
Authorization Service (JAAS) should be used for security. Which three security features
influenced your decision? (Choose three.)
A. Single sign-on support
B. A framework for SOA governance
C. Pluggable Authentication Modules
D. Secure Internet connections using sockets
E. A framework for encryption, key generation, and key agreement
F. A flexible access control policy for user-based, group-based, and role-based authorization
Answer: A, C, F

Question: 59
The requirements state that a new system must use encryption to prevent data theft. Passwords
must be stored using a one-way encryption algorithm so that they can never be accidentally
displayed. Social security numbers must be stored in the database using a symmetrical algorithm
so that they can be output on reports when necessary. Which three encryption methods can you
use? (Choose three.)
A. Passwords can be stored using MD5.
B. Passwords can be stored using RC4.
C. Passwords can be stored using 3DES.
D. Social security numbers can be stored using SHA.
E. Social security numbers can be stored using 3DES.
F. Social security numbers can be stored using Blowfish.
Answer: A, E, F

Question: 60
A company has just released a new GUI interface for their product. As part of the interface, a
navigation tree is displayed to the users using an unsigned applet that is loaded using the
Internet. Which two actions can the applet take? (Choose two.)
A. Create new threads in the JVM
B. Start other programs on the client
C. Use excessive amounts of CPU time
D. Access load libraries on the local machine
E. Access file directories on the local machine
F. Make network connections to another web server
Answer: A, C

Question: 61
Which two checks are made possible in the byte-code verification? (Choose two.)
A. CPU usage is controlled.
B. Access to files is checked.
C. Digital signatures are verified.
D. Data type conversions are checked/controlled.
E. The language access restrictions (for example private, protected) are respected.
Answer: D, E

Question: 62
You are architecting a new Internet-deployed application and you want to restrict access to parts
of the system for security purposes. Which three security restrictions can be specified in the
deployment descriptor according to the servlet API specification standards? (Choose three.)
A. On page forwarding
B. On encryption methods
C. Based on the role name
D. Based on the user name
E. Based on the URL pattern
F. Based on the HTTP method
Answer: C, E, F

Question: 63
You are concerned about the threat of arbitrary code execution on your server. Which action
should you take to address this?
A. Install a firewall and create a demilitarized zone
B. Move the vulnerable server onto a VLAN segment
C. Enable "data execution prevention" in the host OS
D. Require digital signatures on all communications to and from the server
Answer: C

Question: 64
You have a web portal system that interfaces to a web service endpoint on an unsecured
communication channel. Evil Hacker X is intercepting the message between the two endpoints.
What kind of security threat is this?
A. Session theft
B. Man in the Middle
C. Cross-site scripting
D. Broken authentication
E. Distributed Denial of Service
Answer: B

Question: 65
What are two significant advantages of developing web applications with JavaServer Faces?
(Choose two.)
A. JSF pages can be previewed outside the web container.
B. Backing beans can be unit tested outside the web container.
C. Client-side validation mechanisms are automatically generated.
D. The event driven model for invoking backing beans is friendly to JavaScript callbacks (Ajax).
Answer: B, D

Question: 66
Which three application concerns do most web application frameworks attempt to separate?
(Choose three.)
A. Data
B. View
C. Logic
D. Logging
E. Filtering
F. Data validation
Answer: A, B, C

Question: 67
A company is extending its successful social networking site to support the following channels: IM
(instant messaging), email messaging, and text messaging/SMS. At present, the site has scaled
400 percent in one year using a standard MVC web framework. The application experiences
large surges or spikes in demand and also periods of inactivity. Notification delivery to the three
channels does not need to be guaranteed. Which solution extends the current architecture and
best meets the company's requirements?
A. Send the notifications inline, that is, within the normal HTTP request-response cycle
B. Place messages on a JMS queue and use MDBs to create and send the notifications
C. Insert the messages into a database and use POJOs to read the messages using JDBC and
send the notifications
D. Insert the messages into a database and use entity beans to read the messages using JDBC
and send the notifications
Answer: B

Question: 68
A company has been using servlet and JSP technology for over seven years. The company's IT
department is considering migrating to JSF technology. Which two drawbacks must the IT
department consider during this migration? (Choose two.)
A. JSF provides only a static set of built-in components.
B. JSF reduces scalability because it synchronizes the creation of the form's component tree.
C. JSF reduces scalability because it must store the view's component tree between requests.
D. JSF reduces scalability because of the additional computational overhead of the JSF life
cycle.
E. JSF provides no built-in components forcing the development team to build everything from
scratch.
Answer: C, D

Question: 69
A fashion web site has many small chunks of content that web designers cut-and-paste in many
pages. Over time, inconsistencies have emerged as one designer alters the HTML of a given
chunk. As an architect, one of your tasks is to introduce a mechanism to be used by the web
designers to isolate these chunks and keep them consistent. Which two technologies allow web
designers to isolate and reuse these chunks of HTML? (Choose two.)
A. Tag files
B. Simple tag handlers
C. Classic tag handlers
D. JSP include directive
E. JSP forward directive
F. JSP Expression Language
Answer: A, D

Question: 70
A hospital has a patient management system. Currently it is used by nurses who access the
system using tablet computers with a browser-based interface. The application uses HttpSession
objects to store state information. In phase two of the implementation, nurses will also have
access through PDAs. These PDAs will use a rich client and access the business logic using a
web service. What are two ways to manage conversational state in the new version of the
system? (Choose two.)
A. All clients use HttpSession objects.
B. All clients use stateful session beans.
C. All clients use stateless session beans.
D. Web clients use HttpSession objects and rich clients build a session management framework.
Answer: B, D

Question: 71
A company has an existing system that is a two-tier (presentation/business logic -> database)
architecture that requires the installation of code on a PC. The company wants the system to
support a thin client (browser). Which three non-functional requirements will be improved as a
result of separating the business logic into a third tier (presentation -> business logic ->
database)? (Choose three.)
A. Security
B. Scalability
C. Extensibility
D. Performance
E. Manageability
F. Maintainability
Answer: C, E, F

Question: 72
A travel company wants its application to reflect asynchronously any changes that any client
might have made to information common to all clients. For example, if two clients are both
viewing the same seat, when it is booked, both clients see the updated status of the seat as
booked. The company is considering whether to implement the presentation using a Java Swing
thick client, or a web-based client using JSP or Ajax. In which option are these technologies
shown in order from best response time to worst response time?
A. Swing thick client > web-based JSP > web-based Ajax
B. web-based JSP > web-based Ajax > Swing thick client
C. web-based JSP > Swing thick client > web-based Ajax
D. Swing thick client > web-based Ajax > web-based JSP
E. web-based Ajax > Swing thick client > web-based JSP
Answer: D

Question: 73
Given the following architecture: browser clients one web server one database server You are
considering modifying the architecture by replacing the single web server with a cluster of web
servers that are capable of load balancing. All servers being considered have the same
specification. Which two are true? (Choose two.)
A. It would simplify security.
B. It would improve scalability.
C. It would improve availability.
D. It would improve performance.
E. It would improve maintainability.
Answer: B, C

Question: 74































Question: 75
A travel company built two prototypes of their application using two different architectures. The
first was a two-tier application (where each client ran its own copy of the application against a
shared database).The second was a three-tier solution: presentation, business logic, and
persistence. For profiling and testing, the second prototype was deployed with each tier in its own
server. The three-tier solution exhibited worse performance than the two-tier solution. Which
statement explains this result?
A. Concurrent update clients must wait for others to complete.
B. The three-tier solution has more resources replicated across clients.
C. The three-tier solution exhibits additional communication traffic between tiers.
D. Concurrent read clients must wait for others to complete, thus slowing performance.
Answer: C

Question: 76
A teenage fashion website, has a multi-tier web application with 103 web servers, 12 middle-tier
servers, and a large RDBMS server with more than enough capacity to support peak loads. You
are the architect of the system, and you are concerned about reliability of the web application.
Which change could you make to improve reliability?
A. Add additional web servers
B. Add additional database servers
C. Add additional middle-tier servers
D. Reduce the number of web servers
E. Reduce the number of middle-tier servers
Answer: B

Question: 77
What are two aspects of the Strategy pattern? (Choose two.)
A. Provides a way to configure a class with one of many behaviors
B. Defines an object that encapsulates how a set of objects interact
C. Defines the skeleton of an algorithm, deferring some steps to subclasses
D. Decouples an abstraction from its implementation so that the two can vary independently
E. Defines a family of algorithms, encapsulates each one, and makes them interchangeable
F. Allows subclasses to redefine certain steps of an algorithm without changing the algorithm's
structure
Answer: A, E

Question: 78
You have been asked to improve the performance of a company's main stock market application.
The application has been instrumented and the statistics have revealed that the client spends
roughly 40 percent of its time waiting for results from the server. The API between the thick client
and the server is fine-grained. Which design pattern should be investigated and prototyped to
improve the network performance?
A. Transfer Object
B. Front Controller
C. Service Locator
D. Service Activator
Answer: A

Question: 79
You have a large number of stateless session beans, entities, and JMS components in your
system. What are three reasons to use the Service Locator pattern? (Choose three.)
A. To provide a single point of control
B. To improve performance by caching
C. To receive asynchronous client requests and messages
D. To reduce the number of business objects exposed to clients
E. To simplify initial context creation, object lookup, and object recreation
Answer: A, B, E

Question: 80
You are architecting a web service-based system that wraps existing remote business objects.
The object interactions are complex, fine-grained, and expose proprietary business processes.
Which pattern do you use to provide external access to these business objects?
A. Adapter
B. Session Facade
C. Application Controller
D. Model View Controller
E. Chain of Responsibility
Answer: B

Question: 81
As the architect charged with refactoring an existing system, you have determined that the
interactions between objects in the existing system are too complex and that the objects are
tightly coupled. Furthermore, due to the coupling, additional functionality would require the
modification of many objects in the system. Which pattern can fix this problem?
A. Facade
B. Mediator
C. Template
D. Prototype
E. Command
F. Abstraction
Answer: B

Question: 82
In which three situations is it best to use messaging with the Service Activator? (Choose three.)
A. when high availability is required
B. when you want to carry data across a tier
C. when interactive client conversations are required
D. when subtasks can be processed in random order
E. when you need to listen for and process messages
F. when you need to publish messages to multiple receivers
Answer: D, E, F

Question: 83
What are two capabilities of the Decorator pattern? (Choose two.)
A. Provides a unified interface to a subsystem
B. Converts the interface of a class into another interface
C. Is used when the base class is unavailable for subclassing
D. Promotes loose coupling by keeping objects from referring to each other
E. Modifies responsibilities to individual objects dynamically and transparently
Answer: C, E

Question: 84
You are designing a new subsystem to store and search user comments on a fashion company's
web site. There are a large number of comments and they are indexed in several ways to provide
fast access. The class used to add and search for comments is called CommentManager. In the
prototype, the comments are stored in the file system, but they will be moved to a database as
soon as it is available. Which two statements facilitate modifying the system to use a database?
(Choose two.)
A. The storage mechanism must be private to CommentManager.
B. CommentManager should provide a JDBC driver for a file system-based database.
C. The comments stored in CommentManager should only be accessed by CommentManager.
D. CommentManager should be a singleton object and all the accessor methods must be static.
Answer: A, C

Question: 85
On your first day as the architect at a company, you discover that 217 servlets are making calls to
various EJB components. The system is continually being enhanced and the APIs for the EJB
components are changing weekly. The servlet developers are struggling to keep up with the
changes. Which two statements are true? (Choose two.)
A. This is an example of brittle code dependencies and tight coupling.
B. Introducing a configuration and deployment system will fix the problem.
C. Introducing an abstraction layer between the servlets and the EJB components will reduce
the coupling.
D. This problem can be corrected by converting all entity EJB components to stateless session
EJB components.
E. Having the servlets communicate with the EJB components using web services will prevent
changing servlet code each time an EJB API changes.
Answer: A, C

Question: 86






























Question: 87
What describes the design relationship between session beans and entity beans?
A. Aggregation
B. Separation of concerns
C. Common reuse principle
D. Liskov substitution principle
E. Interface segregation principle
Answer: B

Question: 88
Which two statements describe a design incorporating the use of interfaces and reuse by
composition? (Choose two.)
A. This design approach is sometimes referred to as "delegation."
B. This design approach is sometimes referred to as "inheritance."
C. This design approach is sometimes referred to as "white box reuse."
D. This design approach is sometimes referred to as "black box reuse."
E. This design approach is sometimes referred to as "parameterized types."
Answer: A, D

Question: 89
What are two results of high coupling? (Choose two.)
A. Classes are easy to test.
B. Classes are difficult to reuse.
C. Classes hide their internal state.
D. Classes are easy to understand in isolation.
E. A modification in one class forces changes in other classes.
Answer: B, E

Question: 90
What are two advantages of using encapsulation in a multi-tier architecture? (Choose two.)
A. Business components inherit behavior from the web container.
B. Complex web container behavior can be hidden behind simple interfaces.
C. Business logic can be modified without modifying objects that depend on it.
D. Database records can be accessed directly from the web tier to improve scalability and
performance.
Answer: B, C

Question: 91
An application must send information to a remote system using SOAP. According to the
application requirements only the SOAP headers contain sensitive information and need to be
encrypted. It is a requirement that the sensitive information is encrypted during both transmission
and storage. What is the best way to implement this messaging system?
A. using WS-Security
B. using XML over HTTPS
C. using SOAP over HTTPS
D. using Container-managed security
Answer: A

Question: 92
A Java EE application starts a transaction, attempts a database insert using JDBC, and sends a
message to an MDB over a transactional JMS Queue. Upon receipt of a message, the MDB
attempts an insert in a different database using JDBC. What is NOT a possible result after
attempting to commit the application's transaction?
A. The application performs an insert and the MDB performs an insert.
B. The application performs an insert and the MDB does NOT perform an insert.
C. The application does NOT perform an insert and the MDB performs an insert.
D. The application does NOT perform an insert and the MDB does NOT perform an insert.
Answer: C

Question: 93
A mortgage company is building a system that allows customers to apply for a mortgage using a
web application. A mortgage typically takes several days to process, so the customers receive
results through an email message. When a customer completes the mortgage form, the customer
must click the Submit button. When the Submit button is clicked, the application sends the
mortgage data to an external system for processing and displays a JSP indicating that the
application has been accepted. Because the company's core business is mortgages, the
architecture must guarantee the delivery of mortgage data between the web application and the
external processing system. In this situation, which technology should the web application use to
send the mortgage data to the external processing system?
A. a JMS queue
B. XML over HTTP
C. a synchronous web service
D. an asynchronous web service
Answer: A

Question: 94
An Enterprise Information System (EIS) needs to inform a Java EE application when an event
occurs. How can the Java EE application use a Java Connector Architecture adapter to receive
EIS notifications?
A. using RMI
B. using CORBA
C. using an MDB
D. using a web service
Answer: C

Question: 95
You are interested in writing an XML messaging application. You would like to make methods
calls to an API so you can read SOAP messages containing attachments and optionally send and
receive these messages over the Internet. You are most interested in implementing XML
messaging from the Java platform. Which Java API is best suited for your solution?
A. StAX
B. SAAJ
C. JAXR
D. JAXP
Answer: B

Question: 96
Which technology should a Java EE application use to send an XML document and a PDF file to
an application written in C?
A. JMS queue
B. XML over HTTP
C. SOAP web service
D. Java Connector Architecture adapter
Answer: C

Question: 97
What results directly from failure of input validation?
A. SQL injection
B. forced browsing
C. session hijacking
D. insecure direct object reference
Answer: A

Question: 98
Which two statements are true about the Java Cryptography Architecture (JCA)? (Choose two.)
A. Any JCA provider must implement each supported category of algorithm.
B. Exactly one implementation of each category of cryptographic algorithm must be provided.
C. Implementations of cryptographic algorithms can be plugged into a JVM after it has been
installed and at runtime.
D. Categories of algorithms supported by the JCA include message digests, signatures,
encryptions, key management, and random number generation.
Answer: C, D

Question: 99
Service method A(), implemented in a session bean, performs a highly sensitive operation. This
operation must be available in limited ways to low-privilege users to support a low-sensitivity
operation B(). Which approach addresses the requirements most securely?
A. Mark the method A() as accessible to all necessary roles
B. Mark the method A() as accessible to all appropriate roles, and use the programmatic
security model to impose the necessary additional restrictions
C. Mark the method A() as accessible to all appropriate roles, and use the deployment
descriptor to indicate the conditions under which each role can invoke the high priority
method
D. Mark method A() as accessible only to a special role, then use a run-as element to invoke A()
from B(); before making the call to A(), B() checks that conditions are appropriate for the call
Answer: D

Question: 100
Using Java Web Start, you are going to deploy a new Java application from the IT development
server to all the computers in your company's network. Which three actions can an unsigned JAR
file in the Java Web Start sandbox take? (Choose three.)
A. Persist session data
B. Access network printers from the system
C. Use the network to access an arbitrary file server
D. Use the JNLP APIs to interact with the local file system
E. Use the network to access the host from which the application was downloaded
Answer: A, D, E

Question: 101
You need to restrict access to the administration screens in your web site. In which two locations
can you determine whether a user is authorized to access a particular screen? (Choose two.)
A. An EJB entity
B. An intercepting filter
C. A custom tag library
D. Stored procedures
E. A deployment descriptor
F. Custom JavaScript in JSP
Answer: B, E

Question: 102
The web pages in a system are carefully designed so that links to security-sensitive URLs are not
available in pages offered to untrusted users. Which statement is true?
A. The system security is adequately protected by this approach.
B. Every security-sensitive target must be additionally protected using the declarative security
model.
C. The system security is adequately protected by this approach provided only POST requests
are accepted by the server.
D. The system security is adequately protected by this approach, but security must be carefully
maintained.
Answer: B

Question: 103




































Question: 104
A company's backend system is implemented as a set of stateless session bean components.
Traditionally, it was accessed only by a web-based UI, developed in-house. Responding to strong
customer demand, the company now wants to expose a programmatic way to access its system
from other applications. Their customer base uses a variety of operating systems and deployment
environments, with technologies ranging from C/C++ to Perl to Java. The company's customers
place particular importance on the ready availability of tooling to make client development as
painless as possible. Which remoting technology best meets the customer's requirements?
A. RMI
B. JMS
C. web services
D. XML over HTTP
Answer: C

Question: 105
A company acts as a clearinghouse for credit card transactions. Certain bits of information inside
individual transactions must be kept encrypted at all times to limit the potential for fraudulent
transactions by untrustworthy merchants. Examples of data that must be kept confidential include
the full credit card number and the CVV2 code associated with a card. Additionally, to limit the
risk for tampering with transaction information, the company requires that information about a
transaction travels as one data packet with the associated digital signature. You have been
entrusted with developing the entry point into the system, that is, the component that needs to
accept data for an individual transaction and start processing it. Which technology best satisfies
the company's requirements?
A. Stateless session bean with RMI interface
B. CMP entity bean generated from a database table
C. Message-driven bean attached to a persistent JMS queue
D. Stateless session bean with a RPC-style web service interface
Answer: C

Question: 106
Over the years your company has developed a large set of EJB 2.1 components. Having
upgraded its servers to an EJB 3 implementation, your company is ready to develop EJB 3
components for the first time in order to use the new development features. Which two can be
implemented without upgrading an existing EJB 2.1 module to version 3, which would require
repackaging and retesting the module? (Choose two.)
A. EJB 2.1 stateless session bean using an EJB 3 interceptor
B. EJB 3 stateless session bean invoking an EJB 2.1 stateless session bean
C. EJB 3 stateless session bean replacing an existing EJB 2.1 stateless session bean
D. EJB 3 stateless session bean sharing a timer with a EJB 2.1 stateless session bean
Answer: B, C

Question: 107
You have been asked to advise a client on the suitable architecture to use in the construction of
their next generation hotel room reservation system. The primary requirements for the business
tier are as follows: ease of development, separation of the persistence tier from the business logic
tier, extensibility, performance, scalability, security, and transaction management. State is
maintained in the presentation tier. What is the most suitable high-level architecture for the
business tier that most closely meets the stated requirements?
A. stateful session beans accessing the persistence tier directly
B. stateless session beans accessing the persistence tier directly
C. Plain Old Java Objects (POJOs) accessing the persistence tier directly
D. stateful session beans accessing the persistence tier through a DAO layer
E. stateless session beans accessing the persistence tier through a DAO layer
Answer: E

Question: 108
Which three statements are guaranteed to be true about an ORM-centric approach to data
persistence, regardless of the specific implementation chosen? (Choose three.)
A. ORM implementations can be supported by tool vendors to improve developer productivity.
B. ORM implementations typically trade off a small decrease in raw performance in return for
greatly improved developer productivity.
C. ORM implementations can optimize persistence strategies to scale in both single (one server)
and clustered (multiple servers) scenarios.
D. ORM implementations provide the same level of data access and manipulation semantics, as
provided by accessing the underlying datastore directly.
E. ORM frameworks are verifiably correct in applying ACID (atomicity, consistency, isolation,
durability) to database access, which is an advantage over JDBC.
Answer: A, B, C

Question: 109
Your company is starting its first project using EJB 3. The developers are familiar with developing
web applications using servlets and MVC web frameworks. Which argument supports the
decision of using EJB 3 on the project?
A. EJB 3 session beans are POJO classes.
B. EJB 3 session beans use the same threading model that servlets use.
C. Database resources are available to every EJB 3 session bean without any developer
intervention.
D. EJB 3 session beans can be defined directly inside a WAR file, without requiring a separate
EJB JAR file.
Answer: A

Question: 110
A company has been using the database YourTables for many years. Recently, it started
considering a migration to the database Pregres, which uses a different SQL dialect. Moreover,
the SQL engines in YourTables and Pregres have significant differences in performance when
executing the same SQL queries in the presence of advanced SQL features. Which two
persistence approaches offer the easiest migration from YourTables to Pregres for this company?
(Choose two.)
A. JPA
B. JDBC
C. CMP entity bean
D. BMP entity bean using JDBC
E. YourTables high-performance driver
F. JDBC rowset with XML serialization
Answer: A, C

Question: 111
WebLizard is using an application consisting of a single WAR file that exposes a number of web
service endpoints using JAX-WS. What security-related information about an authenticated client
is available from inside the web service endpoint implementation class?
A. only its role
B. only its principal
C. both its role and its principal
D. neither its role nor its principal
Answer: C

Question: 112
Which three measurements are necessary to determine the availability of an application?
(Choose three.)
A. Total downtime
B. Average response time
C. Mean time between failure
D. Application startup timestamp
E. Application shutdown timestamp
Answer: A, D, E

Question: 113
What are three web service support features in Java EE? (Choose three.)
A. Generating a web service from an MDB
B. Generating a Java class from a WSDL file
C. Associating a Java class with a WSDL file
D. Associating a JMS queue with a WSDL file
E. Generating a web service from a stateful session bean
F. Generating a web service from a stateless session bean
Answer: B, C, F

Question: 114
A company has a legacy system that it is going to use Java EE technology to re-engineer. The
legacy solution consists of active server pages and a relational database. The company is
interested in changing DB vendors in the future and this requirement is key to moving forward.
This is a web-based transactional sales system. The company will keep the relational database
schema because it still meets business requirements and will not require re-engineering. What is
the best solution?
A. JSP, JDBC only
B. JSP, servlets, JDBC only
C. JSF, servlets, JPA, EJB3
D. JSF, servlets, DAO, JDBC
Answer: C

Question: 115
Your web site's daily active user sessions have greatly increased. This is degrading performance
because your application container is using all of its resources to manage the volume of active
sessions. You need to deploy in a cluster to scale the application. You have been setting Java
beans into your HTTPsession. Which interface should you implement when re-factoring your
beans to successfully deploy in a cluster supporting session fail-over?
A. BeanContext
B. Serializable
C. Cloneable
D. Accessible
E. Comparable
Answer: B

Question: 116
You work for a small IT shop. The developers are responsible for deploying production
applications. All of the connection and resource parameters are distributed in the Java source
code. Your IT shop has a limited infrastructure so there have been few issues with pushing
production applications. Your IT shop has been purchased and is now reselling Java products to
customers. You now have dedicated development, testing, staging, and production environments.
A new requirement states that these applications must support rapid deployment to each
environment. What is the best solution?
A. refactor the Java application to use JNDI names and resource references
B. identify a build engineer that has the responsibility of modifying the constant class for each
deployment
C. set your connection properties in a constants class to consolidate connection and resource
parameters
D. identify the environment parameters for connection and resources and make them readily
available to developers
Answer: A

Question: 117
What is a purpose of the Web Services Metadata for the Java Platform specification (JSR-181)?
A. to simplify development of web services from JSPs
B. to simplify development of web services from POJOs
C. to simplify development of web services from JMS destinations
D. to simplify development of web services from MDB components
Answer: B

Question: 118
You are architecting a new web-deployed portfolio management application. The current system
used by portfolio managers is a desktop application. Ease of migration for the portfolio managers
is an important consideration. Once the users have set up and approved a portfolio, you must
create a secure TCP connection to a fund trading system to execute buy and sell orders. Which
two technologies are most appropriate for this system? (Choose two.)
A. JSF
B. JMS
C. JAAS
D. JSSE
E. JAX-WS
Answer: A, D

Question: 119
A travel company wants to outsource the credit card processing functionality needed by their
online flight reservations system. The company wants their application to support the ability to
swap third-party vendors without impacting their application's business model. The credit card
processing operation must participate in transactions, to ensure business constraints are obeyed.
Which Java EE technology would most easily support this requirement?
A. JMS
B. UDDI
C. Web Services
D. Java Connector Architecture (JCA)
Answer: D

Question: 120
Which design pattern is useful for hiding the construction and implementation details of an
object?
A. Flyweight
B. Singleton
C. Abstract Factory
D. Chain of Command
Answer: C

Question: 121
You are building a web application that must integrate to a content management system (CMS).
Your company currently has a homegrown CMS, but management is considering purchasing a
new CMS. Unfortunately, you have little confidence that their latest choice, BigCMS, is likely to be
the final decision. After analyzing the interface to BigCMS, you find that its interface is different
from the homegrown CMS. Furthermore, you suspect that any other third-party CMS will have yet
another interface. What is the simplest pattern that would isolate your web application from the
interface of the CMS tool?
A. Proxy
B. Bridge
C. Adapter
D. Service Locator
E. Business Delegate
Answer: C

Question: 122
What is a benefit of using the Transfer Object pattern?
A. Reduces requests across the network
B. Avoids the overhead of using EJB finder methods for large searches
C. Separates the business state and related behavior from the rest of the application
D. Implements parent-child relationships efficiently when implementing Business Objects
Answer: A

Question: 123
A company created its own MVC-like framework in the years before Struts and JSF.
Unfortunately, the company's Front Controller has become bloated with too many features
including fine-grained authorization, view dispatching, and business logic invocation. Which three
patterns could be applied to reduce the complexity of this Front Controller? (Choose three.)
A. Mediator
B. Command
C. View Helper
D. Intercepting Filter
E. Composite View
F. Application Controller
Answer: B, D, F

Question: 124
What are two advantages of the Business Delegate pattern? (Choose two.)
A. Increases the scalability of remote services
B. Decouples presentation logic from business logic
C. Avoids unnecessary invocation of remote services
D. Hides underlying communication details of the service
E. Enables transparent persistent storage of the business entity
Answer: C, D

Question: 125
What are two advantages of a thin client, three-tier architecture over a thick client, two-tier
architecture? (Choose two.)
A. It is more secure.
B. It is more reliable.
C. It is easier to maintain.
D. It makes it easier to manage the application deployment.
Answer: C, D

Question: 126
Which is NOT a valid reason to separate presentation from business logic?
A. Improved scalability
B. Improved performance
C. Separation of concerns
D. Improved maintainability
Answer: B

Question: 127
A company is considering re-architecting their application from a two-tier to a three-tier
architecture. To see what impact the new architecture would have on their non-functional
requirements (NFRs), they created a prototype. When they tested the prototype based on their
three-tier architecture they noticed, contrary to expectations, that the prototype was less scalable
than the original two-tier solution. Which two statements explain the result? (Choose two.)
A. Clients end up competing for CPU cycles on the common business logic tier.
B. Clients end up competing for resources on the back-end database used by the application.
C. Clients did NOT share interest in any domain objects, but the business tier spent too much
time coordinating among clients anyway.
D. Clients did NOT share interest in any domain objects and the business tier ran out of memory
to represent all domain objects required by the clients.
Answer: A, D

Question: 128
Which two statements are true only when implementing rich client applications, and NOT when
implementing web browser-based clients that support only HTML? (Choose two.)
A. Information can be sent to the client by the server, without client polling.
B. Information can be encrypted prior to delivering it to the client and decrypted when received
to the client.
C. Information can be compressed prior to delivering it to the client and decompressed when
received to the client.
D. Information can be delivered to the client incrementally, without requiring that the server
deliver all the information to be presented to the client on each update.
Answer: A, D

Question: 129
A bank designed its first-generation web-based banking system around a Java technology rich
client application that interacts with server-side service objects implemented as stateful session
beans in a portable Java EE application. For their second-generation system, the company wants
to open the architecture to other types of clients. The company is considering exposing its
existing stateful session bean service as a web service. Which statement is true?
A. Session beans cannot be exposed as web services.
B. Stateful session beans cannot be exposed as web services.
C. Stateful session beans are automatically exposed as web services.
D. Stateful session beans annotated with @WebService are exposed as web services.
Answer: B

Question: 130
Brokers at a firm currently use a two-tier application to execute stock transactions on behalf of
their customers. Business components within the application enforce a number of complex
business rules that ensure that stock transactions are executed properly. Management has
decided that clients should be able to execute their own transactions to streamline operations.
Management also wants clients to run the same existing two-tier application from their home
computers. They have hired you to advise them on how to proceed to ensure that no illegal stock
transactions are executed once the application is available directly to clients. Which two
recommendations should you give to this brokerage firm? (Choose two.)
A. The code already checks for correct execution so they can deliver the application to clients
"as is."
B. Checks for correctness should be rewritten as database constraints because the application
running on the client might be modified.
C. The application should be re-architected as a three-tier solution. That way, validation checks
can be moved to a server-side business tier, which remains trustworthy.
D. The application should be obfuscated before it is delivered to the client. That way, clients
cannot modify it. Therefore, the validation checks currently implemented will remain
trustworthy.
Answer: B, C

Question: 131
A travel company re-architected its application from a two-tier to a three-tier architecture. To see
what impact the new architecture would have on its non-functional requirements (NFR), the
company intends to build a prototype based on the new architecture. The company compared the
NFR metrics associated with the new prototype against the metrics from their original two-tier
solution. What is an advantage of the original two-tier solution?
A. It has better availability because it has fewer single points of failure.
B. It has better manageability because each client has its own copy of the application.
C. It has better performance because each client must use its own set of domain objects.
D. It has better scalability because each client can access the database independently of other
clients.
Answer: A

Question: 132
The Java system you are enhancing needs an integration point to an external system to gain
access to data stored in a database. The application uses an open database connectivity data
source to access data. What do you use to connect to the database?
A. XML over HTTP
B. RPC-style SOAP
C. RMI-IIOP and EJB
D. JDBC-ODBC bridge driver
Answer: D

Question: 133

Java Connector Architecture (JCA) as a technology solution addresses certain needs for your
Java applications. What is the best description of a JCA solution?
A. Asynchronous message-based interfaces
B. Integration of slow responders in a loosely-coupled way
C. Access tightly-coupled business logic of legacy systems
D. Integration of systems/components and guaranteeing message delivery
Answer: C

Question: 134
Your client is interested in the benefits of integration with an external system using RMI-IIOP,
RMI-JRMP, and CORBA for external integration. What should you tell your client?
A. An RMI-JRMP client can call a CORBA server.
B. A CORBA client can call an RMI-JRMP server.
C. An RMI-JRMP client can call an RMI-IIOP server.
D. A CORBA client CANNOT call an RMI-IIOP server.
Answer: C

Question: 135
Your online e-commerce application has a message-driven bean (MDB) that calls an email
server. Which statement about invoking the MDB is true?
A. The client can access the MDB directly.
B. The client accesses the MDB using an interface.
C. A message-driven bean is simply a JMS message provider.
D. A JMS message is sent to the destination to which the MDB is listening.
Answer: D

Question: 136
SOAP was selected as an integration technology for the flexibility of messaging styles it supports
(in particular, how an XML payload can be presented in a SOAP message). Which message-style
statement is correct?
A. The body of an RPC-style SOAP message cannot be a literal message.
B. The XML payload for a document-style message cannot be an encoded message.
C. The XML payload for RPC and document-style messages guarantee XML payload delivery.
D. An RPC-style message has the XML payload wrapped inside an operation element in a
SOAP body.
Answer: D

Question: 137
As part of your Java application, you are required to integrate with an external system that has a
Java web service. The Java web service is using synchronous communication and exposes
several methods with varying method signatures. Which technology do you use for this solution?
A. JMS
B. SOAP
C. RMI-IIOP
D. RMI-JRMP

Answer: B

Question: 138
Your company is going through an extensive security audit and it has been identified that your
Internet-facing web site is vulnerable to SQL injection from authenticated users. Which two are
appropriate for mitigating this threat? (Choose two.)
A. Using security roles in the deployment descriptor
B. In stored procedures called with prepared statements
C. Adding an Intercepting Validation filter to your system
D. Requiring SSL in the deployment descriptor transport guarantee
Answer: B, C

Question: 139
Your competitor is trying to crash your web site by using various Denial of Service attacks. Which
two flaws should you protect against for this specific threat? (Choose two.)
A. SQL injection
B. buffer overflow
C. Man in the Middle
D. session hijacking
E. weak password exploits
Answer: A, B

Question: 140
Which is an appropriate technique for minimizing the consequences of a successful attack?
A. Input validation
B. Principle of least privilege
C. Encryption of wire transmissions
D. Use of strong/two-factor authentication
Answer: B

Question: 141
What is the appropriate location to configure a JSP-based application to require secure
communication between a browser and particular resources?
A. In the application code
B. In the business-tier code
C. In the browser configuration
D. In the deployment descriptor
E. In the web server configuration
Answer: D

Question: 142
Which five statements about SecurityManager are true? (Choose five.)
A. The SecurityManager must be instantiated to use RMI.
B. The SecurityManager object can be discarded after loading.
C. The SecurityManager can be configured from a per-user file.
D. The SecurityManager can be configured from a system-wide file.

E. The SecurityManager object can be installed in the application code.
F. The SecurityManager object can be installed from the command line.
G. The SecurityManager can be configured from a file specified on the command line.
Answer: C, D, E, F, G

Question: 143
A company is in the business of distributing hard candies. The distribution of these candies is
automated and the system that helps track information about candy distribution is written in Java
technology. The business unit for the company has been asking the IT group to provide a flexible
reporting system to track detailed information. A large amount of data about candy is stored using
a DAO layer, but little is used. What is the best solution for the IT group to implement to provide
the most flexibility for the business unit?
A. refactor the DAOs to include additional static queries to pull information and export a
spreadsheet for the business unit to review
B. Implement an ad-hoc query tool exposed using JSF that allows business units to create
queries and produce results in a given format
C. Provide a JSP page, which has scriptlets that expose pre-defined queries for the business
unit to execute and display in HTML
D. Create a web service that exposes fixed queries invoked by a JSP client that can pull data
from the database and export in a given format
Answer: B

Question: 144
As part of your SOA infrastructure, you are interested in implementing a client that can request
information about businesses worldwide from a UDDI registry. Which Java EE API provides
interfaces for gathering data about these businesses?
A. StAX
B. JAXB
C. JAXP
D. JAXR
Answer: D

Question: 145
A retail company has a dashboard application that lets executive decision makers view current
business information. This information includes gross sales, returned goods dollars, cost of labor,
and other information. The information is updated on a continuous basis using a JMS queue.
None of this information is critical, so the loss of a few messages is acceptable. Which JMS
delivery mode meets these requirements and optimizes performance?
A. Best-effort
B. At-most-once
C. Store-and-forward
D. Once-and-only-once
Answer: B

Question: 146
A Java EE travel agency application builds flight itineraries and needs to provide runtime
monitoring to external clients. Agency managers need to find out at any given time how many
itineraries have been started but not completed. This information should be made available to at

managers runtime using open-source or commercially available management tools. The
instrumentation should be done with a standard Java EE API. How should you instrument the
application?
A. JPA
B. JMX
C. JMS
D. SNMP
Answer: B

Question: 147
Which Java EE feature helps facilitate migration to SOA?
A. Stateful session beans can be exposed as web services.
B. Stateless session beans can be exposed as web services.
C. Stateful session beans support local and remote interfaces.
D. Stateless session beans support local and remote interfaces.
Answer: B

Question: 148
Your company has a web site that was created exclusively in JSP pages. The company now
wants to add role-based security to the site to limit access to certain pages. Which three are used
to facilitate this authorization mechanism? (Choose three.)
A. a servlet Front Controller
B. EJB security constraints
C. a servlet Filter to intercept HTTP requests
D. web resource constraints in the deployment descriptor
Answer: A, C, D

Question: 149
Which two provide data binding between the HTTP request parameters and a server-side Java
object? (Choose two.)
A. JavaServer Pages with the standard tag
B. JavaServer Faces with expressions of the form ${bean.property}
C. JavaServer Faces with expressions of the form #{bean.property}
D. JavaServer Pages with expressions of the form #{bean.property}
E. JavaServer Pages with expressions of the form ${bean.property}
Answer: A, C

Question: 150
A fashion web site has many small chunks of content that web designers cut-and-paste in many
pages. Over time, inconsistencies have emerged as one designer alters the HTML of a given
chunk. As an architect, one of your tasks is to introduce a mechanism to be used by the web
designers to isolate these chunks and keep them consistent. Which two technologies allow web
designers to isolate and reuse these chunks of HTML? (Choose two.)
A. tag files
B. simple tag handlers
C. classic tag handlers

D. JSP include directive
E. JSP forward directive
F. JSP Expression Language
Answer: A, D

Question: 151
As the architect for a company's product development department, you have been tasked with
designing the next generation of money management tools for high net worth individuals. Sold at
a premium price and with guaranteed server-side resources for each logged-in user's session,
MyMoney Pro provides real-time feeds on stock, bond, and mutual fund prices to the user as well
as the ability to execute trades with a response time of two seconds or less. Java Swing is used
to build the client-side application to provide the rich end-user experience deemed necessary,
and the persistence tier will be implemented as CMP entity beans. What is the most appropriate
server-side component to use to model and hold the client's session state and resources in the
MyMoney Pro application?
A. An entity bean
B. A stateful session bean
C. The HttpSession object
D. A stateless session bean
Answer: B

Question: 152
An online footwear retailer wants to deploy a blogging web site about the footwear industry to
help generate more traffic to its e-Commerce web site. The company wants to create the blogging
site using Java EE technologies to make sure that every blog entry is indexed by search engines.
Which Java EE technology should the company use to create its blogging site?
A. A JSF-oriented application using EJBs and JPA for persistence
B. A JSP-oriented application using EJBs and JPA for persistence
C. A web-centric JSF-oriented application using JPA for persistence
D. A web-centric JSP-oriented application using JPA for persistence
Answer: D

Question: 153
What is a disadvantage of JSP technology as compared to JSF technology?
A. JSP requires scriptlets to access request parameters.
B. Developers of JSP pages must be Java programmers.
C. JSP technology does NOT provide APIs for form validation.
D. JSP pages are slower because they are interpreted by the web container.
Answer: C

Question: 154
A company that sells footwear hired a junior-level developer to create their order-entry workflow
using JSPs. The developer hard coded all the business logic into scriptlet-intensive JSPs. The
resulting spaghetti code became too much for the developer to maintain. The company then hired
a Sun Certified Enterprise Architect (SCEA) to help fix the problem. Which design pattern would
be best for the order-entry workflow?
A. View Helper
B. Front Controller
C. Composite View
D. Service to Worker
E. Business Delegate
Answer: D

Question: 155
As the architect for a corporation, you are focused on how best to design the persistence layer of
the in-house stock inventory application. Key operations that must be supported, in addition to
insert, read, update and delete are: bulk updates and deletes, complex queries including sub
queries, JOINs and dynamic queries. Ease of development and a future-proof approach is
important, but you realize that ease of development is academic if the approach selected does
NOT meet the core technical requirements. What is the best approach to architecting the
persistence layer for the application?
A. Use entity beans, accessed by a session bean layer to provide unit-of-work, security and
transaction semantics
B. Use JDBC-based layer, accessed by a session bean layer to provide unit-of-work, security,
and transaction semantics
C. Do NOT provide a logically distinct persistence layer, but rather use session beans to access
the database directly using JDBC
D. Use a JPA-based persistence layer, accessed by a session bean layer to provide unit-ofwork,
security, and transaction semantics
Answer: D

Question: 156
Your company supports multiple versions of a web service implemented using a stateless session
bean. Initially, it was expected that the interface would grow over time with the addition of new
methods, but now substantial changes are needed to several of the existing methods. Your
company's clients are concerned that having old and new methods side by side would result in
unwieldy interfaces. As you review the changes, you realize that the behavior behind the old and
new operations is identical and the suggested changes are only a matter of refactoring the
operation signatures and the data types used. Which approach would you recommend to handle
this situation with minimal disruption?
A. Customize the existing web service interface using annotations until it identical to the new
one
B. Have the existing stateless session bean class implement the new web services interface
alongside the old one
C. Create a new stateless session bean with the new web service interface and have it delegate
to the existing web service implementation class
D. Duplicate the code in the existing stateless session bean class, then make the necessary
changes to its web interface and rename them accordingly
Answer: C

Question: 157
A company is designing a customer relationship management (CRM) system. All data is to be
stored in a relational database and accessed by multiple applications using a single persistence
layer. The data model includes complex relationships between tables. Application requirements
include disconnected operations to benefit the sales force in the field, complex queries to
discover under-served customer segments, and the ability to perform bulk updates on data as
corporate clients relocate or are acquired by former competitors. Which persistence technology
best supports these requirements?
A. JPA
B. CMP entity bean
C. BMP entity bean with JPA persistence layer
D. BMP entity bean with JDBC persistence layer
Answer: A

Question: 158
You are designing an extension to an existing, high-volume Java EE-based e-commerce
application that provides enhanced customization and personalization features to users. Users
must be able to change both the content and look and feel of what they see on the home page,
add favorite items to a "My Favorites" area, and have items suggested to them by the application
based on prior purchasing behavior. All site actions participate in a new or existing transaction to
track and audit user behavior across the site for later analysis. Given these requirements, what is
the most appropriate server-side component, or method to use to provide access to the
configurable options stored by the e-commerce application?
A. Accessing the persistence tier directly from the presentation tier (JSPs)
B. A stateful session bean accessing a well-defined persistence tier using the DAO design
pattern.
C. A stateless session bean accessing a well-defined persistence tier using the DAO design
pattern.
D. A Plain Old Java Object (POJO) accessing a well-defined persistence tier using the DAO
design pattern
Answer: C

Question: 159
Your company requires all its developers to use a well-specified set of exception classes to model
a number of common error conditions, many of which are specific to its business. These
exception classes are centrally maintained and come packaged in a library (a JAR file). The
application you are developing needs to report a number of error conditions covered by this
library to remote clients. Which pairing of component type and remote access technology enables
client applications to use the predefined exceptions as part of their natural programming model?
A. servlet accessed using HTTP
B. entity bean accessed using web services
C. stateless session bean accessed using RMI
D. message-driven bean accessed using a JMS queue
Answer: C

Question: 160
A successful web application is used by over two hundred thousand users. Due to this substantial
load, the database is overburdened and fails frequently. All data, including critical user records
and temporary session data, are stored in the database. Because of resource constraints, a new
database system cannot be installed. Which change will reduce the load on the database?
A. Create more entity beans to optimize the interaction with the database
B. Refactor the web application to use DAOs to communicate with the database
C. Refactor the web application to store temporary session data on the web serversD. Add more web servers to the web tier to distribute the load and reduce the number of
transactions on the database
Answer: C

Question: 161
You are the architect on a project developing a web site to give fashion advice to teenagers. The
content on the site is largely static, but there is a small amount of per-user customization. The
actual content, including the style and layout of the site, changes often to ensure a fresh look.
Many graphic designers work on the site for short periods of time. The underlying content
management software does not change often and the web site runs in an environment with
reasonable security in place. What is your primary architectural concern?
A. Deploying the entire web site as JSPs so the content is easier to manage
B. Designing a multi-tier, service-oriented architecture to handle fail-over and ensure high
availability
C. Designing a template-based solution to ensure that static content is separated from dynamic
content
D. Deploying a DMZ, a secure database, and an encrypted JDBC driver to ensure that user data
is protected
Answer: C

Question: 162
You are architecting the layers for a complex n-tier web application. Which two pairs of
technologies do NOT exhibit direct dependencies? (Choose two.)
A. EJB to RMI
B. Linux to JDBC
C. HTML to Firefox
D. Tomcat to Servlets
E. SunFire E20k server to Java EE
Answer: B, E

Question: 163
In which two ways does the Value List Handler pattern support separation of concerns? (Choose
two.)
A. It centralizes business logic and state.
B. It encapsulates access to business services.
C. It uses DAOs to encapsulate access to persistence.
D. It helps focus list management logic in the business tier.
Answer: C, D

Question: 164
Which pattern exists primarily to separate concerns?
A. DAO
B. Transfer Object
C. Session Facade
D. Composite Entity
Answer: A

Question: 165
































Question: 166
Which technology is NOT capable of implementing a Front Controller?
A. servlets
B. servlet filters
C. JavaServer Faces
D. JavaServer PagesE. session context listeners
Answer: E

Question: 167
Which web framework supports declarative data conversion between text and arbitrary Java
objects?
A. servlets
B. JavaServer Faces
C. JavaServer Pages with
D. JavaServer Pages with the Expression Language
Answer: B

Question: 168
You must build a web application with simple form processing. The backing data model has
JavaBeans-styled accessor methods that handle textual data only. This application must be
maintained by non-programmers. What is the simplest architecture for this web application?
A. JavaServer Faces (JSF) only
B. JavaServer Pages (JSP) with scriptlets
C. JavaServer Pages with a servlet controller
D. JavaServer Pages with JSP standard tags
E. JavaServer Pages with the Expression Language
Answer: D

Question: 169
A company hired a web designer to create a fresh look for their web applications. The designer
created several new UI components that require a complex interaction between HTML and the
JavaScript language. The architect needs to choose a combination of server-side technologies to
accommodate these new components. Which two technology combinations, used independently,
satisfy this requirement? (Choose two.)
A. JSP with tag files
B. servlets with custom filters
C. JSF with custom components
D. JSF with the Expression Language
E. servlets with the Expression Language
Answer: A, C

Question: 170
A company is extending its product suite to allow users to augment existing application content
with their own content (images, documents, audio and video files). All content is stored in
relational databases and transaction support is required. The user interface should run on all
mainstream browsers and platforms. The company wants the web designers (technical
personnel, but not Java developers) to be able to edit the pages directly to update the
presentation of user content continuously over the life of the application. Providing a compelling
user experience is an important consideration. Which architecture is optimal for handling the
user-submitted content?
A. a MVC web framework to access the content using entity beans
B. a MVC web framework with Ajax to access the content using JSP tags and POJOsC. a MVC web framework to access the content using stateful session beans and entity beans
D. a MVC web framework with Ajax to access the content using stateless session beans and JPA
Answer: D

Question: 171
A company wants to design an internal web site for the purpose of managing its numerous social
events. The site will not have heavy traffic, but will require state to be persisted in a database.
You have been tasked to complete this action item in your spare time. Which two Java EE based
approaches are best used for a quick development? (Choose two.)
A. Use JPA in the web tier only
B. Use message-driven beans to manage the posting of events
C. Use your domain model components as JSF managed beans
D. Use an EJB container to service inject the domain model and support a JPA deployment
Answer: A, C

Question: 172
An airline flight monitoring system must notify several other systems when a flight's status
changes. All of the systems are written in the Java programming language and located on the
same local area network. One of these systems, the crew scheduler, must receive all flight status
changes. If the crew scheduler system is down, it must receive all status changes when it
restarts. How should the crew scheduler receive flight status changes?
A. As a JMS durable subscriber
B. Using XML over HTTP with correlation IDs
C. Through a Java Connector Architecture adapter
D. As an asynchronous RPC-style SOAP web service
Answer: A

Question: 173
Your new application incorporates messaging. If the receiver is down, the message is stored by
the sending component. When the receiving application becomes available, all of the stored
messages are delivered. Which solution is most appropriate?
A. JMS with asynchronous communication
B. JMS with synchronous communication
C. RPC with asynchronous communication
D. RPC with synchronous communication
Answer: A

Question: 174
Your application depends upon heavy web services communication that distributes large XML
objects over HTTP. Your architecture is event driven and you require the creation of bi directional
XML parsers that are fast, easy to implement, and have a low memory footprint. Which Java EE
API is best suited for your solution?
A. StAX
B. DOM
C. JAXB
D. JAXRAnswer: A

Question: 175
You are a client of an XML over HTTP web service. You need a Java API that can enable your
application to parse and transform XML documents independent of a particular XML processing
implementation. Which Java API can you use?
A. SAAJ
B. JAXP
C. JAXR
D. JAX-RPC
Answer: B

Question: 176
An application sends four messages (1, 2, 3, and 4) to a JMS destination. Three consumers (A,
B, and C) consume messages from the destination. There are no delivery failures.
A receives messages 1 and 2.
B receives messages 1 and 3.
C receives messages 1 and 4.
How do consumers receive these messages?
A. A, B, and C listen to a JMS queue with message selectors.
B. A, B, and C listen to a JMS queue without message selectors.
C. A, B, and C subscribe to a JMS topic with message selectors.
D. A, B, and C subscribe to a JMS topic without message selectors.
Answer: C

Question: 177
Your organization has an existing web-based Java e-commerce application that provides remote
EJB interfaces. Your organization is interested in architecting a separate Java billing application
that leverages some of the business logic contained in the e-commerce application. Which
technology is ideal for this application?
A. JMS
B. JDBC
C. Java IDL
D. RMI / IIOP
Answer: D

Question: 178
Your web page design company is designing web sites for all of the stores in a local mall. Your
company must create a consistent "look and feel" for these sites. Once this "look and feel" project
has gone through demonstration, enhancement, and approval iterations with the mall's clients,
your job will be done, and the development of the actual B2C (business to client) system will be
handled by a different firm. Which architecture is most appropriate for your prototype project?
A. Two-tier, web-centric
B. Three-tier, web-centric
C. Three-tier, enterprise-centric
D. Three-tier, application-centricAnswer: A

Question: 179
In order to handle your n-tier application's persistence requirements directly from web-tier
components, which three statements about your application should be true? (Choose three.)
A. Your application will NOT need to use DAOs.
B. Your application has no need for an LDAP server.
C. Your application is such that scalability is NOT a concern.
D. Your application has no need for concurrency management.
E. Your application has no need for container managed transactions.
Answer: C, D, E

Question: 180
ABC Travel offers a flight reservation service, exposed as a web service. XYZ Stays offers a hotel
reservation service, also exposed as a web service. ABC and XYZ will not change their web
services. A startup company has contacted you for advice about designing a new service that
combines flight and hotel reservations, which they will offer as a web service. The startup
company plans to provide their service by implementing a portable Java EE solution that
aggregates the two services offered by ABC Travel and XYZ Stays. A combined reservation
succeeds only if both the flight reservation and the hotel reservation succeed. What is the most
effective way to meet the business requirement?
A. The startup company should implement their new service as a web service that uses an XA
transaction manager.
B. The startup company cannot implement their new service as a web service, but must use an
EJB component to gain transaction propagation.
C. The startup company should implement their new service as a web service by calling the two
existing services, and implementing their ow compensating transaction.
D. The startup company can implement their new service as a web service by calling the two
existing services in a single transaction, relying on transaction propagation to support this
business rule.
Answer: C

Question: 181
A company is developing a new web application to handle the entry of medical claims for
processing. Hospitals and doctor's offices enter the claim into the new system instead of sending
the paperwork to the company's offices. The company does NOT want to install software on the
client side. In an effort to reduce network traffic and server processing, it wants all data entry
checks to complete on the client side. The user interface must be maintained by non
programmers. Which user interface should the company architect?
A. use JSF
B. use JSP with JSTL
C. use Ajax with a servlet controller
D. use Java Swing distributed by JNLP
Answer: B

Question: 182
Your application accepts documents from unknown third parties over an encrypted connection.
The documents are accompanied by a digital signature that attests to the origin of the document.Which aspect of the system limits the degree of confidence you can have in the origin of any
given document if the implementation of all software is flawless?
A. The strength of the signature algorithm
B. The number of bits used in the signature
C. The strength of encryption used to hide the conversation
D. The certification practices associated with the certificate
Answer: D

Question: 183
You are architecting a DVD rental application that accepts customer feedback. Users can rank
movies from one to five by clicking on buttons, as well as input comments about the movie into a
text box. Which two can be addressed by filtering special characters from text boxes on JSP
forms? (Choose two.)
A. SQL injection
B. buffer overflow
C. authorization errors
D. cross-site scripting
Answer: A, D

Question: 184
Security restrictions in a use-case require that the behavior of an EJB business method vary
according to the role of the user. How should this be achieved?
A. The deployment descriptor is written using the roles determined by the programmer.
B. The programmer determines a role reference and uses it in the code. This is mapped to a
role in the deployment descriptor.
C. The business method determines the role of the user using JNDI and configuration
information in the deployment descriptor.
D. The business method determines the role of the user using JAAS and configuration
information in the deployment descriptor.
Answer: B

Question: 185
What is a major design characteristic of the Service To Worker pattern?
A. Control of transactions
B. Separation of concerns
C. Control of network traffic
D. Integration of legacy systems
Answer: B

Question: 186
An architect is designing a web application to support a broad array of web requests. During
analysis, the architect discovers that the application must perform complex logic to handle the
various requests it can receive. Additionally, the architect learns that each type of request has
specialized logic to perform. The architect knows that over time, new types of requests will be
added to the system. Given this scenario, which architecture is the easiest to expand and test?
A. Embedding the common logic in each of the application's JSPsB. Creating a controller object with a method of handling each JSP
C. Creating a controller object coupled with numerous command objects
D. Creating a service activator object and linking it to specialized business service objects
E. Creating a transfer object for each JSP and coupling those transfer objects with a front
controller
Answer: C

Question: 187
You are architecting a document storage system for next season's fashion designs. The system
must support many different encryption algorithms to secure those documents. Security of the
documents is the highest priority of the system. What are two valid concerns in this situation?
(Choose two.)
A. The most scalable solution is to use public key encryption for all encryption.
B. The system software must be able to be updated without decrypting all the files in the
system.
C. A single API should be used for all encryption algorithms allowing them to be used
interchangeably.
D. Each encryption algorithm should be deployed to its own server to keep deployment and
configuration simple.
E. Documents in the system can be stored unencrypted if the storage servers are properly
secured behind a firewall and DMZ.
Answer: B, C

Question: 188
With which two is the service-oriented architecture concerned? (Choose two.)
A. low cohesion
B. loose coupling
C. XML web services
D. stateful session handling
E. well-defined contracts
Answer: B, E

Question: 189
Which two statements describe the advantages of inheritance as compared to coding to an
interface? (Choose two.)
A. The reuse of existing code implementations.
B. Allows you to use one object in place of another.
C. Inheritance allows you to restrict the behavior of objects.
D. Inheritance promotes encapsulation better than interfaces.
E. Only through inheritance can an object be of multiple types.
Answer: A, C

Question: 190
You are architecting a complex multi-tiered web application. Within each tier you have designed
layers, the lowest being the hardware layer and the highest being the application layer. Which
statement is true?A. Generally, a given layer in one tier of this application should be concerned with the
technology used in the same layer of adjacent tiers.
B. To maximize separation of concerns, a given layer in a tier of this application should only
have knowledge of the adjacent layer in that tier.
C. For any given tier, separation of concerns is fulfilled when a given layer in that tier knows or
needs to know little or nothing of the layers below it.
D. If the layers in one tier of the application have been designed to achieve separation of
concerns, then the remaining tiers also achieve separation of concerns by default.
Answer: B

Question: 191
Which three are benefits of design patterns? (Choose three.)
A. They act as a learning aid.
B. They provide standard code libraries.
C. They provide a common design vocabulary.
D. They are best suited for implementation details.
E. They standardize the way designs are developed.
F. They provide a standard object-oriented development process.
Answer: A, C, E

Question: 192
A company is required by law to log and store comprehensive information on all access requests
made to its business logic API. Which design pattern is most suitable to provide this information
with a minimum of disruption to the existing servlet-based implementation?
A. Business Object
B. Session Facade
C. Intercepting Filter
D. Dispatcher View
Answer: C

Question: 193
What are two consequences of using the Observer pattern? (Choose two.)
A. The source is loosely coupled with the observer.
B. Changes in a source are broadcast to all observers.
C. The observer must be tightly coupled with the source.
D. An observer is restricted to observing only one source.
E. An adaptor is needed when subclasses of the source are added.
Answer: A, B

Question: 194
Which design pattern is represented by the JDBC ResultSet class?
A. Bridge
B. Iterator
C. Composite
D. Factory Method
Answer: B
Question: 195
What are three benefits of using the Data Access Object pattern? (Choose three.)
A. Enables transparency
B. Encapsulates access
C. Enables easier database migration
D. Simplifies the interface to business objects
Answer: A, B, C

Question: 196
A company is redesigning a core application and wants to ensure that it will scale over time,
because usage is expected to increase 400 percent in the next two years. Future-proofing is
important because the company's CEO has complained about how frequently the architecture
changes, requiring redesign and redevelopment work. The application will be extended
continuously over the next two years and the version of the database software used is also likely
to be upgraded. What is the most suitable architecture for the application?
A. Session beans accessing a JPA-based persistence tier
B. Session beans accessing a JDBC-based persistence tier
C. Session beans accessing an EJB 2.x BMP-based persistence tier
D. Session beans accessing an EJB 2.x CMP-based persistence tier
E. Plain old Java objects (POJOs) accessing a JPA-based persistence tier
Answer: A

Question: 197
Regulatory requirements force a real estate company to invoke an auditing function around each
of the business operations implemented in the business tier of its mortgage approval system. The
actual auditing code is distributed to developers as a black-box library that cannot be tampered
with. The company wants the process of invoking the auditing behavior to be automatic in all the
applications that together compose the system, without requiring any changes to their source
code. Repackaging of existing modules to satisfy the requirements is allowed. Which two
component types support adding the auditing code around each of the company's business
methods without any source code changes? (Choose two.)
A. JPA entity class
B. BMP entity bean
C. CMP entity bean
D. message-driven bean
E. stateless session bean
Answer: D, E

Question: 198
You are designing the persistence layer for your current project and deciding which approach is
best: an ORM-centric implementation or a direct SQL-based implementation. Which two
statements are guaranteed to be true in all cases when comparing the two approaches? (Choose
two.)
A. Persistence frameworks that do NOT subscribe to an open, standardized API are more
difficult to maintain in the long term.
B. ORM is a better choice than JDBC because it combines ease of development, database
independence/insulation, and tooling support with no runtime overhead.C. JDBC is a better choice than ORM, because it combines direct access to the database, a
minimal programming model, the best performance and scalability, and ease of development.
D. Any decision must consider and address the issues of performance, scalability, ease of
development, and ACID semantics, weighted according to the specific application being
designed.
Answer: A, D

Question: 199
A bank is launching a new mobile device notification channel to their online banking system that
will allow customers to receive SMS/text messages and email notifications regularly about their
current balance and recent transactions over a certain amount. The bank has 300 million
customers in thirty countries, covering time zones from GMT-8 to GMT+8. The messages sent
are informational only and are not legally binding. The mid and back office systems are built using
both relational databases and legacy mainframe-based systems. What is the most appropriate
method for the mid and back office systems to integrate with the mobile device notification
channel?
A. guaranteed messaging using message-driven beans (MDBs) consuming messages from a
JMS queue populated by the systems of record
B. unguaranteed messaging using message-driven beans (MDBs) consuming messages from a
JMS topic populated by the systems of record
C. unguaranteed messaging using message-driven beans (MDBs) consuming messages from a
JMS queue populated by the systems of record
D. stateless session beans retrieving records of interest directly from the mid and back office
systems using a combination of JDBC and green screen scraping
Answer: C

Question: 200
Which two statements are true when comparing JPA to EJB 2.x? (Choose two.)
A. JPA implementations are more scalable than EJB 2.x CMP or BMP entity beans.
B. Developers can use JPA to construct persistence models that map closely to business
domain models including inheritance and polymorphism.
C. JPA implementations are faster than EJB 2.x CMP or BMP entity beans.
D. Developers using the JPA need to implement fewer interfaces than in EJB 2.x.
Answer: B, D

Question: 201
A company has committed to support a non-functional requirement (NFR) that states it must
process all requests within 3 seconds. The company's customers are complaining that the system
is not meeting the NFR and you have been contracted to fix the system. The company is not sure
whether its customers are meeting the NFR. What is the most appropriate course of action?
A. Modify the architecture to implement threading of requests
B. Add another server to spread the load across more servers
C. Establish measurements, implement the measurements, move the code to production, and
determine a go-forward plan
D. Establish measurements, implement the measurements, load test in the test environment,
and determine a go-forward plan
Answer: D
Question: 202
An organization has several Java EE web services. There is a new requirement to write the
SOAP headers for each incoming web service request to a log file. What is the best way to log
these incoming headers using Java EE APIs?
A. Use a JAX-RPC client to access the SOAP headers and write them to a log
B. Use a JAX-WS handler to extract the SOAP headers and write them to a log
C. Use JMS to extract and route the SOAP headers to an MDB that writes them to a log
D. Use JAXB to parse the SOAP headers in the service implementation classes and write them
to a log
Answer: B

Question: 203
An online sporting goods store's web application uses HTTPSession to store shopping carts.
When the application is initially deployed, the business plan predicts only a few customers will
access the site. Over time, the store projects a steady increase in volume. The deployment plan
calls for a single web container in the initial deployment. As demand increases, the plan calls for
multiple web containers on separate hardware with clustered HTTPSession objects. Which two
principles will help the application meet the requirements and optimize performance? (Choose
two.)
A. The application should store as much as possible in HTTPSession objects.
B. The application should NOT make frequent updates to HTTPSession objects.
C. The application should make coarse-grained updates to HTTPSession objects.
D. The application should create new HTTPSession objects instead of updating existing objects.
Answer: B, C

Question: 204
An application produces messages to be processed by client applications. The application does
not know how many clients there are and the number of clients may change at any time. Any
client can process any message but a message must be processed by exactly one client. How
should the messages be sent to the clients?
A. Using a JMS topic
B. Using a JMS queue
C. Using XML over HTTP
D. Using a SOAP web service
Answer: B

Question: 205
A Java EE application needs to receive XML documents and send back synchronous responses.
The incoming XML documents are validated by the application against one of three distinct XML
schemas. What is the simplest mechanism with the least overhead to accomplish this task?
A. RMI over IIOP
B. XML over HTTP
C. JAVA IDL/CORBA
D. a SOAP web service
Answer: B

Question: 206A system architecture has two applications, one for billing and one for registration. The billing
system is an older CORBA interface for updating billing information. The registration system is
built using Java technology. A planned enhancement requires the registration application to
automatically update the external billing system. Which Java technology is best suited for the
enhancement?
A. JAXB
B. JAX-WS
C. Java IDL
D. RMI-JRMP
Answer: C

Question: 207
A Java EE application produces information that must be consumed by heterogeneous clients.
These clients include a mainframe, an application written in C++, and another Java EE
application running at a remote site. How should this application make this information available
to these clients?
A. an MDB
B. IP Multicast
C. a JMS topic
D. a web service
Answer: D

Question: 208
A developer builds a Java EE application that supports distributed transactions. The application
must participate in an existing transaction to update a database using JDBC and invoke a
transactional method on a remote system. Which two technologies could the developer choose to
access the remote system? (Choose two.)
A. Java Connector Architecture
B. Java Message Service (JMS)
C. Remote Method Invocation (RMI)
D. Simple Object Access Protocol (SOAP)
Answer: A, C

Question: 209
A company is deploying a real-time Java EE purchase order processing system. This system will
use an external application to access a customer's account status as part of the purchase order
approval process. This external application is deployed on the same hardware as the purchase
order processing system, but it is not written in the Java programming language. Which
technology should be used to retrieve the account status from the external system?
A. A JMS topic
B. A JMS queue
C. A synchronous web service
D. An asynchronous web service
Answer: C

Question: 210A company is replacing its aging IT infrastructure, but it does not have the resources to replace all
the legacy systems at once. There are many different mainframe applications, client-server
applications, and standalone programs that need to be integrated. Which API is best for creating
a new scalable and secure SOA?
A. JAXR
B. REST
C. SOAP
D. JAX-RPC
E. JAX-WS
Answer: E

Question: 211
A company architected and developed a Java EE application and now they are having problems
with the scalability of the system. The application uses JSPs and servlets deployed to a web
container, and stateless session beans and DAOs deployed to an EJB container. The
application's non-functional requirement for scalability is to support 500 concurrent users during
peak hours of operation. The application can currently support 500 concurrent users, but the
response time is 200 percent of what it is acceptable. You have been hired as an architect and
have been assigned to help resolve this problem. The company's management is concerned with
the hardware budgeting. What initial advice would you give to the company?
A. Add another web server
B. Start a new project to re-architect the application
C. Monitor the application to determine the potential problem areas
D. Add more memory and processors to the hardware hosting the EJB container
Answer: C

Question: 212
A company has retained you to advise them on which standard methodology they should use
when building their next-generation product suite using Java EE.
The core requirements are as follows:
The presentation tier must run inside a browser and deliver a compelling end-user experience.
The business logic tier must support transactions.
The persistence tier must be easy to develop, but not at the expense of runtime performance.
The company is designing for the future, and wants to use the most future-proof approach
possible. Which high-level solution most closely meets the stated requirements?
A. JSPs using JSTL communicating with controllers / POJOs, with the persistence model
implemented using JPA
B. JSPs using scriptlets communicating with stateful session beans using controllers, with the
persistence model implemented using JPA
C. JSPs using JSTL communicating with stateless session beans using controllers, with the
persistence model implemented using BMP entity beans
D. JSPs using JSTL coupled with an Ajax-enabling JavaScript library communicating with
stateless session beans using controllers, with the persistence model implemented using JPA
Answer: D

Question: 213
A software company developed an SaaS application written in Java EE using JSPs, stateless
session beans, entity beans, and DAOs. The application allows a customer to track employee
training and certifications. Customers have been complaining about the amount of data entry,because they must enter the information about the training and certifications. The company wants
to create a web service that allows training companies to send training information about a
student, so customers do NOT have to enter the information. You have been contracted to advise
the company on the creation of the web service.
What is your advice to this company?
A. Write a new entity bean implementing JAX-WS
B. Do nothing because the company has a JSP that can take input
C. Place @WebService on the stateless session bean that takes the training input
D. Place @WebService on the JSPs that accept the data entry for a training class
Answer: C

Question: 214
A travel company re-architected their application from a two-tier to a three-tier architecture. To
see what impact the new architecture would have on its non-functional requirements (NFRs), the
company built a prototype based on this new architecture. When they profiled it during testing, the
company noticed that clients often share domain objects and leverage some of each other's work.
Which characteristic of the prototype could improve based on their observation?
A. Security
B. Flexibility
C. Availability
D. Performance
Answer: D

Question: 215
A brokerage firm hired you to evaluate a re-architected CPU-bound application they use in-house
to do market forecasting. This application is currently architected using a single business tier,
where complex algorithms are used to process large amounts of data to forecast market trends.
The current machine cannot be scaled vertically any further. A prototype was built, in which the
business tier was split into two tiers, where one depends on services provided by the other. They
were then deployed to two servers for testing. The prototype exhibited better scalability. Which
statement would explain this result?
A. The applications deployed were simpler.
B. There were more resources available to process any one request.
C. There was additional network traffic between the two business tiers of the application.
D. The business model was simplified by partitioning it into tiers with well-defined limited
interactions.
Answer: B

Question: 216
A company has an existing system that is a three-tier architecture (presentation, business logic,
and database). It has both a rich client that mixes the presentation and business logic to be
installed on the desktop and a thin client that is accessed by a browser. You are performing an
audit of the architecture. Which non-functional requirement is a cause for concern?
A. Scalability
B. Availability
C. Performance
D. MaintainabilityAnswer: D

Question: 217
A company uses a mail order catalog and phone orders to sell its widgets. The company wants to
develop a new online retail site. Buying trends from the current orders show that customers
typically buy once or twice a year. The company has the following requirements for the site: ability
to shop quickly ability for web designers to modify the user interface (UI) monthly to provide a
new shopping experience ability to browse the catalog and find the product within three screens
What advice would you give this company about the user interface for this application?
A. Write the UI using servlets
B. Write the UI using JSF, or JSP with JSTL
C. Write the UI using Ajax accessing servlets directly
D. Write the UI using Java Swing and distribute using JNLP
Answer: B

Question: 218
Your consulting company has been asked to enhance an existing application. The current
application is a two-tier system in which all of the business logic is located in thick clients. You are
considering a solution that would involve moving the business logic out of the client (thus allowing
the client to be a standard browser), and moving the business logic into the server's database in
the form of stored procedures. Which statement is true about your proposed solution?
A. It will improve the scalability of the system.
B. It will improve the manageability of the system.
C. It will reduce the amount of traffic on the network.
D. It will, in effect, turn the application into a three-tier system.
Answer: B

Question: 219
A company is a startup that aggregates the product catalogs from several vendors and provides
an online shopping experience. Vendors maintain the company's catalog and product inventory in
vendor-unique relational databases that it hosts. The company has the following non-functional
requirement priorities for a new system: scalability, availability, and reliability. Which logical tier
map will maximize the non-functional requirement priorities as set forth by this company?
A. Presentation/business logic tier - database
B. Presentation tier - business logic tier - database
C. Presentation tier - business logic tier - resource tier - database
D. Presentation tier - database (business logic in stored procedures)
Answer: C

Question: 220
What are two consequences of using the Composite View pattern? (Choose two.)
A. Improves performance
B. Avoids duplicate content
C. Forces a whole-part dependency
D. Allows tables to be reused in multiple locations
E. Restricts all subviews to have a consistent view technology
Answer: B, D
Question: 221
Your company is a startup that created an application to support a local insurance company.
Insurance forms have a complicated object model with several levels of whole-part relationships.
Currently, the code to create insurance forms is complex and embedded in object model classes.
Your company has just won a bid from a major insurance corporation that handles clients across
multiple countries, and each country has its own rules about how insurance forms are
constructed. You need to separate the model creation from the model classes and support
different construction rules. Which two patterns should you apply? (Choose two.)
A. State
B. Proxy
C. Builder
D. Strategy
E. Prototype
Answer: C, D

Question: 222
Which three statements about the Visitor pattern are true? (Choose three.)
A. It is possible to provide a unified interface to a set of interfaces.
B. It has an object structure that contains many classes of objects with differing interfaces.
C. It has an object structure that contains many classes of objects with the same interfaces.
D. Many distinct and unrelated operations need to be performed on objects in an object
structure.
E. It is possible to define new operations over an object structure, but the classes in the object
structure rarely change.
F. It is possible to define new operations over an object structure, but the classes in the object
structure frequently change.
Answer: B, D, E

Question: 223
As an architect, you need a design pattern with the following capabilities: decouples storage
implementation details provides a uniform API to access various external resources encapsulates
proprietary features to facilitate maintainability Which design pattern should you choose?
A. Composite
B. Resource Tier
C. Data Access Object
D. Resource Controller
Answer: C

Question: 224
In EJB 3, annotations are embedded in compiled class files. Application assemblers, deployers
and administrators do not have the option of modifying them directly. They do, however, have the
option of modifying or creating deployment descriptors. Which two statements are true? (Choose
two.)
A. Deployers can override all of the information specified by application assemblers.
B. Application assemblers can override all of the information specified by developers.
C. Deployers can override some but not all of the information specified by application
assemblers.D. Application assemblers can override some but not all of the information specified by
developers
Answer: A, D

Question: 225
A relational data model has three tables (Customer, Address, and Purchase). You are comparing
modeling these tables with CMP entity beans and JPA using an ORM tool. Which two statements
are true? (Choose two.)
A. The JPA version contains fewer classes and interfaces.
B. The CMP version contains fewer classes and interfaces.
C. The JPA entity classes can be instantiated with the "new" statement.
D. In JPA entity classes, data are accessed using abstract getter methods.
E. Both CMP entity beans and JPA entity classes can be directly used as DAO classes.
Answer: A, C

Question: 226
Your company is bidding on a contract, which due to the presence of a large number of client
applications deployed in a geographically dispersed area, requires it to support an outdated web
service interface that uses SOAP 1.1. Which component type is the most appropriate to use,
given that your company wants to keep the amount of code to be written as small as possible?
A. Message-driven bean with JMS queue
B. Stateless session bean with RMI interface
C. Message-driven bean with JAXB document unmarshaller
D. Stateless session bean with JAX-WS web service interface
Answer: D

Question: 227
A company builds massive data warehouses for customers using proprietary database software
that until recently, ran on proprietary hardware for added speed. The warehouse software is
accessed from Java code using a JDBC driver that exposes the warehouse functionality as a
combination of ANSI SQL-99 syntax coupled with some company-specific extensions.
Performance of queries is important to both the company's management and its customers. It has
a team of 20 developers who are considered experts in the data warehouse. What is the optimal
architecture to use when accessing the data warehouse?
A. Session beans using ORM
B. Session beans using a JDBC connection pool
C. Session beans using EJB 2.x CMP entity beans
D. Session beans using EJB 2.x BMP entity beans with JPA
Answer: B

Question: 228
You are designing the next-generation purchase order processing system at your company.
Although the presentation and business logic tiers will be designed and built using the Java
platform, the existing relational database will be re-used, because its design has proven to be
fast, scalable, and reliable. Ease and speed of development is an important consideration. What
is the most appropriate server-side component to use when providing read-write access to the
existing database schema in the new application?A. stateless session beans using JDBC directly
B. Java Persistence API (JPA) accessed using a DAO layer
C. message-driven beans using a JMS queue and a DAO layer
D. stateful session beans coupled with a thread per concurrent request
E. bean-managed persistence (BMP) entity beans accessed using a DAO layer
Answer: B

Question: 229
A company has defined an XML-based document format that its business partners need to use to
submit order information. To guarantee confidentiality and information integrity at a fine level in
the presence of multiple processing steps, the company wants to take advantage of technologies
such as WS-Security and XML Digital Signatures. These technologies define SOAP headers that
can be used to sign and encrypt fragments of documents. Your task is to implement the web
service that accepts and processes the orders. Which component type should be used for the
web service endpoint?
A. stateless session bean with RMI interface
B. message-driven bean with web service interface
C. stateful session bean with web service interface
D. stateless session bean with access to the SOAP body
E. stateless session bean with access to the SOAP envelope
Answer: E

Question: 230
You are the architect for an in-house application used by a consulting corporation to schedule
internal resources to staff client engagements. The application will be used only by a well-defined
user group (the in-house HR team) and so will not be exposed to large spikes in demand. Two
phase commit semantics are not required, and the simple security model is addressed by
integration with the company's LDAP server at the presentation layer. The company does have a
36-month roadmap for their intranet which calls for incremental development of the application
over time. What is the best solution for implementing the business logic tier?
A. JSPs accessing the database directly is sufficient.
B. An MVC web framework with no persistence tier is sufficient.
C. An MVC web framework accessing session beans to access the persistence tier is sufficient.
D. Any standard web framework implementing the MVC model accessing the persistence tier is
sufficient.
Answer: D

Question: 231
A company that sells avatar skins for virtual reality environments has hired an architect consultant
to determine why their system runs slowly. The consultant finds that the business logic that
processes orders has been embedded into all of their JSPs using scriptlets. During load testing,
the responsiveness of the system is slow, but the CPU and VM-free memory utilization remain at
a low level. Which two are most likely causes of the problem? (Choose two.)
A. User requests are deadlocked.
B. The servlet instances are locked on every request.
C. The Java Virtual Machine is NOT configured properly.
D. Database connection pooling is NOT configured properly.
Answer: B, D
Question: 232
A company is embarking on a major new initiative, the creation of an eCommerce, B2C (business
to consumer) application to sell their widgets. As the lead architect, you need to decide whether
or not to use EJBs in the business tier of the architecture. The architecture is as follows: JSP <->
Controller <-> Business logic <-> JPA-based persistence. Which option represents the optimal
solution describing the business tier implementation?
Stateless session beans are required to update values in the database.
Entity beans are necessary to allow the controllers to access the JPA persistence layer.
Message-driven beans are required to decouple the controllers from the persistence tier.
Session beans are required in order to provide unit-of-work, security, and transaction
management semantics to the JPA layer.
Answer: D

Question: 233
A large enterprise employs numerous authors to produce content. The decision is made to use a
content management system (CMS) to store the content, and its metadata, in a few relational
databases. Multiple JSF-based web applications need to display the same data. What
implementation strategy would have the most impact on increasing reuse?
A. Using web services to access the CMS
B. Using an object relational mapping technology
C. Using a service locator to find the relational databases
D. Using a component-oriented web application framework
E. Using a templating mechanism to composite view components
Answer: E

Question: 234
A teenage fashion web site employs a dozen web designers skilled in graphic design, HTML, and
some JavaScript experience. You were hired by the company to create an architecture that
includes a small amount of dynamic content to integrate the web site with the company's order
entry system. Which three web technologies would you train the web designers to use to create
dynamic pages? (Choose three.)
A. the servlet API
B. JSP with standard tags
C. JSP with JSTL database tags
D. building new JSF components
E. standard JSF component tags
F. JSP with the Expression Language
Answer: B, E, F

Question: 235
(This is drag and drop type question will attach image later)

Question: 236
You are the architect on a project to build a bridge between the legacy customer service tool, an
outdated VT100 terminal server, and a company's new Java EE web application. You do NOT
have access to the terminal server and cannot deploy any code to it. Which approach should you
use to integrate the systems?
A. Use a DAO wrapped around a JDBC connection to query the legacy system
B. Deploy a CORBA server to the legacy system and use RMI-over-IIOP to communicate to it
C. Develop a session bean that wraps a screen-scraping tool to interact with the legacy system
D. Develop a web services-based service and use XML to communicate with the terminal serverAnswer: C

Question: 237
What are two characteristics of object-oriented design? (Choose two.)
A. scalability
B. manageability
C. encapsulation
D. polymorphism
E. cross-cutting concerns
Answer: C, D

Question: 238

































Question: 239