GSSP-Java

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?

  1. freeMemory()
  2. gc()
  3. runFinalization()
  4. 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?

  1. The code will compile successfully, but a runtime error will occur because of the duplicate case label at line number 9.
  2. The code will not compile because of the duplicate case label at line number 9.
  3. The code will compile successfully and will execute displaying 2 followed by Two.
  4. 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.

  1. CONFIDENTIAL
  2. ALL
  3. NONE
  4. INTEGRAL

Question 39

Which of the following methods must be implemented by each subclass of the Permission class to compare permissions?

  1. hashcode
  2. implies
  3. newPermissionCollection
  4. 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.

  1. doPostFilter()
  2. doGetFilter()
  3. doFilter()
  4. init()
  5. service()