Unit 2 (Strings and Classes) Flashcards

(12 cards)

1
Q

array definition

A

int[] num = new int[length];
int [] num = {1, 2, 3, 4, 5};
Arrays are fixed in length

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

2d array definition

A

int[][] matrix = {
{1, 2, 3, 4},
{5, 6, 7, 8},
{9, 10, 11, 12}
};

int[][] jagged = new int[3][];
jagged[0] = new int[2];
jagged[1] = new int[4];
jagged[2] = new int[1];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

order of operations

A

() []
++, –
% / *
+, -
< > <= >=
== !=
&&
||
= += -= etc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When to use .length vs .length()

A

.length for arrays
.length() for strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The size of an array is immutable. You cannot ever change the size of an array

A

Check the answers when tracing to eliminate any options with changed array length

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

when iterating thru a array, what is the iteration

A

(int x: arr){
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

when iterating thru a 2d array, what is the iteration

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly