GIAC GSSP-Java Exam Practice Questions (P. 3)
- Full Access (275 questions)
- Six months of Premium Access
- Access to one million comments
- Seamless ChatGPT Integration
- Ability to download PDF files
- Anki Flashcard files for revision
- No Captcha & No AdSense
- Advanced Exam Configuration
Question #11
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.
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.
- AStringBuilder str= new StringBuilder("123456789");
str.delete(0,3).replace(1,3,"24").delete(4,6); - BStringBuffer str= new StringBuffer("123456789");
str.delete(0,3).replace(1,3,"24").delete(4,6); - CStringBuffer str=new StringBuffer("123456789");
str.substring(3,6).delete(1,2).insert(1,"24"); - DStringBuilder str= new StringBuilder("123456789");
str.deleteCharAt(6).replace(1,3,"24").delete(0,3); - EString str="123456789";
str=(str-"123").replace(1,3,"24")-"89";
Correct Answer:
AB
AB
send
light_mode
delete
Question #12
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?
- Ajavac -classpath /practice/Test.jar Practice.java
- Bjavac -classpath /practice/ Practice.java
- Cjavac -classpath /practice/Test.jar/com/bar Practice.java
- Djavac -classpath /practice Practice.java
Correct Answer:
A
A
send
light_mode
delete
Question #13
Which of the following statements is true?
- AAll UTF characters are eight bits long.
- BAll UTF characters are all sixteen bits long.
- CAll UTF characters are twenty four bits long.
- DAll bytecode characters are sixteen bits long.
- EAll unicode characters are sixteen bits long.
Correct Answer:
E
E
send
light_mode
delete
Question #14
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?
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?
- AIt will not compile because the Double class does not contain the toHexString() method.
- BIt will compile and execute successfully and will display 8p312 as the output.
- CIt will compile and execute successfully and will display 0x1.8p312.0 as the output.
- DIt will not compile because the Double class does not contain the toString() method.
Correct Answer:
C
C
send
light_mode
delete
Question #15
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.
Each correct answer represents a complete solution. Choose all that apply.
- AIt provides password protection for a Web page or directory
- BIt can be accessed by more visitors.
- CIt provides faster loading.
- DIt is easier to update and maintain the site.
- EIt protects the source or images of a HTML Web page.
- FIt puts less load on the server.
Correct Answer:
BCDF
BCDF
send
light_mode
delete
All Pages