Fall 2026 Quiz 1

← return to practice.dsc10.com


Instructor(s): Peter Chi, Janine Tiefenbruck

This quiz was administered in-person. Students were allowed one page of double-sided handwritten notes; 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-5 of the Fall 2026 offering of DSC 10.

⚠️ PDF version available here .


That's the end of the quiz.

Coleman decides that tutoring DSC 10 is not lucrative enough to support his extravagant lifestyle, so he decides to open up a sushi restaurant called Coleman’s Catch.

The DataFrame menu has a row for each menu item available at Coleman’s Catch. A few rows are shown below, but there are additional rows not shown. The "Name" of the menu item is in the index (string), and the columns are "Type" (string), "Price" in dollars (float), number of "Pieces" (int) per order, and average "Rating" from 0 to 5 (float).

Preview of the menu DataFrame, with Name as the index and Type, Price, Pieces, and Rating columns.

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

If your answer is a string, put it in quotes. If your answer is a float, include a decimal point. No calculators and no computers were allowed.


Problem 1

Lecture 3

Coleman purchased a property on Clougherty Drive, but the street number can only be determined by evaluating the following expression. What is the street number?

sum(2 ** np.arange(3, 7, 2)) * len(str(len("sushi" * 999)))

Answer: 160

The np.arange(3, 7, 2) results in an array that starts at 3, steps by 2, and stops before 7, which produces [3, 5].

2 ** np.array([3, 5]) raises 2 to each element, giving [8, 32], and sum of that is 40.

On the other side of the expression, “sushi” * 999 repeats the 5-character string 999 times, so len(…) is just 5 * 999, which equals 4995.

str() wraps around 4995, producing “4995”, and its len is 4.

Finally, we have 40 * 4, which produces an answer of 160.


Difficulty: ⭐️⭐️⭐️⭐️

The average score on this problem was 48%.


Problem 2

Lecture 5

After a few months of operation, Coleman notices that there are a few bugs in his restaurant data dashboard. For each expression below, help Coleman figure out what the expression will evaluate to, or write “error” if the expression produces an error.


Problem 2.1

menu.take(np.arange(3, 0, -1)).shape[1]

Answer: 4

np.arange(3, 0, -1) decrements by 1 from 3 and stops before 0, producing [3, 2, 1]. take() grabs rows at those positions, so we get a DataFrame with 3 rows. .shape on its own is (rows, columns), so .shape[1] is the number of columns. “Name” is the index, so it doesn’t count. The columns are “Type”, “Price”, “Pieces”, and “Rating”, which means .shape[1] called on the previosu part of the expression evaluates 4. The row order doesn’t matter here.


Difficulty: ⭐️⭐️⭐️⭐️

The average score on this problem was 46%.


Problem 2.2

np.array([10, menu.get("Type").loc["Tuna Sashimi"], 1.5])[2]

Answer: "1.5"

Looking at the second element of this array, menu.get(“Type”) produces a series with just the “Type” column and the names being the index; .loc[“Tuna Sashimi”] produces the value of “Type” at the row labeled “Tuna Sashimi”, which is “Sashimi” (a string). Because a NumPy array can only hold one data type, when you mix an int (first element, 10), a string (second element, “Sashimi”), and a float (third element, 1.5), NumPy converts everything to the most flexible data type, which is a string in this case. The array is [“10”, “Sashimi”, “1.5”]. This array at index 2 is “1.5”, and since it’s a string, it needs quotes.


Difficulty: ⭐️⭐️⭐️⭐️

The average score on this problem was 32%.


Problem 2.3

int(str(menu.get("Rating").max()))

Answer: error The menu.get(“Rating”).max() part of the expression returns a float, like 5.0. str(5.0) is “5.0”. int() on a string only works if the string looks like a whole number, like “5”. “5.0” contains a decimal point, so Python raises a ValueError.


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 56%.



Problem 3

Lecture 3

Ella and Bianca, a duo of world renowned pizza-turned-sushi chefs, are interviewing jointly for a job at Coleman’s Catch. Help them ace their interview question by determining the output of the code block below. Write legibly!

food1 = "hamachi"
food2 = "sashimi"
food2.replace("sh", "iba").replace("s", "b") + "o".join(food1.split("a"))

Answer: "baibaimihomochi"

The expression is two pieces joined with +, so evaluate each piece separately.

Left piece: food2.replace(“sh”, “iba”).replace(“s”, “b”)

“sashimi”.replace(“sh”, “iba”) swaps the “sh” in the middle, giving “saibaimi”. .replace(“s”, “b”) then swaps every remaining “s”. The only one left is the first letter, giving “baibaimi”.

Right piece: “o”.join(food1.split(“a”))

“hamachi”.split(“a”) cuts at each “a”, giving [“h”, “m”, “chi”]. “o”.join(…) puts an “o” between the pieces, giving “homochi”.

+ on strings concatenates, so the result is “baibaimi” + “homochi”, which is “baibaimihomochi”


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 58%.


Problem 4

Lecture 5

Ray, founder of Ray’s Reviews, writes that the sushi from Coleman’s Catch is delicious, but it may be overpriced. Fill in the blanks below to create a DataFrame called money, which is indexed by "Type" and has just one column, "price_per_piece", that contains the highest price per individual piece of a menu item in each of the different "Type" categories.

unit_price = menu.assign(price_per_piece = __(A)__)
money = unit_price.get(__(B)__).groupby("Type").__(C)__


Problem 4.1

What goes in blank (A)?

Answer: menu.get("Price") / menu.get("Pieces")

Price per piece is the order’s price divided by the number of pieces in it. Dividing one Series by another works element-wise, so each row’s price gets divided by that row’s number of pieces. assign then stores the result as the new column “price_per_piece”.


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 63%.


Problem 4.2

What goes in blank (B)?

Answer: ["Type", "price_per_piece"]

We need to keep only the two columns that matter. “Type” has to be included because .groupby(“Type”) needs it as a column to group by. “price_per_piece” is the one value we want in the result. Passing a list to .get returns a DataFrame, which is what .groupby needs. If we left out this step, the aggregation in blank (C) would also run on “Price”, “Pieces”, and “Rating”, and money would have more than one column.


Difficulty: ⭐️⭐️⭐️⭐️

The average score on this problem was 38%.


Problem 4.3

What goes in blank (C)?

Answer: max()

After grouping by “Type”, .max() finds the largest “price_per_piece” within each type. The result is indexed by “Type” with a single column “price_per_piece”, which matches what the problem describes.


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 72%.



Problem 5

Lecture 5

Coleman has trouble selling certain menu items, so he creates the Coleman’s Catch of the Day Combo. All menu items with ratings below 4.5 are considered clunkers. The combo consists of the most expensive clunker of each "Type", which he sells as a bundle for $30.


Problem 5.1

Fill in the blank so that clunkers is a DataFrame consisting of the rows of menu with ratings below 4.5.

clunkers = ____

Answer: menu[menu.get("Rating") < 4.5]

menu.get(“Rating”) < 4.5 is a Boolean Series that’s True for each row with a rating below 4.5. Putting it in square brackets after menu queries for only the True rows. The condition is strictly below 4.5, so use <, not <=.


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 63%.


Problem 5.2

Which of the following evaluates to the amount of money a customer saves by purchasing the combo versus purchasing each item individually?

Answer: Option 3.

The combo has the most expensive clunker of each type, and we want what the customer saves compared to buying those items separately.

clunkers.groupby(“Type”).max().get(“Price”) gives the highest clunker price in each type.

.sum() adds those up, which is what buying all the combo items individually would cost.

Subtracting the $30 combo price gives the savings.

Option 1 is wrong because sum() adds up all the clunkers in each type, not just the most expensive one. Then .max() picks only one type’s total. This isn’t the cost of the combo items.

Option 2 is wrong because it has the same wrong cost as option 1, and the subtraction is also flipped.

Option 4 is wrong because the cost is right, but 30 - cost is negative whenever the combo is a good deal. Savings should be the cost minus $30.


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 51%.



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