• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 15 pages
Exam (elaborations)

CS 61B Midterm 1 Exam Fall 2025–2026 | Complete Questions & Solutions | University of California, Berkeley.

Document preview thumbnail
Preview 2 out of 15 pages

CS 61B Midterm 1 Exam Fall 2025–2026 | Complete Questions & Solutions | University of California, Berkeley. Complete University of California, Berkeley CS 61B Midterm 1 Exam, covering Fall 2025–2026. Includes the full exam questions with complete solutions in a clear, organized format for easy reference. Ideal for students looking for CS 61B Midterm 1 solutions, UC Berkeley CS 61B questions and answers, and Fall 2025–2026 CS61B exam content.

Content preview

CS 61B Midterm 1
Fall 2025 Thursday, September 25, 2025
Solutions last updated: 9/26/25
Print Your Name:

Print Your Student ID:

Print Student name to your left:

Print Student name to your right:


You have 110 minutes. There are 8 questions of varying credit. (100 points total)

Question: 1 2 3 4 5 6 7 8 Total
Points: 12 6 10 12 10 16 20 14 100

For questions with circular bubbles, select only For questions with square boxes, you may select
one choice (there is only one correct answer). one or more choices (select all that apply).
Unselected option (completely unfilled) You can select

Don’t do this (it will be graded as incorrect) multiple squares

Only one selected option (completely filled) Don’t do this (it will be graded as incorrect)
• Anything you write outside the answer boxes or you cross out will not be graded. If you write multiple
answers or your answer is ambiguous, we will grade the worst interpretation.
• Unless otherwise specified, all data structures and algorithms behave according to their implementation
in lecture, with no additional optimizations.
• If an implementation detail (e.g. tiebreaking scheme, linked list topology) is relevant, it will be explicitly
noted in the question.
• You may write at most one statement per blank and you may not use more blanks than provided.
• Your answer will be reformatted according to the 61B/61BL style guidelines. For example, any method,
constructor, or if-statement requires at least three lines for the purposes of determining line count.
• You may not use ternary operators, lambdas, streams, or multiple assignment.
• Unless otherwise specified, you may assume that everything on the reference card has been imported.


Read the honor code below and sign your name.
By signing below, I affirm that all work on this exam is my own work. I have not referenced any
disallowed materials, nor collaborated with anyone else on this exam. I understand that if I cheat on
the exam, I may face the penalty of an “F” grade and a referral to the Center for Student Conduct.




Page 1 of 15

, Sign your name:
Q1 Map (12 points)

Fill in rankedAbove, which takes in a list of Players and returns a map from each Player to their rank.
The player with the highest score has rank 1, the player with the next-highest score has rank 2, and so on.
For example, if we have a list of players with scores of 500, 800, 1200, and 100, then these players would
have ranks 3, 2, 1, and 4, respectively, and rankedAbove would return the following Map:
{ Player with score 500 : 3,
Player with score 800 : 2,
Player with score 1200 : 1,
Player with score 100 : 4 }
Assume no two players have the same score.
You may not need all lines. Do not worry about efficiency.

public class Player {
public double score;

public static Map<Player, Integer> rankedAbove(List<Player> players) {


Map<Player, Integer> results = new HashMap<>(); ;

for (Player p1 : players ) {

results.put(p1, 1);

for (Player p2 : players) {

if (p2.score > p1.score) {

results.put(p1, results.get(p1) + 1);

}

}

UNUSED

}

return results;

}

}



Page 2 of 15

Document information

Uploaded on
October 5, 2026
Number of pages
15
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$17.64

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
MindCraft
3.9
(56)
Sold
466
Followers
11
Items
2975
Last sold
1 day ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions