Top Topics in our Forum';
**Square root calculator reduces any number to simplest radical form!

A+    A−    B  
Algebra
Games
Geometry
Interactive
Trigonometry
Forum




AddThis Social Bookmark Button

AP Exam Practice

Questions on Arrays

Practice Problem 1)
You can assume that the myArray1 contains elements myArray1[0], myArray1[1], myArray1[2].... myArray1[m-1] where m = myArray1.length.
If myArray1 originally stored 0,4,22,0,0,4,0,11,11,0,0,0,4 what will myArray2 contain after executing teh cod segment below?
int counter=0;
for(int i=0;i < m ; i++){
if(myArray1[i] != 0 )
   {
   myArray1[counter]= myArray1[i];
   counter++;
   }
 int[]  myArray2;
 myArray2 = new int[counter];

for(int i=0;i< counter; i++)
   myArray2[i] = myArray1[i];

Answer

Top
AddThis Social Bookmark Button