Last Updated on March 20, 2022 by Admin 2

GSSP-Java : GIAC Secure Software Programmer-Java : Part 07

  1. Maria works as a Software Developer for Bluetech Inc. She develops a class named Warden that needs to access a class named Hostel, which is deployed in a JAR named City.JAR. What will she do in order to enable the Warden class to have access to the Hostel class during compilation?

    • She will place the JAR file in javaprog/City.JAR and set the class path environment to include javaprog/City.JAR/Warden.class.
    • She will place the JAR file in javaprog/City.JAR and set the class path environment to include javaprog/City.JAR/Hostel.class.
    • She will place the JAR file in $ JAVA_HOME/jre/lib/ext/City.JAR.
    • She will place the JAR file in $ JAVA_HOME/jre/classes/City.JAR.
  2. Consider the given lines of codE.

    package ucert

    class memberaccess

    {

    public int mem = 10;

    }

    Which of the following can directly access the variable mem?

    • Any class
    • Any class that extends the memberaccess class
    • Only the memberaccess class
    • Any class in the package ucert
  3. Which of the following keywords is used to throw an exception object inside a method?

    • throw
    • catch
    • final
    • throws
    • finally
    • assert
  4. Identify whether the given statement is true or false.

    “JAR files can be used while compiling but not while executing other files.”

    • False
    • True
  5. Which of the following fields must be present in the login page when using the form-based authentication?

    Each correct answer represents a part of the solution. Choose two.

    • get_pw
    • user_pw
    • j_login
    • j_password
    • j_pw
    • j_username
  6. Which of the following symbols is used to designate a named input parameter?

    • ?
    • ;
    • :
    • !
  7. SIMULATION

    Fill in the______blank with the required interface name to complete the statement below.
    An object of the interface is provided by the container to invoke the next filter in a chain of filters.

    • FilterChain
  8. You work as a developer for PassGuide Inc. You have implemented a session bean with a method doPrint(), which behaves differently depending on the caller’s security role. Only MANAGER in the security roles “ADMIN” and “MANAGER” are allowed to call the method. Which of the following actions are appropriate to accomplish if there is no security-related metadata in the deployment descriptor?

    Each correct answer represents a complete solution. Choose all that apply.

    • Annotate method doPrint() with @RolesAllowed({“ADMIN”,”MANAGER”}).
    • Annotate method doPrint() with @PermitAll.
    • If EJBContext.isCallerInRole(“ADMIN”) returns true, implement the behavior defined for MANAGER in role “ADMIN”.
    • If EJBContext.getCallerPrincipal returns role “ADMIN”, implement the behavior for MANAGER in role ADMIN.
  9. Which of the following will be returned by the expression “string” instanceof String?

    • 0
    • 1.0
    • null
    • false
    • 0.0
    • true
  10. Which of the following JAR file options is used for creating an archive?

    • -v
    • -u
    • -x
    • -c
  11. Which of the following syntaxes is used to run the application packaged as a JAR file?

    • javac jar app.jar
    • javac -jar app.jar
    • java -jar app.jar
    • java jar application.jar
  12. Which of the following JAR file options creates and includes a manifest file?

    • -M
    • -v
    • -0
    • -m
  13. Identify whether the given statement is true or false.

    “JAR files can be used while compiling but not while executing other files.”

    • False
    • True
  14. Identify whether the given statement is true or false.

    “An object becomes eligible for garbage collection when it becomes unreachable by any code.”

    • False
    • True
  15. Which of the following is the valid permission for a BasicPermission?

    • *
    • a*b
    • *.com
    • *java
  16. Which of the following modifiers is not an access modifier?

    • protected
    • abstract
    • public
    • private
  17. Which of the following exceptions will be thrown by the getFeature() method if the feature value cannot be assigned or retrieved?

    • IllegalArgumentException
    • SAXNotSupportedException
    • NullPointerException
    • SAXNotRecognizedException
  18. Mark works as a Programmer for InfoTech Inc. He develops the following code snippet. class Auto

    {public static void main(String args[])

    {Character iob =’d’;float i=iob;System.out.println(iob);}}

    What will be the result when Mark tries to execute the code snippet?

    • It will display d.
    • It will show a runtime error.
    • It will show a compile-time error.
    • It will display 0.00.
  19. Which of the following methods belongs to the FilterConfig interface and ServletConfig interface both?

    Each correct answer represents a complete solution. Choose all that apply.

    • getInitParameter()
    • getServletContext()
    • getFilterName()
    • getInitParameterNames()
  20. You work as a Software Developer for UcTech Inc. You want to use form-based authentication as a security mechanism in your application. Which of the following entries will you use in your login page to accomplish the task?

    Each correct answer represents a part of the solution. Choose all that apply.

    • j_pw
    • j_security_check
    • password
    • _jid
    • j_username
    • j_password
    • jid
    • j_un