GSSP-Java practice questions, page 8 of 11, with answer review and explanations.
Question 36
Which of the following methods is used to request that any pending finalizers be run for objects eligible for garbage collection?
freeMemory()
gc()
runFinalization()
runFinalizers()
Question 37
Martin works as a Programmer in Data Net Inc. He writes the following code. 1. class Ques0191{ 2. public static void main(String[] argv){ 3. byte a = 1; 4. switch(a+1){ 5. case 1. 6. System.out.println("One"); 7. case 2. 8. System.out.println("2"); 9. case 2. 10. System.out.println("Two"); break; 11. } 12. } 13. } What will happen when Martin attempts to compile and execute the code?
The code will compile successfully, but a runtime error will occur because of the duplicate case label at line number 9.
The code will not compile because of the duplicate case label at line number 9.
The code will compile successfully and will execute displaying 2 followed by Two.
The code will not compile because an argument to the switch must be a constant.
Question 38
You work as a Software Developer for UcTech Inc. You want to declare a security constraint in the deployment descriptor using the element. Which of the following can be the possible values for the element? Each correct answer represents a complete solution. Choose all that apply.
CONFIDENTIAL
ALL
NONE
INTEGRAL
Question 39
Which of the following methods must be implemented by each subclass of the Permission class to compare permissions?
hashcode
implies
newPermissionCollection
equals
Question 40
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.