Identify the exceptions that will be received when the following code snippets are executed.
1. int factorial(int n){
if(n==1) return 1;
else return n*factorial(n-1);
}
Assume that it is called with a very large integer.
2. void printMe(Object[] oa){
for(int i=0; i<=oa.length; i++)
System.out.println(oa[i]);
}
Assume that it is called as such: printMe(null);
3. Object m1(){
return new Object();
}
void m2(){
String s = (String) m1();
}
Select 1 option
A. Class Cast Exception
Array Index out of Bounds Exception
Stack Overflow Error
B. Class Cast Exception
Array Index Out Of Bounds Exception
Security Exception
C. No Exception Will Be Thrown
Security Exception
Will Not Compile
D. Stack Over flow Error
NullPointerException
No Exception Will Be Thrown
E. Stack Over flow Error
Array Index Out Of Bounds Exception
Class Cast Exception
F. Stack Over flow Error
NullPointerException
NullPointerException
G. Security Exception
Null Pointer Exception
No Exception Will Be Thrown
H. Stack Overflow Error
Null Pointer Exception
Class Cast Exception