nerdexam
GIAC

GSSP-JAVA · Question #31

GSSP-JAVA Question #31: Real Exam Question with Answer & Explanation

Sign in or unlock GSSP-JAVA to reveal the answer and full explanation for question #31. The question stem and answer options stay visible for context.

Question

Dennis works as a Programmer in Broadnet Inc. He writes the following program. 1. public class Ques0307{ 2. public static void main(String[] argv){ 3. int arr[] = {1, 2, 3, 4}; 4. try{ 5. int k = 0; 6. for(; k < 4; k++) 7. arr[k] = arr[k] + 1; 8. System.out.println("try"); 9. } 10. catch(ArrayIndexOutOfBoundsException a){ 11. System.out.println("index " +k +" not found"); 12. } 13. catch(Exception e){ 14. System.out.println("catch1"); 15. } 16. finally{ 17. System.out.println("finally"); 18. } 19. } 20. } What will happen when Dennis attempts to compile and execute the program?

Options

  • AA compile-time error will occur.
  • BThe program will display index 0 not found catch1 finally
  • CThe program will display index 4 not found finally
  • DThe program will display try finally

Unlock GSSP-JAVA to see the answer

You've previewed enough free GSSP-JAVA questions. Unlock GSSP-JAVA for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full GSSP-JAVA Practice