14. Arrays Flashcards
Does an array object have a variable or a fixed size?
ss
Do we need to change the program source code in order to change the size of an array used by a program?
ss
Which of the following variable declarations are legal?
- int {} smallPrimes = {2, 3, 5, 7, 11, 13, 17, 19};
- int [] smallPrimes = [2, 3, 5, 7, 11, 13, 17, 19];
- int [] smallPrimes = {2, 3, 5, 7, 11, 13, 17, 19};
- int {} smallPrimes = [2, 3, 5, 7, 11, 13, 17, 19];
ss
How many in variables are created by the following code?
int[][] anArray = new int[4][];
for (int index = 0; index < anArray.length; index++)
anArray[index] = new int[index];
ss
How many references are involved in the following?
int[][] my2DArray = new int[5][4]
20
What set of indices does an array of ten elements have?
ss
Consider the following.
int[][] my2DArray = new int[5][4];
Which element is acces by my2DArray[4][1]?
- The first element in the last row.
- The second element in the last row.
- The first element in the penultimate row.
- The fourth element in the first row.
- The third element in the first row.
ss
How do we find the length of an array?
ss
What is the difference between and array variable containing null, and one containing a reference to an empty array?
ss
What does an ‘array of objects’ contain?
ss
What other variable do we need to support a partially filled array?
ss
What is the minimum size increase when extending an array? What is a good size increase?
ss
What is the difference between shallow and deep copies?
ss
How does linear search in a list work?
ss
Give three examples of a sort order on simple data, such as numbers or names.
ss