giac gssp-java practice test

Exam Title: GIAC Secure Software Programmer - Java Exam

Last update: Nov 27 ,2025
Question 1

Given a code of a class named PrintString that prints a string.
1. public class PrintString{
2. public static void main(String args[]){
3. /*insert code here */
4. /* insert code here */
5. System.out.println(str);
6. }
7. }
Which of the following code fragments can be inserted in the class PrintString to print the output
"4247"?
Each correct answer represents a complete solution. Choose all that apply.

  • A. StringBuilder str= new StringBuilder("123456789"); str.delete(0,3).replace(1,3,"24").delete(4,6);
  • B. StringBuffer str= new StringBuffer("123456789"); str.delete(0,3).replace(1,3,"24").delete(4,6);
  • C. StringBuffer str=new StringBuffer("123456789"); str.substring(3,6).delete(1,2).insert(1,"24");
  • D. StringBuilder str= new StringBuilder("123456789"); str.deleteCharAt(6).replace(1,3,"24").delete(0,3);
  • E. String str="123456789"; str=(str-"123").replace(1,3,"24")-"89";
Answer:

A,B

vote your answer:
A
B
C
D
E
A 0 B 0 C 0 D 0 E 0
Comments
Question 2

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?

  • 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
Answer:

A

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 3

Which of the following statements is true?

  • A. All UTF characters are eight bits long.
  • B. All UTF characters are all sixteen bits long.
  • C. All UTF characters are twenty four bits long.
  • D. All bytecode characters are sixteen bits long.
  • E. All unicode characters are sixteen bits long.
Answer:

E

vote your answer:
A
B
C
D
E
A 0 B 0 C 0 D 0 E 0
Comments
Question 4

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?

  • 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.
Answer:

C

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 5

Mark works as a Programmer for InfoTech Inc. He develops a Website that uses HTML and processes
HTML validation. Which of the following are the advantages of the HTML application?
Each correct answer represents a complete solution. Choose all that apply.

  • A. It provides password protection for a Web page or directory
  • B. It can be accessed by more visitors.
  • C. It provides faster loading.
  • D. It is easier to update and maintain the site.
  • E. It protects the source or images of a HTML Web page.
  • F. It puts less load on the server.
Answer:

B,C,D,F

vote your answer:
A
B
C
D
E
F
A 0 B 0 C 0 D 0 E 0 F 0
Comments
Question 6

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.

  • 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; }
Answer:

A,B,C,D,F

vote your answer:
A
B
C
D
E
F
G
A 0 B 0 C 0 D 0 E 0 F 0 G 0
Comments
Question 7

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.

  • A. HttpSessionBindingListener
  • B. HttpSessionListener
  • C. HttpSessionActivationListener
  • D. HttpSessionAttributeListener
Answer:

C,D

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 8

Which of the following statements are true? Each correct answer represents a complete solution.
Choose all that apply.

  • 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.
Answer:

C,D

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 9

You work as a programmer for uCertify.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.

  • 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");
Answer:

A,E

vote your answer:
A
B
C
D
E
A 0 B 0 C 0 D 0 E 0
Comments
Question 10

Which of the following statements about a JAR file are true? Each correct answer represents a
complete solution. Choose all that apply.

  • A. It cannot be accessed through a class path, nor they can be used by java and javac.
  • B. It is used to compress and archive data.
  • C. It can be moved from one computer to another.
  • D. It is created by using the jar command.
Answer:

B,C,D

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Page 1 out of 23
Viewing questions 1-10 out of 239
Go To
page 2