Spring 2026 Quiz 1

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


Note (groupby / pandas 2.0): Pandas 2.0+ no longer silently drops columns that can’t be aggregated after a groupby, so code written for older pandas may behave differently or raise errors. In these practice materials we use .get() to select the column(s) we want after .groupby(...).mean() (or other aggregations) so that our solutions run on current pandas. On real exams you will not be penalized for omitting .get() when the old behavior would have produced the same answer.


The World Cup is a large international soccer tournament that takes place every 4 years. There have been 22 World Cups in total, and the next one is coming up soon in June 2026!

The wc DataFrame lists all 22 World Cup winners, in reverse chronological order. Each row has the name of the winning "country" (str), the tournament "year" (int), the winning team’s "score" (int), and the color of the winning team’s "jersey" (str). The last column, "penalty" (bool), is True if the game was tied at the end of regular play and the winner was determined by a tiebreaker, called a “penalty shoot-out.” The first few rows of wc are shown below, though wc has more rows than pictured.

Assume that we have already run import babypandas as bpd and import numpy as np.


Problem 1

Suppose we define x as follows.

x = wc.get(["year", "score"]).groupby("year").mean().shape[0]

Choose the expression below that evaluates to True.

Answer: x == wc.shape[0]


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 69%.


Problem 2

Fill in the blanks so the expression below evaluates to the name of the country with the most World Cup wins.

wc.groupby(__(a)__).__(b)__.sort_values(by=__(c)__, ascending=True).__(d)__

(a): "country"
(b): count()
(c): any column name besides "country"
(d): index[-1]


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 66%.


Problem 3


Problem 3.1

Kate wants to determine how often championships are won in penalty shoot-outs versus won in regular time. Which plot type would best allow her to visualize this information?

Answer: bar chart


Difficulty: ⭐️⭐️

The average score on this problem was 82%.


Problem 3.2

Bianca creates a horizontal bar chart to show how times a World Cup was won by a team wearing each jersey color. Based on the provided information, what is the maximum possible length of the "blue" bar? Give your answer as an integer.

Answer: 20


Difficulty: ⭐️⭐️⭐️⭐️

The average score on this problem was 48%.



Problem 4

For each part below, determine the data type of the result, or state that the expression errors. If you can determine the exact value of the result, give it.


Problem 4.1

(np.arange(5) + "5")[-1]

Answer: error


Difficulty: ⭐️⭐️

The average score on this problem was 88%.


Problem 4.2

np.sum(np.arange(1, 9, 3) * 3)

Answer: int

Value: 36


Difficulty: ⭐️⭐️

The average score on this problem was 78%.


Problem 4.3

(wc.shape[1] / wc.get("score").iloc[2])

Answer: float

Value: 5.0


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 72%.


Problem 4.4

(wc.set_index("country").get("country").iloc[0])

Answer: error


Difficulty: ⭐️⭐️

The average score on this problem was 78%.



Problem 5

Determine the value of best after running the code below.

best = "Ronaldo"
a = "it's almost time for the World Cup!"
a = a.split(" ")[0]
m = "message"
m = m.title().replace("age", "i")
best = best[2] + best[-1] + " " + a + " " + m

Hint: We can access individual characters from a string in the same way we access individual elements from an array. For example, "hello"[4] is "o".

Answer: "no it's Messi"


Difficulty: ⭐️⭐️

The average score on this problem was 84%.


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