Unit 3: Data Structures

Lab 2: Contact List

3.2.5
Which of the following statements are true about this list?
set (words and numbers) to {rabbit, 5, benefit, is, 34, kite, 2, 305, the, 61}
map (letter (1) of ()) over (words and numbers) reports the list {r, 5, b, i, 3, k, 2, 3, t, 6}.
map (item (1) of ()) over (words and numbers) reports the list {rabbit}.
Both of the above.
None of the above.
3.2.5
Which of the following statements are true about this list?
set (capitals) to {{Augusta, Maine}, {Boise, Idaho}, {Columbia, South Carolina}, {Des Moines, Iowa}}
Choose all that apply.
Why not use an ADT?

The list inside a list shown above makes it clearest to you now as you answer this self-check item what the structure is, but you're right, in an actual program it would be better to use an abstract data type:
state: (Augusta) capital: (Maine)

map (item (1) of ()) over (capitals) reports the list {Augusta, Boise, Columbia, Des Moines}.
map (item (1) of ()) over (capitals) reports the list {Augusta, Maine}.
map (letter (1) of ()) over (capitals) reports the list {A, B, C, D}.
map (all but first of ()) over (capitals) reports the list {Maine, Idaho, South Carolina, Iowa}.
map (all but first of ()) over (capitals) reports the list {{Boise, Idaho}, {Columbia, South Carolina}, {Des Moines, Iowa}}.
3.2.5

Consider this list of squares:
set (squares) to {1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225}
Which of the following expressions will report a list? Choose all that apply.

map (sqrt of()) over (squares)
keep items such that (()mod(2)=0) from (squares)
combine with (()+()) items of (squares)
keep items such that (letter (length of ()) of () = 1) from (squares)
combine with (join ()()) items of (squares)
map ((0)-()) over (squares)