Weekend Sale Limited Time Flat 70% Discount offer - Ends in 0d 00h 00m 00s - Coupon code: 70spcl

GIAC GSSP-Java GIAC Secure Software Programmer – Java Exam Practice Test

Page: 1 / 28
Total 275 questions

GIAC Secure Software Programmer – Java Questions and Answers

Question 1

The java.util.logging package provides the classes and interfaces of the Java platform's core logging facilities. Which of the following are the main target uses of logs?

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

Options:

A.

Problem diagnosis by field service engineers

B.

Problem diagnosis by the development organization

C.

Problem diagnosis by end users and system administrators

D.

Problem diagnosis by developers

Question 2

Which of the following syntaxes can be used to retrieve a URL to a resource specified as WEBINF/example/sessionObject.txt?

Note. Assume that session is an instance of the HttpSession interface, request is an instance of the HttpServletRequest interface, and context is an instance of the ServletContext interface.

Options:

A.

context.getResource ("/example/sessionObject.txt")

B.

session.getResource ("/WEB-INF/example/sessionObject.txt")

C.

request.getResource ("/WEB-INF/example/sessionObject.txt")

D.

context.getResource ("WEB-INF/example/sessionObject.txt")

E.

context.getResource ("/WEB-INF/example/sessionObject.txt")

F.

request.getResource ("WEB-INF/example/sessionObject.txt")

Question 3

Peter works as a Software Developer for Neon Inc. He is developing an application in Java. He declares an interface. Which of the following field declarations are valid within the body of an interface?

Each correct answer represents a complete solution. Choose three.

Options:

A.

final static int answer=42;

B.

public static int answer = 42;

C.

private final static int answer=42;

D.

public int answer=42;

E.

int answer;

Question 4

You work as programmer for PassGuide.Inc. You have purchased a Web application named

SecureProgrammer that uses the programmatic authorization, and the security roles that are not used in your organization. Which of the following deployment descriptor elements must you use so that the SecureProgrammer application can work with your organization?

Options:

A.

B.

C.

D.

Question 5

Which of the following statements about data integrity of a container are true?

Each correct answer represents a complete solution. Choose two.

Options:

A.

It ensures that an eavesdropper cannot read an HTTP message being sent from a client to a container.

B.

Data integrity ensures that information has not been modified by a third party while it is in transit.

C.

It ensures that a hacker cannot alter the contents of an HTTP message while it is in transit from a container to a client.

D.

Data integrity ensures that information is made available to users who are authorized to access it.

Question 6

Which of the following classes is an engine class designed to provide conversions between opaque cryptographic keys and allows you to build an opaque key object from a given key specification?

Options:

A.

KeyPair

B.

KeyFactory

C.

CertificateFactory

D.

KeyPairGenerator

Question 7

Which of the following elements contains the element in the deployment descriptor?

Options:

A.

B.

C.

D.

E.

Question 8

Mark works as a Programmer for InfoTech Inc. He develops a code snippet for a class named

servletClassA that extends the HttpServlet class. Which of the following HttpServlet class methods are not required to be overridden by the servletClassA?

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

Options:

A.

doDelete()

B.

doPost()

C.

doGet()

D.

doOptions()

E.

service()

Question 9

Which of the following statements about various authentication mechanisms in J2EE are true?

Options:

A.

The FORM based authentication requires a user to possess a Public Key Certificate.

B.

The realm string of the BASIC authentication must reflect a security policy.

C.

In case of the CLIENT-CERT authentication, a base-64 encoded user name and password is used.

D.

The DIGEST authentication may or may not be supported for a J2EE 1.4 compliant Web container.

Question 10

You work as a Software Developer for UcTech Inc. You are building a Web site that will contain study materials on the Java language. The company wants that members can access all the pages, but nonmembers have only limited access to the Web site pages. Which of the following security mechanisms will you use to accomplish the task?

Options:

A.

Authentication

B.

Data integrity

C.

Confidentiality

D.

Authorization

Question 11

Given the following directory structure.

Question # 11

Assuming that the current directory is com, which of the below options can be used to create a jar file called TestJar.jar that contains all the files from the directory testApp?

Options:

A.

jar -zf TestJar.jar

B.

jar -cf TestJar.jar

C.

jar -tf TestJar.jar

D.

jar -cf TestJar.jar testApp

Question 12

Rachel works as a Software Developer for Vivanet Inc. She writes the following code using Java.

class catchexcp

{public static void metha()

{int x=4/0;System.out.print("Caught exception");}

public static void main(String args[])

{try{metha();}catch(ArithmeticException ae){System.out.print("Caught ArithmeticException");}finally{try{metha();}catch(ArithmeticException ae){System.out.print("ReCaught ArithmeticException");}}}}

What will happen when she tries to compile and execute the code?

Options:

A.

It will compile and execute and will display ReCaught ArithmeticException.

B.

It will not compile.

C.

It will compile but will throw an exception at runtime.

D.

It will compile and execute and will display Caught exception Caught ArithmeticException

ReCaught ArithmeticException.

E.

It will compile and execute and will display Caught exception ReCaught ArithmeticException.

F.

It will compile and execute and will display Caught ArithmeticException ReCaught

ArithmeticException.

Question 13

Which of the following validates an HTML form at client-side before submitting it to the server?

Options:

A.

JNDI

B.

Java Applet

C.

JMS

D.

JavaScript

Question 14

Mark works as a Programmer for InfoTech Inc. He develops a RefreshFailed.jsp page for a servlet. He wants that the RefreshFailed.jsp page will be displayed when the

javax.security.auth.RefreshFailedException is thrown. Which of the following error-page deployment descriptor element declarations will be used?

Options:

A.

javax.security.auth.RefreshFailedException

RefreshFailed.jsp

B.

javax.security.auth.RefreshFailedException

RefreshFailed.jsp

408

C.

javax.security.auth.RefreshFailedException

RefreshFailed.jsp

D.

javax.security.auth.RefreshFailedException

RefreshFailed.jsp

Question 15

Mark works as a Programmer for InfoTech Inc. He develops a session bean class named

accountService. Which of the following rules must be conformed by the session bean class?

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

Options:

A.

It can be used without the @Stateful or @Stateless annotation.

B.

It must implement the business methods defined in the business interface.

C.

It can implement any optional business method annotated by the @Remove annotation.

D.

It must have a public constructor that takes a string as its parameter.

E.

It requires helper classes to meet the needs of an application.

Question 16

You work as a Software Developer for BlueTech Inc. You create code using EJB 3.0. You want to ensure that each new record is checked for validation before it is inserted into the database. Which of the following callback methods will you use to write the logic for validation?

Options:

A.

PostUpdate

B.

PreUpdate

C.

PostLoad

D.

PrePersist

Question 17

Harry works as a Software Developer for SoftTech Inc. He has developed a Java application to perform various SQL statements such as INSERT, UPDATE, etc., against a database table named Employee. He has used the executeUpdate() method to perform various SQL queries and to know the exact affected rows in the database if any of the operations is performed against the database table.

Which of the following types of values is returned by this method?

Options:

A.

Double

B.

Integer

C.

Float

D.

String

Question 18

What will be the output of the following program?

class Stringtest

{

public static void main(String args[])

{

String s= "test";

s.concat("paper");

System.out.println(s);

}

}

Options:

A.

It will display test.

B.

It will display testpaper.

C.

It will generate a compile-time error.

D.

It will display paper.

Question 19

Which of the following statements about the String, StringBuffer, and StringBuilder classes are true?

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

Options:

A.

The StringBuffer class offers faster performance than the StringBuilder class.

B.

The StringBuffer class is thread-safe while the StringBuilder class is not.

C.

A character in a string can be searched using the indexOf() operator.

D.

The return type of the trim() method present in the String class is void.

Question 20

You have created a Java application that will retrieve and insert data into a database table. Which of the following objects will you use to pass the JDBC Driver to obtain a connection to the database server?

Options:

A.

DriverManager

B.

ResultSet

C.

Connection

D.

Statement

Question 21

You work as a Programmer for InfoTech Inc and develop the following two

declarations.

Manager

/acme/Manager/*

GET

POST

Manager

/acme/Manager/*

GET

POST

Manager

</auth-constraint>

Which of the following statements is true about the in the code given above?

Options:

A.

Nobody is allowed to access the specified resources.

B.

Only Manager is allowed to access the specified resources.

C.

The first element declaration is incorrect.

D.

It is not possible to define the multiple security constraint on a single resource.

Question 22

Which of the following exceptions will be thrown if the caller does not have permission to invoke the doAsPrivileged method?

Options:

A.

LoginException

B.

NullPointerException

C.

SecurityException

D.

PrivilegedActionException

Question 23

You work as a Software Developer for UcTech Inc. You create a session using the HttpSession interface. You want the attributes to be informed when the session is moved from one JVM to another and also when an attribute is added or removed from the session. Which of the following interfaces can you use to accomplish the task?

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

Options:

A.

HttpSessionBindingListener

B.

HttpSessionListener

C.

HttpSessionActivationListener

D.

HttpSessionAttributeListener

Question 24

Sam works as a Software Developer for Gentech Inc. He writes the following code.

1. class TryFinallyTest {

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

3. try {

4. int i=15/0;

5. System.out.println("Testing Try");

6. }

7. catch(ArithmeticException ae) {

8. System.out.println("Arithmetic exception");

9. }

10. System.out.println("Correct");

11. finally {

12. System.out.println("Must execute");

13. }

14. }

15. }

What will happen when he attempts to compile and execute the code?

Options:

A.

It will compile successfully and run with output Arithmetic exception.

B.

It will compile successfully and run with output Must execute.

C.

It will compile successfully and run with output Correct.

D.

It will give a compile-time error.

Question 25

Which of the following classes is an engine class that provides an opaque representation of cryptographic parameters?

Options:

A.

DSAPublicKeySpec

B.

AlgorithmParameterGenerator

C.

DSAParameterSpec

D.

AlgorithmParameters

Question 26

Which of the following statements are true about object serialization?

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

Options:

A.

After deserialization, objects have the same state as it had when it was serialized.

B.

It uses ObjectOutputStream to deserialize objects.

C.

It uses the ObjectInput and ObjectOutput interfaces.

D.

An object will have the same state at deserialization as it had at the time it was serialized if all its superclasses are also serializable.

Question 27

Drag and drop the appropriate authentication types from the given options to match their properties.

Question # 27

Options:

A.

Question 28

You write the following code.

class Father {public void Method() {System.out.println("I am Father");}}

public class Son extends Father {public static void main(String argv[]) {Son son = new Son();son.Method();}

private void Method() {System.out.println("I am Son");}}

Which of the following will be the result, when you try to compile and run the code?

Options:

A.

I am Father will be displayed as the output.

B.

A runtime error will result.

C.

I am Son will be displayed as the output.

D.

The code will execute but without displaying any output.

E.

A compile-time error will result.

Question 29

Which of the following annotations specifies the roles that are allowed to invoke a particular bean method?

Options:

A.

@DenyAll

B.

@RolesAllowed

C.

@RunAs

D.

@DeclareRoles

E.

@PermitAll

Question 30

Which of the following exceptions will be thrown if a cipher is in decryption mode but the decrypted data is not bounded by the appropriate bytes?

Options:

A.

IllegalArgumentException

B.

ShortBufferException

C.

ReadOnlyException

D.

BadPaddingException

Question 31

Which of the following exceptions will be thrown if the checkSecurityAccess() method uses an empty target as its parameter value?

Options:

A.

NullPointerException

B.

SecurityException

C.

NoArgumentException

D.

IllegalArgumentException

Question 32

Which of the following is the return type of the getInitParameter() method of the ServletContext interface?

Options:

A.

Enumeration

B.

String

C.

String array

D.

ServletContext

E.

Integer

Question 33

Which of the following methods throws a SecurityException if the calling thread is not allowed to open a socket connection to the specified host and port number?

Options:

A.

checkDelete()

B.

checkExec()

C.

checkCreate()

D.

checkConnect()

Question 34

Which of the following exceptions will be thrown if the commit() method fails?

Options:

A.

DestroyFailedException

B.

NullPointerException

C.

LoginException

D.

SecurityException

Question 35

Which of the following statements about the String, StringBuffer, and StringBuilder classes are true?

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

Options:

A.

The StringBuffer class offers faster performance than the StringBuilder class.

B.

The StringBuffer class is thread-safe while the StringBuilder class is not.

C.

A character in a string can be searched using the indexOf() operator.

D.

The return type of the trim() method present in the String class is void.

Question 36

Which of the following statements is true about the Java synchronized keyword?

Options:

A.

It prevents multiple threads from accessing a block of code at the same time.

B.

It allows the class to be loaded as soon as the JRE starts.

C.

It prevents multiple developers from code redundancy.

D.

It allows two different functions to execute in a shared manner.

Question 37

Which of the following statements are true?

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

Options:

A.

An inner class cannot be defined as private.

B.

An inner class cannot be defined as protected.

C.

An inner class can be defined as private.

D.

An inner class can extend another class.

Question 38

Which of the following elements is used as a parameter in the EJBContext.isCallerInRole() method?

Options:

A.

ejb-name

B.

initial-value

C.

role-name

D.

role-link

Question 39

The ______________ method of the EJBContext interface tests whether the client is a member of the role specified in the argument to the method.

Options:

A.

isMember()

B.

isAuthorized()

C.

getCallerPrincipal()

D.

isCallerInRole(String rolw)

E.

getUserTransaction()

Question 40

Which of the following deployment descriptor elements is used to declare the reference of a

client's application to an external resource?

Options:

A.

B.

C.

D.

Question 41

You have written the following code snippet.

1. public class Read {

2. protected int ReadText(int x) { return 0; }

3. }

4. class Text extends Read {

5. /*insert code here*/

6. }

Which of the following methods, inserted independently at line 5, will compile?

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

Options:

A.

private int ReadText(long x) { return 0; }

B.

protected long ReadText(int x, int y) { return 0; }

C.

protected long ReadText(long x) { return 0; }

D.

protected int ReadText(long x) { return 0; }

E.

private int ReadText(int x) { return 0; }

F.

public int ReadText(int x) { return 0; }

G.

protected long ReadText(int x) { return 0; }

Page: 1 / 28
Total 275 questions