What is an array?
String [] cars;
What type of primitive data would be stored in this array?
Strings
The first element in an array is accessed using this index.
0
What are the default values of an int array and double array?
0 & 0.0
int[] grades = {100,20,44,98,76,22}
System.out.print(grades[4]));
What is the output?
76
What type of loop is used to be more detailed when traversing an array?
For loop
A single value in an array is an
Element
{
return arr[1] + arr[3] /2;
//The mystery method has been called for this array
int[] list = {3,5,3,6,6}
8
In javaScript, this loop is designed to work through the array without using an index..
An enhanced for loop / for each loop
What is the length of the array?
What is the element in the 6 index spot?
String [] names = {John,Sally,Mark,Louise}
System.out.println(names[2]));
Error
What does it mean to traverse an array?
To process each element in array one by one
What would I type in order to find the index of the last element?
list.length-1
What would I code to find the middle index of an arr. You may assume that the length of the arr is odd
arr[arr.length /2]
What type of loop would you use to traverse an array when you don't know the length?