Short answers to Q4 for CS 100


Question 1 :

public int numTween(int [] b, int x, int y)
{

int count = 0;
for (int i = 0; i < b.length; i++)
    if (b[i] >= x && b[i] <= y)
        count++;
return count;
}

Question 2 :
Any one of the following :

                                                Java                  Matlab
                                           --------------------------
First index                                  0                      1
How to access elements              []                      ()
Size                              Fixed once created     Can be changed dynamically