Question: these questions are Java 1. What happens if you try to access an array element using a negative index or an index greater than or


these questions are Java
1. What happens if you try to access an array element using a negative index or an index greater than or equal to the number of elements in the array? 2. Why is a NullPointerException generated after the following statements are executed? String [1 wordsnew Stringt101 System.out.printin words [0].1length( How do you copy an array into another array? How do you compare two arrays for equality? Compare/contrast two algorithms for sorting arrays What is the primary difference in functionality between .length used in an array and length 3. 4. 5. 6. used in Strings? 7. Under what conditions are ArraylndexOutOfBounds exceptions generated? 8. If we use the following code to make a separate copy of the array called testscores, will it work? Why or why not? int IJ testScores 195, 100, 89, 92, 25); int I] copyofTestScores-testScores; 9. Assume that we have an array called propertyTaxes whose elements are objects. Using a for loop, we make a copy of that array called propertyTaxesCopy. When an object in propertyTaxes changes, does it have any effect on the object in propertyTaxesCopy? Why or why not? 10. Explain how the Sequential Search algorithm works within unsorted arrays. 11. Compare the function of the following two statements: arrayName. length arrayName [i].length 12. When processing all the elements of a column of a two-dimensional array, what possible runtime error do we have to worry about? 13. Simeon wants to keep track of his batting average for each day of each week of the next baseball season. Evaluate what is wrong with this code and recommend an alternative code. double [] battingAverage; 14. Which keyword would you add to this code to instantiate the array, allocating memory for the array? Provide the updated code. arrayName datatype [exp1] (exp2]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
