Winter 2025 Quiz 2

← return to practice.dsc10.com


This quiz was administered in-person. Students were allowed a cheat sheet. Students had 20 minutes to work on the quiz.

This quiz covered Lectures 7-11 of the Winter 2025 offering of DSC 10.


The DataFrame blue_bowl contains information about orders placed by UCSD students at Blue Bowl, an on-campus eatery specializing in custom bowls. For each order, we have the cusstomer’s "student_id", the "base" of their bowl, which "fruit" they got, and the number of additional toppings, "num_toppings". The first five rows are shown below.


Problem 1

Fill in the blanks so that the statement below outputs a DataFrame showing the most popular base and fruit combinations in the blue_bowl DataFrame, in descending order of popularity.

    blue_bowl.groupby(__(a)__).__(b)__.sort_values(__(c)__)

Answer (a): ['base', 'fruit']


Difficulty: ⭐️

The average score on this problem was 90%.

Answer (b): count()


Difficulty: ⭐️

The average score on this problem was 90%.

Answer (c): "student_id", ascending = False


Difficulty: ⭐️⭐️

The average score on this problem was 84%.


Problem 2

Let five_bowls be the smaller DataFrame consisting of only the first five rows of blue_bowl.


Problem 2.1

How many rows are in the DataFrame five_bowls.merge(five_bowls, on="base")?

Answer: 9


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 63%.



Problem 2.2

How many rows are in the DataFrame five_bowls.merge(five_bowls, on="fruit")?

Answer: 11


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 61%.



Problem 3

Suppose there are five available fruits: strawberries (red), bananas (yellow), raspberries (red), pomegranate (red), and pineapple (yellow). If Pranav orders a bowl with one fruit and tells you that the fruit is red, what is the probability he did not get strawberries?

Answer: 2/3


Difficulty: ⭐️⭐️

The average score on this problem was 84%.


Problem 4

The density histogram below shows the distribution of "num_toppings" for 250 unique orders in blue_bowl.


Problem 4.1

Kate orders a bowl with exactly two toppings. Which bin is her order included in?

Answer: C


Difficulty: ⭐️⭐️

The average score on this problem was 89%.


Problem 4.2

How many more orders were there with one topping than orders with no toppings? Give your answer as an integer rounded to the nearest multiple of 5.

Answer: 25


Difficulty: ⭐️⭐️

The average score on this problem was 81%.



Problem 5

Fill in the body of the function prep_time such that both expressions below evaluate to the same Series.

    blue_bowl.get("num_toppings").apply(prep_time)

    1.2 + 0.2 * blue_bowl.get("num_toppings")

    def prep_time(x): 
        return 

Answer: 1.2 + .2 * x


Difficulty: ⭐️⭐️

The average score on this problem was 80%.


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