← return to practice.dsc10.com
This quiz was administered in-person. It was closed-book; students
were not allowed to use the DSC 10 Reference Sheet but
were allowed a double-sided sheet of handwritten notes. Students had
20 minutes to work on the quiz.
This quiz
covered Lectures 1-5 of the Spring 2025 offering
of DSC 10.
In the video game Minecraft, players mine raw materials,
craft various tools, and build structures such as houses.
A player named Steve has several storage chests in which he keeps items
he owns. Each chest has a different descriptive name
and contains items of various types. For example, one of Steve’s chests
is called "Food"
and it contains 12
"Golden Carrot"
and 8 "Rabbit Stew"
items.
The items
DataFrame contains all the items Steve has in
his chests. It is indexed by "Item"
(name of the item). The
columns are "Quantity"
(number of such items) and
"Chest"
(name of the chest where all such
items are stored). The first few rows are shown below, though
items
has more rows than pictured.
Fill in the blanks so the expression below evaluates to the name of the chest that contains the most distinct items.
(items.groupby(___(a)___).___(b)___="Quantity", ascending=___(c)___).___(d)___) .sort_values(by
Answer:
"Chest"
count()
False
index[0]
The average score on this problem was 89%.
The average score on this problem was 39%.
The average score on this problem was 86%.
The average score on this problem was 67%.
Steve wants to build a village where each house is built using a
different "Item"
from the
"Materials"
chest (e.g., a cobblestone house, a wood house,
a brick house, etc). Assuming that each house requires at least 416
blocks of a single material, fill in the blanks so that the expression
below evaluates to the number of houses that Steve’s
village will have.
& (___(b)___)].___(c)___ items[(___(a)___)
Answer:
items.get("Chest") == "Materials"
items.get("Quantity") >= 416
shape[0]
Note that answer (a) and (b) may be swapped.
The average score on this problem was 71%.
The average score on this problem was 71%.
The average score on this problem was 27%.
Which of the following expressions evaluates to the number of
"Emerald"
s in Steve’s chests? Select all that apply.
items.get("Quantity").loc["Emerald"]
(items[items.get("Item") == "Emerald"].sort_values(by="Quantity").loc["Emerald"])
items.sort_values(by="Quantity").get("Quantity").iloc[0]
items[items.index == "Emerald"].get("Quantity").iloc[0]
None of the above.
Answer:
Option 1 and Option 4
The average score on this problem was 78%.
In early versions of Minecraft, players reported sighting a hazy figure with glowing eyes, who they nicknamed Herobrine. Examine the mysterious code that Herobrine left behind and determine the output. Write your answer exactly how the output would appear in Python. Do it wrong and your diamonds will disappear.
= 3 + 4 * 2 ** 2 - 6/3
curse curse
Answer: 17.0
The average score on this problem was 85%.
Below is the opening line from the legendary Minecraft parody song
Revenge:
= "Creeper aww man" line
You want to create an echo effect to produce the following string:
"Creeper Creeper Creeper aww man"
Which of the following code snippets produces this output? Select all that apply.
words = line.split(" ")
(words[0] + " ") * 3 + words[1] + " " + words[2]
line * 3
line.replace("Creeper", "Creeper Creeper Creeper")
words = line.split(" ")
" ".join(words[0] * 3 + words[1])
None of the above.
Answer:
Option 1 and Option 3
The average score on this problem was 93%.