Easter Sale Special 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: exams65

GIAC Secure Software Programmer – Java Question and Answers

GIAC Secure Software Programmer – Java

Last Update May 18, 2024
Total Questions : 275

We are offering FREE GSSP-Java GIAC exam questions. All you do is to just go and sign up. Give your details, prepare GSSP-Java free exam questions and then go for complete pool of GIAC Secure Software Programmer – Java test questions that will help you more.

GSSP-Java pdf

GSSP-Java PDF

$35  $99.99
GSSP-Java Engine

GSSP-Java Testing Engine

$42  $119.99
GSSP-Java PDF + Engine

GSSP-Java PDF + Testing Engine

$56  $159.99
Questions 1

Identify whether the given statement is true or false.

"When an exception occurs in a try block, each catch statement following the try block is inspected in sequential order, and the last one whose type matches that type of exception is executed."

Options:

A.  

False

B.  

True

Discussion 0
Questions 2

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");

Discussion 0
Questions 3

Identify whether the given statement is true or false.

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

Options:

A.  

False

B.  

True

Discussion 0
Questions 4

Which of the following JAR file options is used for creating an archive?

Options:

A.  

-v

B.  

-u

C.  

-x

D.  

-c

Discussion 0
Questions 5

Which of the following security related elements of the deployment descriptor matches the argument to the isCallerInRole() method?

Options:

A.  

B.  

C.  

D.  

Discussion 0
Questions 6

Which of the following methods of the HttpServletResponse interface is used for URL rewriting?

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

Options:

A.  

encodeURL

B.  

encodeRedirectURL

C.  

sendRedirect

D.  

getRequestURL()

Discussion 0
Questions 7

John works as a Programmer for Technostar Inc. He writes the following code using Java.

1. class WrapperClass{

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

3. String str2 = Double.toString(12);

4. String str1 = Double.toHexString(12);

5. System.out.println(str1+str2);

6. }

7. }

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

Options:

A.  

It will not compile because the Double class does not contain the toHexString() method.

B.  

It will compile and execute successfully and will display 8p312 as the output.

C.  

It will compile and execute successfully and will display 0x1.8p312.0 as the output.

D.  

It will not compile because the Double class does not contain the toString() method.

Discussion 0
Questions 8

Which of the following methods of the HttpServletResponse interface is used for URL rewriting?

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

Options:

A.  

encodeURL

B.  

encodeRedirectURL

C.  

sendRedirect

D.  

getRequestURL()

Discussion 0
Questions 9

Which of the following methods is used to authenticate the users, and if the user has not been authenticated, the method returns false?

Options:

A.  

getCallerPrincipal()

B.  

getRemoteUser()

C.  

isUserInRole()

D.  

getCallerIdentity()

Discussion 0
Questions 10

Which of the following methods returns a Cipher object that implements the specified transformation?

Options:

A.  

getCallerIdentity()

B.  

getObject()

C.  

getHeader()

D.  

getInstance()

Discussion 0
Questions 11

Mark works as a Programmer for InfoTech Inc. He wants to develop a JMS API application that is used as a messaging service application. He writes the following createSession() method.

session = connection.createSession(false, 2);

Which of the following statements are true about the syntax?

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

Options:

A.  

The client acknowledges a consumed message by calling the message's acknowledge method.

B.  

The acknowledge method can reduce session overhead by minimizing the work the session does to prevent duplicates.

C.  

This method instructs the session to lazily acknowledge the delivery of messages.

D.  

The session automatically acknowledges a client's receipt of a message.

E.  

If a message consumer consumes eight messages and then acknowledges the fourth message delivered, all eight messages are acknowledged.

Discussion 0
Questions 12

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.

Discussion 0
Questions 13

You work as a Software Developer for UcTech Inc. You want to write a filter that will implement the Filter interface. Which of the following methods will you use to accomplish the task?

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

Options:

A.  

doPostFilter()

B.  

doGetFilter()

C.  

doFilter()

D.  

init()

E.  

service()

Discussion 0
Questions 14

Which of the following are valid thread state transitions?

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

Options:

A.  

From running to ready.

B.  

From ready to waiting.

C.  

From running to waiting.

D.  

From waiting to ready.

E.  

From ready to running.

F.  

From waiting to running.

Discussion 0
Questions 15

Which of the following code fragments will throw NumberFormatException?

Options:

A.  

Double dbl = new Double(true);

B.  

Character ch = new Character('A');

C.  

Float flt = new Float("true");

D.  

Boolean bool = new Boolean("123");

Discussion 0
Questions 16

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");

Discussion 0
Questions 17

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.

Discussion 0
Questions 18

Which of the following methods can be invoked from the ejbStore() method of an entity bean class?

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

Options:

A.  

getPrimaryKey()

B.  

getUserTransaction()

C.  

getRollbackOnly()

D.  

isCallerInRole()

E.  

getEJBObject()

Discussion 0
Questions 19

Which of the following methods is used to encrypt or decrypt data in a single step?

Options:

A.  

wrap()

B.  

update()

C.  

digest()

D.  

doFinal()

Discussion 0
Questions 20

Which of the following rules must be followed while determining a class loader?

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

Options:

A.  

A new instance of the AppletClassLoader is used while loading the first class of an applet.

B.  

If the request to load a class is triggered by a reference to it from an existing class, the class loader for the existing class is asked to load the class.

C.  

A new instance of the URLClassLoader is used while loading the first class of an application.

D.  

The primordial class loader is used if java.lang.Class.ForName is directly called.

Discussion 0
Questions 21

Mary works as a Software Developer for XYZ Inc. She writes the following code.

1. class Alpha {

2. public static class Beta { }

3. }

4. class Delta {

5. // insert code here

6. }

Which of the following code statements can be inserted at line 5 to create an instance of the Beta class defined in the class Alpha?

Options:

A.  

Beta b = new Beta();

B.  

Alpha a = new Alpha();

C.  

Beta = new a.Beta();

D.  

The class Beta cannot be instantiated at line 5.

E.  

Alpha.Beta b = new Alpha.Beta();

Discussion 0
Questions 22

Which of the following methods is defined by ObjectOutputStream?

Options:

A.  

char readChar()

B.  

int readInt()

C.  

void write(byte buffer[])

D.  

int available()

Discussion 0
Questions 23

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.

Discussion 0
Questions 24

Which of the following statements are correct about the code given below?

AccountServlet

This is an Account Servlet.

GET

POST

PUT

DELETE

acme/AccountServlet

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

Options:

A.  

The delete http method is not allowed in the http-method element declaration.

B.  

If no http-method is specified in the web-resource-collection element, the security restriction will be applied to all http methods.

C.  

There should be at-least one url-pattern element otherwise, the will be ignored.

D.  

It is necessary that the web-resource-name must be specified in the web-resource-collection element.

E.  

It is not possible to define more than two http method in the web-resource-collection element.

F.  

It is necessary that the web-resource-name must be specified in the url of the url-pattern element.

Discussion 0
Questions 25

Mark develops an application using Java language. He writes the following code snippet in the application.

public class mClass{

public static void main(String args[]){

try{

return;

}

finally{System.out.print("Finally");}}}

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

Options:

A.  

The code snippet will compile successfully and the output will be displayed as "Finally".

B.  

The code snippet will compile successfully, but an exception message will be displayed at runtime.

C.  

A compile time error will occur because the catch block is not defined.

D.  

The code snippet will compile successfully, but nothing will be displayed as output on execution.

Discussion 0
Questions 26

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.

Discussion 0
Questions 27

Which of the following code fragments will compile without error?

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

Options:

A.  

boolean a = false;

if(a)

System.out.println(a);

B.  

int a = 10;

if(a != 10)

System.out.println(a);

C.  

int a = 0;

if(a)

System.out.println(a);

D.  

boolean a = true;

if(!a);

Discussion 0
Questions 28

Which of the following methods is used to preallocate room for a certain number of characters after a StringBuffer has been constructed?

Options:

A.  

capacity()

B.  

ensureCapacity()

C.  

setCapacity()

D.  

allocateCapacity()

Discussion 0
Questions 29

You work as a Software Developer for UcNet Inc. You write the following code using Java.

class StringTest

{

public static void main(String args[])

{

String s = "Hi";

s.concat("There");

System.out.println(s);

}

}

What will happen when you try to compile and execute the code?

Options:

A.  

It will not compile.

B.  

It will compile and execute successfully and will display Hi as the output.

C.  

It will compile but will throw an exception at runtime.

D.  

It will compile and execute successfully and will display HiThere as the output.

Discussion 0
Questions 30

Peter works as a Programmer in Magi Net Inc. He writes the following code.

1. class Ques0190{

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

3. byte a = 100;

4. switch(a){

5. case 10.

6. System.out.println("ten");

7. case 100.

8. System.out.println("hundred");

9. case 1000.

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

11. }

12. }

13. }

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

Options:

A.  

The code will compile and execute displaying hundred.

B.  

The code will not compile because 1000 is not assignment compatible with a byte data type.

C.  

The code will not compile because the argument to the switch cannot be a primitive type byte value.

D.  

The code will compile and execute displaying hundred followed by thousand.

Discussion 0
Questions 31

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

Discussion 0
Questions 32

You work as a Software Developer for Developer Inc. You write the following code.

interface A {public boolean b = false;}

class C implements A {public static void main(String args[]) {b = true;System.out.println(b);}}

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

Options:

A.  

The code will compile and print false.

B.  

The code will compile, but it will not execute.

C.  

The code will compile and print true.

D.  

The code will not compile.

Discussion 0
Questions 33

Which of the following statements about the isUserInRole() method are true?

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

Options:

A.  

It accepts a boolean argument.

B.  

It is mapped in the deployment descriptor using the element.

C.  

It belongs to the HttpServletResponse interface.

D.  

The sub-element of the element must match the sub-element of the element.

Discussion 0
Questions 34

You work as a Software Developer for UcTech Inc. You want the deployment descriptor to contain entries for the authentication type and the security realm. In order to accomplish this, you have to use the sub-elements of the element. Which of the following will you use?

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

Options:

A.  

B.  

C.  

D.  

E.  

F.  

G.  

Discussion 0
Questions 35

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

Discussion 0
Questions 36

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

Discussion 0
Questions 37

Which of the following methods evaluates the global policy for the permissions granted to the

ProtectionDomain and tests whether the permission is granted?

Options:

A.  

implies

B.  

getPolicy

C.  

isPolicy

D.  

getType

Discussion 0
Questions 38

Which of the following will be returned by the expression "string" instanceof String?

Options:

A.  

0

B.  

1.0

C.  

null

D.  

false

E.  

0.0

F.  

true

Discussion 0
Questions 39

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.

Discussion 0
Questions 40

Identify whether the given statement is true or false.

"If the isUserInRole() method is called on an unauthenticated user, the container returns false."

Options:

A.  

True

B.  

False

Discussion 0
Questions 41

In which of the following locations the helper classes of a session bean class reside?

Options:

A.  

EJB JAD file

B.  

Deployment descriptor

C.  

META-INF directory

D.  

EJB JAR file

Discussion 0