U3: Arrays Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Array: Cells

A
  • Has index starting from 0 and increment by 1
  • Index is reference to location of item
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

Array: Storing Data

A
  • Can only store data all of same type
  • Ex: Integers, Strings
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

Array: Names

A
  • Must be done same way as variables
  • Camel notation if name has +2 words
  • Ex: studentMarks, cardValues
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

Array: Size

A

Programmer should know and state (vertical) size of array before using

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

Declaring Arrays

A
  • Declare name, size and type of data stored
  • Ex: int [ ] exampleName = new int [6]; for 0 to 5
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Initializing Arrays

A

int [ ] values = new int [2];
values [0] = 3;
values [1] = 71;

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

Declaring and Initializing Arrays at Same Time

A

Double [ ] avg = {34.7, 54.3, 8.9}

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

Storing Inputs In Array

A
  • int [ ] numbers = new int [1];
  • numbers[0] = keyedInput.nextInt();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Operations on Array Number Values

A

Possible

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

Outputting Array Values

A
  • Can only output one value at time
  • Ex:
    System.out.println(values[0]);
    System.out.println(values[1]);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Element

A

Actual data stored in array cell

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

Index

A

Location/index value where element located

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

Bounds

A

Highest and lowest indexes (0 to [size - 1])

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

i++ and iā€“

A
  • i++: i = i + 1
  • iā€“: i = i - 1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Finding Odd and Even Values

A
  • Odd: variable % 2 = 1
  • Even: variable % 2 = 0
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Creating New List Based From Old List

A
  • int[ ] List = new int[5];
  • int[ ] List2 = List;
14
Q

Number of things in an array

A

variable.length