关键词 > CSCI2134

CSCI 2134 Final Exam, Fall 2025

发布时间:2025-12-13

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CSCI 2134 Final Exam, Fall 2025

3:30PM – 6:30PM Atlantic Standard Time, December 18, 2025; Submitted via Git .

At the Start of the Exam on December 18 at 3:30PM.

Clone the Final Exam repository

https://git.cs.dal.ca/courses/2025-fall/csci-2134/final/????.git

where ???? is your CSID.

Be sure that the provided code compiles and that the provided JUnit tests run in IntelliJ.

All code modifications must occur within the repository. Only files which are committed and pushed to the remote repository will be considered. All written answers are to be placed in the Answers.txt file.

Exam Rules

•   The exam should be written using whatever development tools that you prefer.

•   All exams will be reviewed by the course instructor.

•   The exam is open book. You are permitted access to:

o Your course notes, Brightspace, git.cs.dal.ca, and any content linked within them.

o All code that you have written previously.

o Any books that you have at the time of writing.

o Java API: https://docs.oracle.com/en/java/javase/21/docs/api/index.html

You are NOT permitted to:

o Perform web searches or get help from the Internet beyond the Java docs.

o Use any AI-powered tools, Generative AI, or Large Language Models.

o Receive assistance from any other person either locally or remotely.

o To take any other unfair advantage of the situation.

•    Using AI-driven tools when producing submitted work constitutes an academic offence.

•   The exam is 3 hours (180 minutes) in length.

o When you first begin the exam you must clone the new code, add your name and Banner ID to Answers.txt, git add, commit, and push.

o If you have accommodations for writing exams, these will be reflected in your exam settings.

o If you encounter any issues, please let the course instructor know immediately.

•   To ask questions during the exam, raise your hand.

Questions

0.   All documentation and specifications about what the code is intended to do is provided within the code and in the specifications.pdf found in the docs/ folder. You can assume that all comments and documentation are correct. What is incorrect is the implemen-tation.

1. [10 marks] Using Git, clone the repository for your exam. Add your name and Banner ID to Answers.txt. git add, commit, and push. For each of the following questions, use git to commit and push your answers at each step.

NOTE: To get full marks you MUST perform a commit AND push after each question.  This way, if something goes wrong, each part can be reviewed separately. Feel free to commit more than once for any question. More commits are better than not enough!

ADDITIONAL NOTE: Sometimes the Git server is slow when many students access it at the same time, particularly at the beginning and end of the exam period. To avoid any issues, you must perform a commit after every question.

2. [20 marks] Debugging and Testing.

Some unit and component tests are provided to you. But, some of them fail.

(a)  Debug and FIX the issues causing these tests to fail. There are at least four (4) bugs in the source code. Assume that there are no bugs in the tests themselves. For each bug found, include the following in Answers.txt:

(i)   A brief description of what caused the bug,

(ii) The location (file, method and/or line number) of the bug, and

(iii) How you fixed the bug.

(b)  Do regression testing. All unit and component tests should now pass. Commit and push all your updates.

3. [10 marks] Defensive programming.

(a)  Identify three (3) locations in the code where an assertion is appropriate OR where throwing an exception is appropriate. You may identify any combination of assertions or exceptions.

For each assertion identified, record in Answers.txt:

(i)      The location (file, method, line number) of the assertion

(ii)      What property is being asserted.

For each exception identified, record in Answers.txt:

(i)      The class and method that should throw the exception,

(ii)      What exception to throw, and

(iii)       Under what conditions should it be thrown.

(b)  Implement the assertions/exceptions identified in part (a) in the code. If any test fails or does not compile now that you have implemented the exception, fix the test.

(c)  Do regression testing. All unit and component tests should now pass. Commit and push all your updates.

4. [30 marks] Data-level, Statement-level, and Routine-level Refactoring.

The code provided, now debugged and augmented with defensive programming, is still less than ideal in terms of code quality. Time to refactor.

(a)  Identify five (5) different opportunities to apply procedural refactoring (e.g. you can only replace magic numbers with a constant once). Multiple refactorings may apply to the same code region. For each refactoring identified, include in An- swers.txt:

(i)   The location (file, method/line number) of the original code,

(ii) The code smell that inspired the refactor,

(iii) A brief description of the proposed fix.

(b)  Implement the refactorings identified in part (a). After implementing each refac- toring, ensure that all tests pass before implementing the next refactoring. You should not need to modify the tests themselves to make them pass; remember that refactoring should not change functionality.

(c)  Do regression testing. All unit and component tests should now pass. Commit and push all your updates.

5. [30 marks] Class-level Refactoring.

To continue improving code quality, we now want to implement class-level refactoring. In particular, we are looking to apply refactorings which will improve the code quality, and the code’s extensibility and adaptability to new requirements.

(a)  Identify four (4) class-level refactoring opportunities to be applied to the code. For each refactoring identified, include in Answers.txt:

(i)   The class or classes to be impacted by the refactoring,

(ii)  Whether this is a class-implementation or class-interface refactoring,

(iii) The location and brief description of the issue,

(iv) Which SOLID principle (if any) is violated,

(v)  How to fix the issue.

(b)  Implement the refactorings identified in part (a). After implementing each refac- toring, ensure that all tests pass before implementing the next refactoring. Since interfaces are likely to be modified during class-level refactoring, you may need to modify the tests themselves to make them pass.

(c)  Do regression testing. All unit and component tests should now pass. Commit and push all your updates.

End of Exam

•    Ensure your name and Banner ID are included in Answers.txt.

•    Ensure all files are added, committed, and pushed to the Git server. If your work is not pushed, it does not count. You can double check your submission is complete by going to https://git.cs.dal.ca/courses/2025-fall/csci-2134/final/????.git, where ???? is your CSID.

•   All work must be committed by 18:30. The timestamp of the commit will determine this. Pushing to the Git server will be closed at 18:35. So you have some buffer time to push out your final commit. (Times are adjusted accordingly if you have accommodations.)