Question: Consider the following code fragment (assumed to be in an otherwise correct program): double [] dubArray1 = new double[100]; double [] dubArray2 = new double[75];

Consider the following code fragment (assumed to be in an otherwise correct program):

 double [] dubArray1 = new double[100]; double [] dubArray2 = new double[75]; // there are no intervening statements. immediately following we have: dubArray1 = dubArray2; dubArray1[75] = 9; 

Check the true statements (may be more than one):

It will compile without error but probably crash (i.e., generate a run-time error).

It has a compiler error.

It has an array bounds violation, possibly causing a fatal runtime error.

It has no compiler or runtime errors, although it is a little odd looking.

Some allocated memory becomes inaccessible, but that's not a fatal error.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!