Week 6 - Data, References, Arrays & Searching Flashcards

1
Q

How do we use ASCII and UTF in Ruby?

A

Assign the variable, then puts it out using encode

Eg:
delta = (ASCII character)
puts delta.encode(“utf-8”)

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

What’s the difference between dynamic and static arrays?

A

Dynamic arrays have no fixed size, whereas in static arrays we can assign the number of things inside an array.

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

What’s the difference between dynamic and static memory?

A

Dynamic memory has no fixed size, whereas in static memory it’s fixed.

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

What are lists used for?

A

Sometimes it’s better to use lists vs arrays because of the operations that they allow.

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

What are some operations for lists?

A
  • Adding items
  • Taking the head of the list
  • Asking if the list includes x
  • Applying an operation to all items (doubling items)
  • Inserting items into a point (cheese near the milk)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Reject List Operation

A

Used to take something ff the list.

This is done by creating a new list with the thing removed.

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

Each List Operation

A

Applies an operation to each item if a certain condition is met.

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

How can we search an array?

A

We search through an array using a while loop.

This allows us to check if there are certain items/elements inside of an array.

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

Instead of returning an index, can we return the item of the index itself?

A

No we can’t do this.

This is because you wouldn’t be able to tell whether or not the item is found, if there aren’t any values in the list, and if we wanted to change an item. Overall, things are easier with the index.

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

What’s the difference between arrays and lists?

A
  • Lists are a set of operators that apply to an array.

- Lists can be stored in an array.

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

List

A

A type of data structure.

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