SJSU/Udacity CS046

Problem Set 7

  1. Arrays 1
  2. Arrays 2
  3. Arrays 3
  4. Array Algorithms
  5. Reverse Array
  6. Count Matches
  7. Fill Array
  8. Array Methods
  9. Temperature 1
  10. Temperature 2

Arrays 3

You have an int array variable scores of unknown length. Complete the statement to print the first element of the array (that is, the element at index 0). You can assume the scores is not null.
System.out.println( ____________________ );
scores[0]
What is printed by this segment of code?
       int[] temperatures = {65, 71, 68, 85, 87, 89, 78};
       int[] dailyTemps = temperatures;
       dailyTemps[6] = 101;
       System.out.println(temperatures[6]);
101
What is printed by this segment of code
       int[] temperatures = {65, 71, 68, 85, 87, 89, 78};
       int[] dailyTemps = Arrays.copyOf(temperatures, temperatures.length);
       dailyTemps[6] = 101;
       System.out.println(temperatures[6]);
78

Problem on this page?

Your name:

Your email address:

Problem description:

To protect against spam robots, please answer this simple math problem:
× =