To allocate 50 BMI values in an array you write down inway1
     To allocate 50 BMI values in an array, you write down in//way-1 int size = 50;  double[] BMI = new double[size];  could you write it this//way-2:  int size = 50;  double[] BMI;  BMI = new double[size];  ANS: circle Yes  Or  No  You have defined an array named: double bmi[] = new double[]; and fill it out full with contents, and you would like to access the value of second element and assign the value to a variable defined as: double b; write the code for the operation.  ANS:  Here is an array declaration containing income values for five years consecutively:  int[] income = {1200, 1000, 1700, 1300, 2000};  int i;  int howManyYears = income.length;//to display the 3^rd year income, in this statement  System.out.print (3^rd year income^-\" + income[i];  What should be the value of index i? ANS  What is the value of variable; howManyYears? ANS  ANS: index i =  ANS:  What is wrong with the following code to initialize an array BMI for every element to zero?  To compile this code, will compiler generate any syntax error?  If compilation is passed, what would happen when the byte code is executed? Explain in detail  ANS  double[] bmi = new double[20]; for (int i = 1; i ![To allocate 50 BMI values in an array, you write down in//way-1 int size = 50; double[] BMI = new double[size]; could you write it this//way-2: int size = 50;   To allocate 50 BMI values in an array, you write down in//way-1 int size = 50; double[] BMI = new double[size]; could you write it this//way-2: int size = 50;](/WebImages/30/to-allocate-50-bmi-values-in-an-array-you-write-down-inway1-1085789-1761570920-0.webp) 
  
  Solution
26) Yes, both are same.
27) double b = bmi[1], the values are accessed starting with 0, so to access the second number we use 1.
28) (1) 2, to access the 1st element with 0 and increment, so to access the 3rd element we use 2.
(2)5, the variable will hold the length of the array which is 5.
29) (1) No, the function will compile perfectly.
(2) The loop runs from i=1 to 20. When i reaches 20, BMI[20] does not exist so it will throw an illegal memory access exception.
![To allocate 50 BMI values in an array, you write down in//way-1 int size = 50; double[] BMI = new double[size]; could you write it this//way-2: int size = 50;   To allocate 50 BMI values in an array, you write down in//way-1 int size = 50; double[] BMI = new double[size]; could you write it this//way-2: int size = 50;](/WebImages/30/to-allocate-50-bmi-values-in-an-array-you-write-down-inway1-1085789-1761570920-0.webp)
