[Free] 2018(Jan) EnsurePass Examcollection Oracle 1z0-899 Dumps with VCE and PDF Download 51-60

Ensurepass.com : Ensure you pass the IT Exams 2018 Jan Oracle Official New Released 1z0-899
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-899.html

Java EE 6 Web Component Developer Certified Expert Exam

Question No: 51

Given:

1. lt;% int[] nums = {42,420,4200};

2. request.setAttribute(quot;fooquot;, nums); %gt; 3. ${5 3 It 6}

  1. S(requestScope[#39;foo#39;][0] ne 10 div0gt; 5. ${10 div 0}

    What is the result?

    1. true true

    2. false true

    3. false true 0

    4. true true Infinity

    5. false true Infinity

    6. An exception is thrown

    7. Compilation or translation fails

Answer: E

Question No: 52

Which EL expression returns true if no session has been established with current client?

  1. ${not(pageContext.session)}

  2. ${not(requestScope.session)}

  3. ${requestScope.sessions.this}

  4. ${sessionScope.empty}

Answer: A

Explanation:

Note:

  • A session is never null. The session is always present in JSP EL, unless you add

    lt;%@page session=quot;falsequot; %gt;

  • If you#39;d like to check if the session is new or has already been created, use HttpSession#isNew() instead.

    lt;c:if test=quot;${not pageContext.session[#39;new#39;]}quot;gt;

    lt;pgt;You#39;ve already visited this site before.lt;/pgt;

    lt;/c:ifgt;

    lt;c:if test=quot;${pageContext.session[#39;new#39;]}quot;gt;

    lt;pgt;You#39;ve just started the session with this request!lt;/pgt;

    lt;/c:ifgt;

    Question No: 53

    APIs for dynamically registering servlets and filters can be called at:

    1. Context initialization time

    2. Any time

    3. There is no way to dynamically register servlets and filters

    4. Context destruction time

    5. Injected into a servlet context

    Answer: A

    Question No: 54

    Which java code snippet checks whether the user is of the role “MANAGER” for a given HttpServRequest, httpServletRequest?

    1. httpServletRequest.isUserInRole(“MANAGER”);

    2. httpServletRequest.isCallerInRole(“MANAGER”);

    3. httpServletRequest.isPrincipalInRole(“MANAGER”);

    4. httpServletRequest.isAuthnticatedUserInRole(“MANAGER”);

    Answer: A

    Explanation: isUserInRole

    public boolean isUserInRole(java.lang.String role)

    Returns a boolean indicating whether the authenticated user is included in the specified logical quot;rolequot;. Roles and role membership can be defined using deployment descriptors. If the user has not been authenticated, the method returns false.

    Parameters:

    role – a String specifying the name of the role Returns:

    a boolean indicating whether the user making this request belongs to a given role; false if the user has not been authenticated

    Incorrect:

    Not B: isCallerInRole is depreciated.

    Question No: 55

    ServletRegistration.Dynamic can be used to configure (Choose two)

    1. Filter mappings

    2. add init params

    3. set asyncSupported to true

    4. add Listeners

    Answer: A,B

    Reference: http://www.softwareengineeringsolutions.com/blogs/2010/08/01/ (3rd paragraph)

    Question No: 56

    Which of the following annotations relate to security in a servlet?

    1. @WebSecurity

    2. @RolesAllowed

    3. @WebConstraint

    4. @HttpConstraint

    5. @Servletsecurity

    1. (i) only

    2. (i) and (iii)

    3. (iv) and (v)

    4. (iii) and (v)

    5. (ii) and (iv)

    Answer: C

    Question No: 57

    Refer to the Exhibit.

    Ensurepass 2018 PDF and VCE

    Assuming the tag library in the exhibit is imported with the prefix forum, which custom tag invocation procedures a transaction error in a jsp page?

    1. lt;forum:message from=quot;My Namequot; subject=quot;My Subjectquot; /gt;

    2. lt;forum:message subject=quot;My Subjectquot;gt; My message body.

      lt;/forum:messagegt;

    3. lt;forum:message from=quot;My Namequot; subject=quot;${param.subject}quot;gt;

      ${param.body}

      lt;/forum:messagegt;

    4. lt;forum:message from=quot;My Namequot; subject=quot;My Subjectquot;gt;

      lt;%= request.getParameter( quot;bodyquot; ) %gt;

      lt;/forum:messagegt;

    5. lt;forum:message from=quot;My Namequot;

    subject=quot;lt;%= request.getParameter( quot;subjectquot; ) %gt;quot;gt; My message body.

    lt;/forum:messagegt;

    Answer: D Explanation: New Questions

    Question No: 58

    Given the element from the web application deployment descriptor:

    lt;jsp – property – groupgt;

    lt;url – patterngt;/main/page1.jsplt;/url – patterngt;

    lt;scripting – invalidgt;truelt;/scripting – invalidgt;

    lt;/jsp-property-groupgt;

    And given that /main/page1.jsp contains:

    lt;% int i = 12; %gt;

    lt;bgt; lt;%= i %gt; lt;/bgt; What is the result?

    A. lt;bgt; lt;bgt;

    B. lt;bgt; l2 lt;/bgt;

    C. The JSP fails to execute.

    D. lt;% int i = 12 %gt;

    lt;bgt; lt;%= i % gt; lt; bgt;

    Answer: C

    Question No: 59

    You have built a web application that you license to small businesses. The webapp uses a context parameter, called licenseExtension, which enables certain advanced features based on your client’s license package. When a client pays for a specific service, you

    provide them with a license extension key that they insert into the lt;context-paramgt; of the deployment descriptor. Not every client will have this context parameter so you need to create a context listener to set up a default value in the licenseExtension parameter.

    Which code snippet will accomplish this goal?

    1. You cannot do this because context parameters CANNOT be altered programmatically.

    2. String ext = context.getParameter(‘licenseExtension’);if ( ext == null ) { context.setParameter(‘licenseExtension’ DEFAULT);}

    3. String ext = context.getAttribute(‘licenseExtension’);if ( ext == null ) { context.setAttribute(‘licenseExtension’ DEFAULT);}

    4. String ext = context.getInitParameter(‘licenseExtension’)if ( ext == null ) { context.resetInitParameter(‘licenseExtension’ DEFAULT);}

    5. String ext = context.getInitParameter(‘licenseExtension’)if ( ext == null ) { context.setInitParameter(‘licenseExtension’ DEFAULT);}

    Answer: A

    Question No: 60

    Which of following annotations can be used in a servlet class?

    ->@javax.annotation.Resource

    ->@javax.annotation.PreDestroy

    ->@javax.annotation.security.RunAs

    ->@javax.annotation.security.RolesAllowed

    ->@javax.servlet.annotation.WebServlet

    1. (v) only

    2. (i) and (v)

    3. (i), (ii), (iii) and (v)

    4. (i), (ii), (iv) and (v)

    5. (i), (ii), (iii), (iv) and (v)

    Answer: B

    Explanation: * (i) The javax.annotation.Resource annotation is used to declare a reference to a resource. @Resource can decorate a class, a field, or a method.

  • (v) javax.servlet.annotation Annotation Type WebServlet

Annotation used to declare a servlet.

This annotation is processed by the container at deployment time, and the corresponding servlet made available at the specified URL patterns.

Incorrect: