Fall 2023 Quiz 2

← return to practice.dsc10.com


This quiz was administered in-person. It was closed-book and closed-note; students were not allowed to use the DSC 10 Reference Sheet. Students had 20 minutes to work on the quiz.

This quiz covered Lectures 5-10 of the Fall 2023 offering of DSC 10.


The DataFrame items describes various items available to collect or purchase using bells, the currency used in the game Animal Crossing: New Horizons.

For each item, we have:

The first 6 rows of items are below, though items has more rows than are shown here.


Problem 1

Fill in the blanks so that count_1 and count_2 both evaluate to the number of items in items with a "Cost" of 0.

count_1 = items.groupby(__(a)__).__(b)__().get("Item").loc[__(c)__]
count_2 = items[__(d)__].shape[0]

Answer:

  • a: "Cost"
  • b: count
  • c: 0
  • d: items.get("Cost") == 0

Difficulty: ⭐️⭐️

The average score on this problem was 81%.


Problem 2

The DataFrame keepers has 5 rows, each of which represent a different shopkeeper in the Animal Crossing: New Horizons universe.

keepers is shown below in its entirety.


How many rows are in the following DataFrame? Give your answer as an integer.

keepers.merge(items.take(np.arange(6)), 
              left_on="Store", 
              right_on="Location")

Answer: 10


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 54%.


Problem 3

Which type of plot should we use to visualize the distribution of the "Location" column in the items DataFrame?

Answer: Bar chart


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 74%.


Problem 4

Nintendo collected data on the heights of a sample of Animal Crossing: New Horizons players. A histogram of the heights in their sample is given below.

What percentage of players in Nintendo’s sample are at least 62.5 inches tall? Give your answer as an integer rounded to the nearest multiple of 5.

Answer: 80%


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 73%.


Problem 5

Consider the function tom_nook, defined below. Recall that if x is an integer, x % 2 is 0 if x is even and 1 if x is odd.

def tom_nook(crossing):
    bells = 0
    for nook in np.arange(crossing):
        if nook % 2 == 0:
            bells = bells + 1
        else:
            bells = bells - 2
    return bells

What value does tom_nook(8) evaluate to?

Answer: -4


Difficulty: ⭐️⭐️

The average score on this problem was 79%.


👋 Feedback: Find an error? Still confused? Have a suggestion? Let us know here.