GSSP-Java GIAC Secure Software Programmer-Java

Loading demo links...

Showing 10–12 of 15 questions

Question 10 (Volume C)

Which of the following attribute scopes does not exist for a Servlet?

Select an option, then click Submit answer.

  • Request

  • Session

  • Context

  • Page

Question 11 (Volume A)

Mark works as a Programmer for InfoTech Inc. He develops a class named Data that imports all the required packages. The class Data uses a method named PrintData(), which uses a method that checks whether the caller has a BeanUser security role. Which of the following code of the method PrintData() will satisfy the requirement?

Select an option, then click Submit answer.

  • public void PrintData()
    {
    @DeclareRoles("BeanUser")
    @Resource SessionContext ctx;
    @RolesAllowed("BeanUser")
    Principal caller = ctx.getCallerPrincipal(); if (ctx.getCallerIdentity("BeanUser")) { System.out.println("It is the correct user");}
    else{System.out.println("It is the incorrect user");}//more code}

  • public void PrintData()
    {@DeclareRoles("BeanUser")
    @Resource SessionContext ctx;
    @RolesAllowed("BeanUser")
    Principal caller = ctx.getEJBHome();
    if (!isCallerInRole(ctx)) {System.out.println("It is the correct user");} else{System.out.println("It is the incorrect user");}//more code}

  • public void PrintData()
    {@DeclareRoles("BeanUser")
    @Resource SessionContext ctx;
    @RolesAllowed("BeanUser")
    Principal caller = ctx.getCallerPrincipal(); if (ctx.isCallerInRole("BeanUser")) { System.out.println("It is the correct user");}
    else{System.out.println("It is the incorrect user");}//more code}

  • public void PrintData()
    {@DeclareRoles("BeanUser")
    @Resource SessionContext ctx;
    @RolesAllowed("BeanUser")
    Principal caller = ctx.getCallerPrincipal();
    if (ctx.getStatus("BeanUser")) {System.out.println("It is the correct user");} else{System.out.println("It is the incorrect user");}//more code}

Question 12 (Volume B)

Mark works as a Software Developer for ZenTech Inc. He writes the following code.

1. public class Ques0352 {

2. public static void main(String[] args) {

3. String s1="JavaObject";

4. String s1="ObjectJava";

5. String s2="ObjectJava";

6. if(s2.equals(s1))

7. { System.out.println("Equal"); }

8. else

9. { System.out.println("Unequal"); }

10. }

11. }

Which of the following will happen to the code when he attempts to compile and run it?

Select an option, then click Submit answer.

  • It will compile successfully and Unequal will be displayed as output.

  • It will give a compile-time error at line 3.

  • It will compile successfully and Equal will be displayed as output.

  • It will give a compile-time error at line 4.