year string | session string | utility_classes list | solution list | test dict |
|---|---|---|---|---|
2014 | a02 | [
{
"content": "package ex2014.a02.sol1;\n\nimport java.util.Set;\n\n\n\npublic interface Scheduler<T> {\n\t\n\t\n\tvoid add(T t);\n\t\n\t\n\tboolean isExecuting();\n\t\n\t\n\tT getExecutingTask();\n\t\n\t\n\tvoid executeNext();\n\t\n\t\n\tvoid complete();\n\t\n\t\n\tvoid stop();\n\t\n\t\n\tvoid preempt();\n\t\n\... | [
{
"content": "package ex2014.a02.sol1;\n\nimport java.util.*;\nimport java.util.function.Supplier;\n\npublic class SchedulerImpl<T> implements Scheduler<T>{\n\t\n\tprivate final LinkedList<T> waitingList = new LinkedList<>();\n\tprivate final LinkedList<T> stoppedList = new LinkedList<>();\n\tprivate Optional<T... | {
"components": {
"imports": "package ex2014.a02.sol1;\n\nimport static org.junit.Assert.*;\nimport java.util.*;",
"private_init": "\t/*\n\t * Implement the Scheduler interface given through a SchedulerImpl class\n\t * with a constructor without arguments.\n\t * This scheduler executes processes one at a time... |
2014 | a03 | [
{
"content": "package ex2014.a03.sol1;\n\nimport java.io.*;\nimport java.util.*;\n\n\n\npublic interface RandomStatistics{\n\n\t\t\n\tvoid setFileName(String fileName);\n\t\n\t\t\n\tvoid storeSeries(long size) throws IOException;\n\t\n\t\t\n\tdouble loadToMax() throws IOException;\n\t\n\t\t\n\tlong loadToCountS... | [
{
"content": "package ex2014.a03.sol1;\n\nimport java.io.*;\nimport java.util.*;\nimport java.util.function.*;\n\n/**\n * Questa soluzione usa le lambda per fattorizzare il comportamento\n * comune delle tre load, ma una soluzione equivalente era ottenibile\n * con uno strategy e le classi anonime.\n */\n\npubl... | {
"components": {
"imports": "package ex2014.a03.sol1;\n\nimport static org.junit.Assert.*;\nimport java.io.*;",
"private_init": "\t/*\n\t * Implement the RandomStatistics interface given through a RandomStatisticsImpl class with a constructor without arguments.\n\t * This class implements a generator of rand... |
2014 | a04 | [
{
"content": "package ex2014.a04.sol1;\n\nimport java.util.*;\n\n\n\npublic interface TicTacToe {\n\t\n\t\n\t\n\tenum Player { X, O };\n\t\n\t\n\t\n\tenum Cell {\n\t\t\n\t\tNW(0,0), N(0,1), NE(0,2),\n\t\tW(1,0), C(1,1), E(1,2),\n\t\tSW(2,0), S(2,1), SE(2,2);\n\t\t\n\t\tpublic static final List<List<Cell>> WINNI... | [
{
"content": "package ex2014.a04.sol1;\n\nimport java.util.*;\nimport java.util.stream.Collectors;\nimport static ex2014.a04.sol1.TicTacToe.Cell.*;\n\n/**\n * Questa interfaccia è usata per controllare una partita del gioco TicTacToe (tris).\n * In generale, richiamare un metodo quando non appropriato (ad esemp... | {
"components": {
"imports": "package ex2014.a04.sol1;\n\nimport static org.junit.Assert.*;\nimport java.util.*;",
"private_init": "\t/*\n\t * Implement the given TicTacToe interface through a TicTacToeImpl class with a no-argument constructor, which\n\t * implements the management of a Tic Tac Toe game.\n\t ... |
2014 | a02b | [
{
"content": "package ex2014.a02b.sol1;\n\nimport java.util.*;\n\npublic interface TicketDispenser<A> {\n\t\n\t\n\tint getCashDeskSize();\n\t\n\t\n\tint getNextAvailableTicket();\n\t\n\t\n\tint giveNextTicketToAgent(A agent);\n\t\n\t\n\tvoid useCashDesk(int desk);\n\t\n\t\n\tvoid releaseCashDesk(int desk);\n\t\... | [
{
"content": "package ex2014.a02b.sol1;\n\nimport java.util.*;\nimport java.util.stream.*;\n\npublic class TicketDispenserImpl<A> implements TicketDispenser<A>{\n\t\n\tprivate List<A> waiting = new ArrayList<>();\n\tprivate int currentTicket = 0;\n\tprivate int nextTicketToServe = 0;\n\tprivate List<Optional<A>... | {
"components": {
"imports": "package ex2014.a02b.sol1;\n\nimport static org.junit.Assert.*;\n\nimport java.util.*;",
"private_init": "\t/*\n\t * Implement the given TicketDispenser interface through a TicketDispenser class with a constructor that accepts\n\t * an integer argument, which represents the number... |
2014 | a06 | [
{
"content": "package ex2014.a06.sol1;\n\n\n\npublic interface Lamp {\n\t\n\t\n\t\n\tvoid on() throws IllegalStateException;\n\t\n\t\n\tvoid off();\n\t\n\t\n\tboolean isOn();\n\t\n\t\n\tvoid fail();\n\n}",
"filename": "Lamp.java"
},
{
"content": "package ex2014.a06.sol1;\n\npublic class SimpleLamp i... | [
{
"content": "package ex2014.a06.sol1;\n\nimport java.util.Optional;\n\npublic class LampWithRemainingDuration extends AbstractLamp {\n\t\n\tprivate int remainingDuration;\n\t\n\tpublic LampWithRemainingDuration(int remainingDuration){\n\t\tthis.remainingDuration = remainingDuration;\n\t}\n\n\t@Override\n\tprot... | {
"components": {
"imports": "package ex2014.a06.sol2;\n\nimport static org.junit.Assert.*;\n\nimport java.util.*;",
"private_init": "\t/*\n\t * Consider the Lamp interface that models a light bulb with also a \"fail\" command that models its failure,\n\t * its trivial implementation SimpleLamp provided as an... |
2014 | a05 | [
{
"content": "package ex2014.a05.sol1;\n\nimport java.util.*;\n\n\n\npublic interface Roulette {\n\t\n\t\n\tfinal static int SINGLE_BET_WIN_FACTOR = 36; \n\t\n\t\n\t\n\tvoid waitBets();\n\t\n\t\n\tvoid bet(String playerName, int betNumber, int quantity);\n\t\n\t\n\tint drawWinningNumber();\n\t\n\t\n\tvoid debug... | [
{
"content": "package ex2014.a05.sol1;\n\nimport java.util.*;\nimport java.util.stream.Collectors;\n\npublic class RouletteImpl implements Roulette{\n\t\n\tprivate boolean betting = false;\n\tprivate final Map<String,List<Pair<Integer,Integer>>> iBets = new HashMap<>();\n\tprivate int lastWin;\n\tprivate final ... | {
"components": {
"imports": "package ex2014.a05.sol2;\n\nimport static org.junit.Assert.*;\n\nimport java.util.*;",
"private_init": "\t/*\n\t * Implement the Roulette interface given through a RouletteImpl class with a constructor without arguments.\n\t * The comment of Roulette and the tests below are suffi... |
2014 | a03b | [
{
"content": "package ex2014.a03b.sol1;\n\nimport java.io.*;\nimport java.util.*;\n\n\n\npublic interface DiceStatistics{\n\n\t\t\n\tvoid setFileName(String fileName);\n\t\n\t\t\n\tvoid storeSeries(long size,int diceNumber) throws IOException;\n\t\n\t\t\n\tlong loadToLuckyCount() throws IOException;\n\t\n\t\t\... | [
{
"content": "package ex2014.a03b.sol1;\n\nimport java.io.*;\nimport java.util.*;\nimport java.util.stream.*;\nimport java.util.function.*;\n\n/**\n */\n\npublic class DiceStatisticsImpl implements DiceStatistics{\n\t\n\tprivate Optional<String> fileName = Optional.empty();\n\n\t@Override\n\tpublic void setFile... | {
"components": {
"imports": "package ex2014.a03b.sol1;\n\nimport static org.junit.Assert.*;\n\nimport java.io.*;",
"private_init": "\t/*\n\t * Implement the DiceStatistics interface given through a DiceStatisticsImpl class with a constructor without arguments.\n\t * This class implements a generator of a seq... |
2014 | a01b | [
{
"content": "package ex2014.a01b.sol1;\n\n\n\npublic interface Aggregator<X> {\n\t\n\tX aggregate(X one, X two);\n}",
"filename": "Aggregator.java"
},
{
"content": "package ex2014.a01b.sol1;\n\n\n\npublic interface ProgressiveAcceptor<X> {\n\t\n\t\n\t\n\tvoid setProgressiveFilter(ProgressiveFilter<... | [
{
"content": "package ex2014.a01b.sol1;\n\nimport java.util.*;\n\npublic class ProgressiveAcceptorImpl<X> implements ProgressiveAcceptor<X> {\n\n\tprivate ProgressiveFilter<X> filter;\n\tprivate Aggregator<X> aggregator;\n\tprivate int size = -1;\n\tprivate final List<X> elements = new LinkedList<X>();\n\n\tpri... | {
"components": {
"imports": "package ex2014.a01b.sol1;\n\nimport static org.junit.Assert.*;",
"private_init": "\t/*\n\t * Implement the ProgressiveAcceptor interface given through a\n\t * ProgressiveAcceptorImpl class with a constructor without arguments.\n\t * The comment to the ProgressiveAcceptor code, an... |
2014 | a01 | [
{
"content": "package ex2014.a01.sol1;\n\nimport java.util.*;\n\n\n\npublic interface FibonacciAcceptor {\n\n\t\n\tvoid reset(String sequenceName);\n\t\n\t\n\tboolean consumeNext(long l);\n\t\n\t\n\tList<Long> getCurrentSequence();\n\t\n\t\n\tMap<String,List<Long>> getAllSequences();\n}",
"filename": "Fibon... | [
{
"content": "package ex2014.a01.sol1;\n\nimport java.util.*;\nimport java.util.stream.*;\n\n/**\n * Qualche nota su questa soluzione\n * - è solo una delle possibili\n * - usa alcune delle funzionalità di Java 8, come gli Optional e gli Stream, ma questo non era necessario\n * - può essere considerata come sol... | {
"components": {
"imports": "package ex2014.a01.sol1;\n\nimport static org.junit.Assert.*;\nimport java.util.*;",
"private_init": "\t/*\n\t * Implement the FibonacciAcceptor interface given through a\n\t * FibonacciAcceptorImpl class with a constructor without arguments.\n\t * The comment on the FibonacciAcc... |
2015 | a04 | [
{
"content": "package ex2015.a04.sol1;\n\nimport java.util.List;\n\n\npublic interface Tree<X> {\n \n \n int size();\n \n \n X getRoot();\n \n \n List<Tree<X>> getSons();\n \n \n boolean contains(X x);\n \n \n Tree<X> getSubTree(X node);\n \n \n... | [
{
"content": "package ex2015.a04.sol1;\n\nimport java.util.*;\nimport java.util.function.Supplier;\n\npublic class TreeFactoryImpl<X> implements TreeFactory<X> {\n\n @Override\n public Tree<X> emptyTree() {\n return new EmptyTree<>();\n }\n\n @Override\n public Tree<X> consTree(X root, Lis... | {
"components": {
"imports": "package ex2015.a04.sol1;\n\nimport static org.junit.Assert.*;\n\nimport java.util.*;\n\n/**\n * Implement the TreeFactory interface with a TreeFactoryImpl class with an empty constructor,\n * which implements a Factory for immutable trees, which adhere to the generic Tree interface p... |
2015 | a03a | [
{
"content": "package ex2015.a03a.sol1;\n\nimport java.util.Map;\nimport java.util.Set;\n\n\npublic interface Faculty {\n \n \n void registerCourse(int id, String name);\n \n \n void registerStudent(int id, String name);\n \n \n void associate(int studentId, int courseId);\n \n ... | [
{
"content": "package ex2015.a03a.sol1;\n\nimport java.util.*;\nimport java.util.function.Supplier;\nimport java.util.stream.Collectors;\n\npublic class FacultyImpl implements Faculty {\n \n private final Map<Integer,Pair<String,Set<Integer>>> courses = new HashMap<>();\n private final Map<Integer,Pair... | {
"components": {
"imports": "package ex2015.a03a.sol1;\n\nimport static org.hamcrest.CoreMatchers.*;\nimport static org.junit.Assert.*;\n\n/**\n * Implement the Faculty interface given through a FacultyImpl class\n * with a constructor without arguments. Models the management of courses in a university,\n * with... |
2015 | a02b | [
{
"content": "package ex2015.a02b.sol1;\n\nimport java.util.*;\n\n\npublic interface Menu {\n\n \n interface Dish {\n\n \n String getName();\n\n \n int getCost();\n \n \n Temperature getTemperature();\n \n \n Optional<String> awarded();... | [
{
"content": "package ex2015.a02b.sol1;\n\nimport java.util.*;\nimport java.util.stream.Collectors;\n\npublic class MenuImpl implements Menu {\n \n private final Map<String,Dish> map = new HashMap<>();\n \n public MenuImpl(){}\n\n @Override\n public Dish createDish(String name, int cost, Tempe... | {
"components": {
"imports": "package ex2015.a02b.sol1;\n\nimport static org.junit.Assert.*;\nimport static org.hamcrest.CoreMatchers.*;",
"private_init": "\t/*\n * Implement the given Menu interface through a MenuImpl class\n * with a constructor without arguments. Models a restaurant menu,\n * w... |
2015 | a06 | [
{
"content": "package ex2015.a06.sol1;\n\n\npublic interface Countdown {\n\n \n void decrease(); \n \n \n int getValue();\n \n \n boolean isOver(); \n \n}",
"filename": "Countdown.java"
},
{
"content": "package ex2015.a06.sol1;\n\n\npublic interface PowerCountdown extends ... | [
{
"content": "package ex2015.a06.sol1;\n\npublic class StandardCountdown extends AbstractCountdown {\n \n public StandardCountdown(int value) {\n super(value);\n }\n\n @Override\n protected void actualDecrease() {\n this.value--;\n }\n\n @Override\n public boolean isOver() ... | {
"components": {
"imports": "package ex2015.a06.sol1;\n\nimport static org.junit.Assert.*;\n\nimport java.util.*;\n\n/**\n * See the documentation of the provided Countdown and PowerCountdown interfaces, which model countdown counters.\n * Implement the Countdown interface with a StandardCountdown class, with a ... |
2015 | a01a | [
{
"content": "package ex2015.a01a.sol1;\n\nimport java.util.*;\n\n\npublic interface CoursesCalendar {\n\t\n\t\n\t\n\tenum Day { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY }\n\t\n\t\n\tenum Room { A, B, C, D, E, MAGNA, VELA, C_ALDO_MORO }\n\t\n\t\n\tList<Integer> possibleSlots();\n\t\n\t\n\tvoid bookRoom(Day ... | [
{
"content": "package ex2015.a01a.sol1;\n\nimport java.util.*;\nimport java.util.stream.*;\n\npublic class CoursesCalendarImpl implements CoursesCalendar {\n\t\n\tprivate static final List<Integer> AVAILABLE_SLOTS = Arrays.asList(9,10,11,12,14,15,16,17);\n\tprivate final Map<Pair<Day, Room>, Map<Integer,String>... | {
"components": {
"imports": "package ex2015.a01a.sol1;\n\nimport static org.junit.Assert.*;\nimport static ex2015.a01a.sol1.CoursesCalendar.Day.*;\nimport static ex2015.a01a.sol1.CoursesCalendar.Room.*;\nimport static org.hamcrest.CoreMatchers.*;\n\nimport java.util.*;",
"private_init": "\t/*\n\t * Implement... |
2015 | a02a | [
{
"content": "package ex2015.a02a.sol1;\n\nimport java.util.*;\n\n\npublic interface League {\n\t\n \n\tvoid addTeam(String teamName);\n\t\n\t\n\tvoid start();\n\t\n\t\n\tvoid storeResults(Map<Pair<String,String>,Pair<Integer,Integer>> results);\n\t\n\t\n\t\n Map<String,Integer> getTable();\n\t\n}",
"... | [
{
"content": "package ex2015.a02a.sol1;\n\nimport java.util.*;\nimport java.util.stream.*;\nimport java.util.function.*;\n\npublic class LeagueImpl implements League {\n\n private final Map<String, Integer> table = new HashMap<>();\n private boolean started = false;\n\n public LeagueImpl() {\n }\n\n... | {
"components": {
"imports": "package ex2015.a02a.sol1;\n\nimport static org.junit.Assert.*;\nimport static org.hamcrest.CoreMatchers.*;\nimport java.util.*;",
"private_init": "\t/*\n\t * Implement the League interface given through a LeagueImpl class with a constructor without arguments.\n\t * Model the mana... |
2015 | a05 | [
{
"content": "package ex2015.a05.sol1;\n\nimport java.util.List;\n\n\npublic interface CList<X> {\n \n \n int size();\n \n \n X getElem(int pos);\n \n \n boolean contains(X x);\n \n \n CList<X> add(X x, int pos);\n \n \n CList<X> shift(int pos);\n\n \n... | [
{
"content": "package ex2015.a05.sol1;\n\nimport java.util.Collections;\nimport java.util.LinkedList;\nimport java.util.List;\n\npublic class CListImpl<X> implements CList<X> {\n \n private List<X> elements;\n private int pos;\n \n CListImpl(List<X> elements, int pos) {\n this.elements = e... | {
"components": {
"imports": "package ex2015.a05.sol1;\n\nimport static org.junit.Assert.*;\n\nimport java.util.*;\n\n/**\n * Implement the CListFactory interface with a CListFactoryImpl class with an empty constructor,\n * which implements a Factory for immutable cyclic lists, which adhere to the generic CList i... |
JAB: Java Academic Benchmark
This repository hosts the Java Academic Benchmark (JAB) introduced in our paper, "Java Academic Benchmark: Exam-Based Evaluation of LLMs on Object-Oriented Programming."
Overview
JAB is the first exam-based benchmark specifically designed to rigorously evaluate LLMs on Java Object-Oriented Programming (OOP) capabilities.
JAB comprises 103 real Java exams administered between 2014 and 2024 at a top-tier academic institution, designed and curated by Professor Mirko Viroli, an experienced full professor and co-author of this project. This ensures that each task reflects pedagogically grounded and conceptually meaningful challenges.
Unlike benchmarks that focus on isolated code snippets, JAB features full exam-style problems with expert-authored JUnit test suites, targeting class- and interface-level reasoning. Designed to assess human learners, these problems isolate common misconceptions and test deep understanding, offering granular insights into where and how models fall short.
Resources
- 📄 Paper: https://www.sciencedirect.com/science/article/pii/S0164121226002669
- 💻 Source Code & Evaluation: https://github.com/disi-unibo-nlp/jab
Dataset Structure
Each exam in the JAB dataset is structured as follows:
- year: Year of the exam session
- session: Specific session identifier
- utility_classes: Utility classes provided to students during the exam
- solution: Gold solution created by Prof. Viroli (one of many possible solutions)
- test: JUnit test cases that must be passed
Benchmark Significance
JAB offers several unique advantages for evaluating LLMs on Java programming tasks:
- Educational Validity: Problems are designed by education experts to test conceptual understanding
- Comprehensive Assessment: Tasks require full class implementations rather than just completing isolated functions
- Object-Oriented Focus: Specifically targets OOP concepts including inheritance, polymorphism, encapsulation, and interfaces
- Longitudinal Coverage: Spans a decade of real academic assessments (2014-2024)
- Test-Driven Evaluation: Uses rigorous JUnit test suites for objective assessment
License
This dataset is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) license.
You are free to:
- Share — copy and redistribute the material in any medium or format
Under the following terms:
- Attribution — You must give appropriate credit (see below), provide a link to the license, and indicate if changes were made.
- NonCommercial — You may not use the material for commercial purposes.
- NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material.
For details, see: https://creativecommons.org/licenses/by-nc-nd/4.0/
Dataset Owner: Mirko Viroli
License Notice: © Mirko Viroli — CC BY-NC-ND 4.0
Citation
If you use JAB in your research, please cite:
@article{COCCHIERI2026113033,
title = {Java academic benchmark: Exam-based evaluation of LLMs on object-oriented programming},
journal = {Journal of Systems and Software},
pages = {113033},
year = {2026},
issn = {0164-1212},
doi = {https://doi.org/10.1016/j.jss.2026.113033},
url = {https://www.sciencedirect.com/science/article/pii/S0164121226002669},
author = {Alessio Cocchieri and Luca Ragazzi and Gianluca Aguzzi and Giacomo Frisoni and Lorenzo Molfetta and Gianluca Moro and Mirko Viroli},
keywords = {Large language models, Java, Object-oriented programming, Coding benchmark},
abstract = {Current code generation benchmarks largely overlook object-oriented programming (OOP) skills, leaving open whether large language models (LLMs) can effectively apply OOP principles to structured programming tasks. The dominance and permissiveness of Python in most benchmarks further obscure model weaknesses in core OOP principles. We introduce the Java Academic Benchmark (JAB), based on 103 authentic Java exams collected over a decade at a major university, together with 506 expert-written JUnit tests, to rigorously evaluate advanced Java programming competence with a strong focus on OOP. To complement execution-based scoring, we propose KODE, an LLM-as-a-Judge framework that assesses OOP adherence across four pedagogical dimensions. We evaluate 27 LLMs under two resolution strategies: single-attempt (one-shot) and agentic (iterative refinement with compiler and test feedback). Results reveal that, under our evaluation protocol, larger closed models match or surpass bachelor-level OOP students–especially under agentic resolution–while smaller open models lag behind. JAB’s class-level design enables fine-grained error analysis, exposing recurring misconceptions. Editor’s note: Open Science material was validated by the Journal of Systems and Software Open Science Board.}
}
Contact
For questions or further information about the JAB benchmark, please contact:
- Downloads last month
- 24