Referenced from lesson Table Methods (Spring, 2021)

You have the following functions defined below :

``````fun lookup-fixed(animal): animal["fixed"]                   end
fun is-dog(animal):       animal["species"] == "dog"        end
fun is-old(animal):       animal["age"] > 10                end
fun nametag(animal):      text(animal["name"], 20, "red")   end``````

The table `t` below represents four animals from the shelter:

name sex age fixed species pounds

`"Toggle"`

`"female"`

`12`

`true`

`"dog"`

`48`

`"Fritz"`

`"male"`

`4`

`false`

`"dog"`

`92`

`"Nori"`

`"female"`

`6`

`true`

`"dog"`

`35.3`

`"Sunflower"`

`"female"`

`2`

`false`

`cat`

`51.6`

Below are a list of expressions that use table methods. What table do we get, after evaluating each one? Match each expressionto the table we get .

 `t.order-by("age", true)` 1 A Produces a table with Toggle, Fritz, and Nori - but not Sunflower. `t.order-by("pounds", false)` 2 B Produces a table of all four animals, sorted youngest-to-oldest `t.build-column("sticker", nametag)` 3 C Produces a table, with only Toggle. `t.filter(is-old)` 4 D Produces an identical table with an extra column called "dog", whose values are true, true, true, false `t.filter(lookup-fixed)` 5 E Produces a table containing only Nori and Toggle. `t.filter(is-dog)` 6 F Produces a table with all four animals, sorted from heaviest to lightest. `t.build-column("dog", is-dog)` 7 G Wonâ€™t run: will produce an error `t.filter(nametag)` 8 H Produces an identical table with an extra column called "sticker", whose values are images

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). Bootstrap:Data Science by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.