Ruby_Arrays Flashcards

1
Q

Programmers tend to call a bunch of stuff grouped together a collection of ….

A

….objects.

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

The most useful collection of objects, in ruby is an ..

A

an array

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

Arrays that don’t contain items are called …

A

empty arrays

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

The ( ? ) method is a way to add an item to the array.

A

push

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

The push method we use the ( ? )

A

The append operator “.push”

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

What does

array = [ ]

mean?

A

The [ ] indicate an empty array, but between the square brackets we can put a comma-separated list of the values the array will contain.

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

What 3 strategies are used to create arrays?

A

Using push, the shovel operator or entering an actual array.

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

How can you tell that the value is actually an array containing multiple strings.

=> “They’re peanut butter and jealous!”, “It’s not a man-purse. It’s called a satchel. Indiana Jones wears one.”, “Rule Number 76. No excuses! ]

A

array.inspect

this inspects the code and will tell you its an array: the output looks like this:

[“They’re peanut butter and jealous!”, “It’s not a man-purse. It’s called a satchel. Indiana Jones wears one.”, “Rule Number 76. No excuses!

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

Programmers will use the word iterate to mean …..

A

to go through each of the items one-by-one.

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

What does adding the “upcase” do?
Ex below:

quotes.each do | quote |
upcase_quote = quote.upcase
puts upcase_quote
end

A

Capitalizes all the letters.

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

What actually happens when we call the upcase method?

A

Calling it, stores the result in a variable. We then can display the result of the string with all uppercase letters on the screen.

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

Arrays that don’t contain items are called:

A

empty arrays.

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