Past Tests and Exams for COMP102

This page has links to past tests and exams and model solutions for the last decade or so of COMP102.

Note that the course has changed over the years. Significant changes were
  • 2020: Changed way of handling files from File to Path.of and Files
  • 2015: Changed ecs100 to use Java 8 - simplifies user interface code (adding buttons, etc).
  • 2014: Changed balance of questions in tests and exam. Changed name of library from comp102 to ecs100 (no internal changes)
  • 2013: Introduced ArrayList in addition to arrays
  • 2011: changing from the comp100 library to the comp102 library with the UI class
  • 2009: moved to 15 points, had two smaller tests, dropped recursion as an assessable topic
These changes mean that tests and exams from previous years may not always match the current version of the course.

Note also that the brief Java documentation which was provided with tests and exams (not included in the versions below) changed from year to year.

For effective learning, tackle the tests/exams before looking at model solutions!

If you find errors in the model solutions, test it yourself by running the code and please also email us.

2023 Tri 1

2022 Tri 3

2022 Tri 1

2021 Tri 1

2020 Tri 3

2020 Tri 1

  • Because of COVID, there were no tests or exams in 2020 Tri 1

2019 Tri 2

2019 Tri 1

2018 Tri 1

2017 Tri 2

2017 Tri 1

2016 Tri 2

2016 Tri 1

2015 Tri 2

2015 Tri 1

2014 Tri 2

2014 Tri 1

2013 Tri 2

2013 Tri 1

2012 Tri 2

2012 Tri 1

2011 Tri 2

2011 Tri 1

Exams and tests before 2011

(Links to exams and tests continue below)

To interpret the following older tests/exams that didn't use UI and the ecs100 library, the following changes will generally be sufficient:

  • change System.out.print... to UI.print...
  • when reading input from the user, change scan.next...() to UI.next...() and delete Scanner scan = new Scanner(System.in)
  • change JOptionPane.showInputDialog(null, "prompt string") to UI.askString("prompt string")
  • change canvas.addMouseListener(this); to UI.setMouseListener(this);
  • change canvas.clear(); to UI.clearGraphics();
  • change canvas or this.canvas to UI (for all drawing commands)
  • change
    JButton ... = new JButton("...");
    to
    UI.addButton("...",     this);
  • change
    actionPerformed(ActionEvent e){
    String button = e.getActionCommand();

    to
    buttonPerformed(String button){
  • remove anything with JFrame, frame, DrawingCanvas, Panel, JButton, addActionListener

2010 Tri 2

2010 Tri 1

2009

2008

2007

2006

2005

I Attachment Action Size Date Who Comment
2022T3-test4-ans.pdfpdf 2022T3-test4-ans.pdf manage 152 K 20 Dec 2022 - 11:13 Main.pondy  
2022T3-test4-orig-ans.pdfpdf 2022T3-test4-orig-ans.pdf manage 152 K 20 Dec 2022 - 11:09 Main.pondy  
2022T3-test4-orig.pdfpdf 2022T3-test4-orig.pdf manage 142 K 20 Dec 2022 - 11:09 Main.pondy  
2022T3-test4.pdfpdf 2022T3-test4.pdf manage 142 K 20 Dec 2022 - 11:09 Main.pondy  
2022T3-test5-ans.pdfpdf 2022T3-test5-ans.pdf manage 195 K 04 Jan 2023 - 13:58 Main.pondy  
2022T3-test5.pdfpdf 2022T3-test5.pdf manage 180 K 04 Jan 2023 - 13:58 Main.pondy