New Year Special 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: best70

GSSP-Java GIAC Secure Software Programmer - Java Questions and Answers

Questions 4

Which of the following statements are true?

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

Options:

A.

StringBuffer is thread safe, but StringBuilder is not.

B.

The String class is final.

C.

StringBuilder offers faster performance than StringBuffer.

D.

The size of the String can be obtained using the length property.

Buy Now
Questions 5

Which of the following mechanisms is closely related to authorization?

Options:

A.

Sending data so that no one can alter it on the way.

B.

Allowing access to a particular resource.

C.

Verifying username and password.

D.

Sending secret data such as credit card information.

Buy Now
Questions 6

Which of the following methods performs the authentication of subject and, if successful, associates Principals and Credentials with the authenticated Subject?

Options:

A.

The getSubject() method of the LoginContext class

B.

The login() method of the LoginModule interface

C.

The login() method of the LoginContext class

D.

The initialize() method of the LoginModule class

Buy Now
Questions 7

What will be the output of the following code snippet?

class test22

{

public static void main(String args[])

{

String str= new String("Hello");

str.insert(3,"bye");

System.out.println(str);

}

}

Options:

A.

It will display Hello.

B.

It will display Helbyelo.

C.

It will throw NFE.

D.

It will generate a compile-time error.

Buy Now
Questions 8

Which of the following is a mandatory sub-element of the element of the deployment descriptor?

Options:

A.

B.

C.

D.

Buy Now
Questions 9

Which of the following exceptions is thrown if a class uses the clone() method but does not implement the Cloneable interface?

Options:

A.

CloneDoesNotExistException

B.

ClassNotFoundException

C.

CloneNotSupportedException

D.

NullPointerException

Buy Now
Questions 10

Which of the following are correct if LoginContext enforces the requisite flag to each LoginModule in the configuration file?

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

Options:

A.

If LoginModule succeeds, authentication continues down the LoginModule list.

B.

If LoginModule succeeds or fails, authentication still continues to proceed down the LoginModule list.

C.

The LoginModule is required to succeed.

D.

If LoginModule fails, control immediately returns to the application (authentication does not proceed down the LoginModule list).

Buy Now
Questions 11

Mark works as a Programmer for InfoNet Inc. He writes the following programs.

1. package book;

2. public class read

3. {

4. (access modifier) int r1=10;

5. }

1. package book1;

2. import book.read;

3. class Doread extends read

4. {

5. public void test()

6. {

7. System.out.println("The value of r1 is." +r1);

8. }

9. }

Which of the following access modifiers will be put in the place of the word, (access modifier), to compile the program successfully?

Options:

A.

default

B.

public

C.

protected

D.

private

E.

volatile

Buy Now
Questions 12

Which of the following methods can be invoked by a message-driven bean?

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

Options:

A.

MessageDrivenContext.isCallerInRole()

B.

MessageDrivenContext.getUserTransaction()

C.

MessageDrivenContext.getEJBHome()

D.

MessageDrivenContext.getRollbackOnly()

Buy Now
Questions 13

Mark works as a Programmer for InfoTech Inc. He develops an application named JavaServices. He wants to declare a security constraint that will restrict everything in the com/files directory so that security role of Admin can invoke any http methods on the resources. Which of the following element declarations will be used to accomplish the task?

Options:

A.

JavaServices

com/files

Admin

B.

JavaServices

com/files/*

Admin

C.

JavaServices

com/files/*

*

Admin

D.

JavaServices

com/files/*

Admin

Buy Now
Questions 14

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

Buy Now
Questions 15

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?

Options:

A.

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

B.

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

C.

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

D.

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

Buy Now
Questions 16

You have the following code fragment of a Java program named test.

12. public void getData(){

13. ArrayList numbers=new ArrayList();

14. for(int i=0; i<10;1++){

15. int value=i*((int i) Math.random());

16. Integer obj=new Integer(value);

17. numbers.add(obj);

18. }

19. System.out.println(numbers);

20. }

On which of the following lines of code will the object referenced by obj be eligible for garbage

collection?

Options:

A.

Line 18

B.

Line 19

C.

Line 17

D.

Line 20

Buy Now
Questions 17

Mark works as a Programmer for InfoTech Inc. He develops the following program.

class iftest2

{public static void main(String args[])

{int x=0, y=1;if //code//{System.out.println("true");}}}

Which of the following if statements are illegal if they are placed at //code//?

Options:

A.

(y == true)

B.

(1)

C.

(x == false)

D.

(x == 1)

E.

(x)

F.

(x != y)

Buy Now
Questions 18

Which of the following methods are used in the verification of a signature?

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

Options:

A.

initVerify

B.

update

C.

verify

D.

initSign

Buy Now
Questions 19

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

Options:

A.

B.

C.

D.

E.

Buy Now
Questions 20

Samantha works as a Software Developer for Bluetech Inc. She develops a class Warden that needs to access the Hostel class. The Hostel class is deployed in a JAR named City.JAR. What should be done so that during compilation the Warden class has access to the Hostel class?

Options:

A.

The JAR file should be located in $ JAVA_HOME/jre/classes/City.JAR.

B.

The JAR file should be located in javaprog/City.JAR and the class path environment should be set to include javaprog/City.JAR/Hostel.class.

C.

The JAR file should be located in $ JAVA_HOME/jre/lib/ext/City.JAR.

D.

The JAR file should be located in javaprog/City.JAR and the class path environment should be set to include javaprog/City.JAR/Warden.class.

Buy Now
Questions 21

Roger works as a Software Developer for Tech Mart Inc. He creates an application using Enterprise JavaBeans. In the bean class, he writes a code snippet as follows.

Boolean b = ctx.isCallerInRole("Administrator");

The application assembler named Bob declares the following entries within the element of the deployment descriptor.

1.

2. The HR-Manager will have permission to access all the methods.

3. HR-Manager

4.

5.

Bob wants to ensure that HR-Manager declared in the deployment descriptor should have all the privileges of an administrator. Which of the following elements should Bob declare in line 4 while deploying the bean?

Options:

A.

B.

C.

D.

Buy Now
Questions 22

Which of the following statements are true about Vector and ArrayList?

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

Options:

A.

ArrayList is synchronized and Vector is not synchronized.

B.

Each vector tries to optimize storage management by maintaining a capacity and a

capacityIncrement.

C.

If multiple threads are trying to access an ArrayList instance concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally.

D.

Vector is an implementation of the List interface and implements all optional list operations, and permits all elements, excluding null.

Buy Now
Questions 23

There are two threads defined in an application named "thread1" and "thread2". Which of the following options can be the direct cause of "thread1" becoming blocked?

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

Options:

A.

thread1 attempt to read from a file

B.

thread1 executes thread2.sleep(3000)

C.

thread2 executes thread1 sleep(3000)

D.

thread1 raises its own priority

E.

thread1 executes new Thread (someRunnable)

Buy Now
Questions 24

Which of the following methods is used by the AccessController to determine whether or not a requested permission is used by another permission that is known to be valid in the current execution context?

Options:

A.

equals

B.

checkPermission

C.

implies

D.

validate

Buy Now
Questions 25

Identify whether the given statement is true or false.

"When a Java program starts up, one thread begins running immediately."

Options:

A.

True

B.

False

Buy Now
Questions 26

You work as a programmer for PassGuide.Inc. You have a session object named session1 with an attribute named Attribute1, and an HttpSessionBindingEvent object binding1 bound to session1.

Which of the following will be used to retrieve Attribute1?

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

Options:

A.

Object obj=binding1.getSession().getAttribute("Attribute1");

B.

Object obj=binding1.getAttribute("Attribute1");

C.

Long MyAttribute=session1.getAttribute("Attribute1");

D.

String str1=session1.getAttribute("Attribute1");

E.

Object obj=session1.getAttribute("Attribute1");

Buy Now
Questions 27

Which of the following methods causes the currently executing thread object to temporarily pause and allow other threads to execute?

Options:

A.

sleep()

B.

notify()

C.

finalize()

D.

interrupted()

E.

yield()

F.

notifyAll()

Buy Now
Questions 28

The following JSP scriptlet is given.

<% response.setContentType("text/html; charset=ISO-8859-1"); %>

Which of the following directives is the equivalent directive for the scriptlet given above?

Options:

A.

<%@ include contentType="text/html; pageEncoding=ISO-8859-1" %>

B.

<%@ include contentType="text/html; charset=ISO-8859-1" %>

C.

<%@ page contentType="text/html; charset=ISO-8859-1" %>

D.

<%@ taglib contentType="text/html; pageEncoding=ISO-8859-1" %>

Buy Now
Questions 29

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.

Buy Now
Questions 30

According to the EJB programming restrictions, which of the following should be used to access the files or directories?

Options:

A.

A resource manager API

B.

An output device such as screen display

C.

An enterprise bean

D.

An input device such as a keyboard

Buy Now
Questions 31

Which of the following symbols is used to designate a named input parameter?

Options:

A.

?

B.

;

C.

:

D.

!

Buy Now
Questions 32

Which of the following statements can be used by a Programmer to suggest the JVM to perform garbage collection?

Options:

A.

Runtime.getRuntime().freeMemory();

B.

Runtime.getRuntime().totalMemory();

C.

new Thread().destroy();

D.

System.gc();

E.

System.runFinalization();

F.

System.setOut();

Buy Now
Questions 33

Which of the following methods reinitializes the logging properties?

Options:

A.

reset

B.

addlogger

C.

reinitialize

D.

readConfiguration

Buy Now
Questions 34

Which of the following is used to restore the objects that have been previously serialized by a stream?

Options:

A.

FileInputStream

B.

ObjectOutputStream

C.

ObjectInputStream

D.

FileOutputStream

Buy Now
Questions 35

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.

Buy Now
Questions 36

Which of the following elements of the java.util.logging package exports objects to a variety of destinations including memory, output streams, consoles, files, and sockets?

Options:

A.

LogRecord

B.

Filter

C.

Logger

D.

Handler

Buy Now
Questions 37

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?

Options:

A.

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}

B.

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}

C.

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}

D.

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}

Buy Now
Questions 38

Which of the following actions can you take to seal two packages, PackageA and PackageB, in the JAR file MyJar.jar?

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

Options:

A.

Execute the following command.

jar cvf MyJar.jar Manifest.txt MyPackage/*.class

B.

Create a text file named Manifest.txt with the following contents.

Name. myCompany/*Sealed. true

C.

Execute the following command.

jar cmf MyJar.jar Manifest.txt MyPackage/*.class

D.

Create a text file named Manifest.txt with the following contents.

Name. myCompany/PackageA/Sealed. true

Name. myCompany/PackageB/

Sealed. true

Buy Now
Questions 39

Which of the following statements about programmatic security are true?

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

Options:

A.

The bean provider is responsible for writing code for programmatic security.

B.

It is also called as instance level security.

C.

It is implemented using methods of the EJBContext interface.

D.

It is implemented using the methods of the UserTransaction interface.

Buy Now
Questions 40

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

Buy Now
Questions 41

Mark writes a class Practice.java. This class needs to access the com.bar.Test class that is stored in the Test.jar file in the directory /practice. How would you compile your code?

Options:

A.

javac -classpath /practice/Test.jar Practice.java

B.

javac -classpath /practice/ Practice.java

C.

javac -classpath /practice/Test.jar/com/bar Practice.java

D.

javac -classpath /practice Practice.java

Buy Now
Exam Code: GSSP-Java
Exam Name: GIAC Secure Software Programmer - Java
Last Update: Dec 22, 2024
Questions: 275

PDF + Testing Engine

$134.99

Testing Engine

$99.99

PDF (Q&A)

$84.99