Winter 2025 Quiz 1

← 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 1-6 of the Winter 2025 offering of DSC 10.


The DataFrame clubs contains information about all the studemt organizations at UCSD. For each club, we have its "Name", "Category", number of "Members", "Budget" in dollars, "Rating" out of 5.0, and whether it is "Active" represented by either True or False. The first three rows of clubs are shown below. Assume that all club names are unique.


Problem 1

The Cheese Club currently has 50 members. Each quarter, the number of people who will join the club is the value of the Python expression below.

3 * ((4 * 20 / 5 * 2 + 4) ** 0.5 - 2 ** 2)

How many members will the club have after 3 quarters?

Answer: 68


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 65%.


Problem 2


Problem 2.1

How many unique data types exist in the clubs DataFrame?

Answer: 4


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 61%.


Problem 2.2

Suppose we run the following code.

clubs_and_ratings = ["Cheese Club".upper(), str(int(4.6)), "Painting Club".title(), 3.7 - 1]
a = np.array(clubs_and_ratings)

What do a[0], a[1], a[2], and a[3] evaluate to?

Answer:

a[0]: "CHEESE CLUB"

a[1]: "4"

a[2]: "Painting Club"

a[3]: "2.7"


Difficulty: ⭐️⭐️

The average score on this problem was 75%.



Problem 3


Problem 3.1

One of the clubs in the clubs DataFrame is the "Surf Club". Without querying, write an expression that evaluates to the rating of this club.

Answer: clubs.set_index("Name).get("Rating").loc["Surf Club"]


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 62%.


Problem 3.2

Now, using a query, write an expression that evaluates to the rating of the "Surf Club".

Answer: clubs[clubs.get("Name") == "Surf Club"].get("Rating").iloc[0]


Difficulty: ⭐️⭐️⭐️⭐️

The average score on this problem was 48%.


Problem 3.3

Fill in the blanks so the expression below evaluates to the name of the category (e.g. "Social") with the largest number of members, on average.

(clubs.groupby(__(a)__).__(b)__.sort_values(by="Members", ascending=__(c)__).__(d)__)

Answer:

(a): "Category"

(b): mean()

(c): False

(d): index[0]


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 59%.


Problem 3.4

In each category, what is the largest budget for a club? Write one line of code that would produce an appropriate data visualization to answer this question.

Answer: clubs.groupby("Category").max().plot(kind= "bar", y= "Budget")


Difficulty: ⭐️⭐️⭐️⭐️

The average score on this problem was 38%.



Problem 4

The Data Science Student Society has a $500 budget, which they will use only to buy food for their 4 meetings this quarter. Each time they have a meeting, they will use exactly half of their remaining budget on food. For example, the first meeting’s food cost will be $250 and the next meeting’s food cost will be $125. Use np.arange(), together with arithmetic operations, to assign food_costs to an array containing the food cost for each of the 4 meetings. Do not use np.array().

food_costs =

Answer: 500 * 0.5 ** np.arange(1,5) or 500/2 ** np.arange(1,5)


Difficulty: ⭐️⭐️⭐️⭐️⭐️

The average score on this problem was 11%.


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