• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 2 fuera de 15 páginas
Examen

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

Document preview thumbnail
Vista previa 2 fuera de 15 páginas

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.

Vista previa del contenido

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

Información del documento

Subido en
5 de octubre de 2026
Número de páginas
15
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$17.64

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
MindCraft
3.9
(58)
Vendido
487
Seguidores
12
Artículos
3138
Última venta
1 día hace




Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes