Lab Test
All students will sit a 90-minute test in regular lab times in week 3.
You will not use the labs repository to complete the lab test. Instead, you will create your own repositories as part of the test. When you sit the test, you will find instructions on the desktop of the computer when you log in.
Your lab test will include the HelloWorld exercise from lab 1, plus four questions chosen at random from the homework questions for units J1, J2, J3, J4, J5 , J6, and O1). The test will not contain any questions that you have not seen before. Work through all of your homework questions to ensure that you are fully prepared for the exam.
The how-to video Lab test, question 1 shows you how to complete Question 1 of the lab test. Be sure to watch it and ensure that you can complete question one without help (the video is from 2016 so there are minor differences to the appearance of IntelliJ, however the steps remain the same).
Your mark in the lab test is redeemable against the final exam.
The structure of the test will be as follows:
COMP1110 Lab Test
The test will be marked out of 20. Your mark will be divided by 4 to give a final mark out of 5.
Tasks
No Materials permitted.
Question 1 (5 Marks)
You will be asked to answer the following question:
- Using IntelliJ, create a new Java project called
comp1110-labtest
. - Import the project into git (
VCS
->Import into Version Control...
->Create Git Repository...
. Select the default location (comp1110-labtest) as the place where the new git repository is created. - Within your project’s src directory, create a new Java class called
comp1110.labtest.HelloWorld
(you should add the file to git when prompted). - Force JUnit to be added to your project’s classpath. Place your cursor within your HelloWorld class, and type
Ctrl+Shift+T
(orNavigate
->Test
). SelectOK
when prompted with “Create test in the same source root?”. This will bring up the Create New Test dialogue. In the “Testing library:” drop-down, select Junit4. Use theFix
button to add Junit to your module. You can then pressCancel
. Be sure to choose Junit4 (not Junit3 or Junit5). - Now add comp1110-labtest.jar to your module’s dependencies.
File
->Project Structure...
, chooseModules
and select theDependencies
tab. Use the+
button (mid-right of window) and selectJARs or directories...
then navigate to yourcomp1110-labtest.jar
which you should download if you’re practicing, or you’ll find on your desktop when you’re sitting the lab exam. You should now see thatcomp1110-labtest.jar
is within yourExternal Libraries
folder within your IntelliJ project. - Navigate to your
Exernal Libraries
folder and you should seecomp1110-labtest.jar
. Expand the jar and you should seerunConfigurations
. SelectrunConfigurations
and copy it (right mouse click or ctrl+C) and the paste it inside your.idea
folder. Once you do that, you should see tests appear next to the green run button at the upper right of your screen. - Navigate back to your
HelloWorld
class, and modify it so that its main method printsHello world!
. - Test your
HelloWorld
class by selecting theQ1 HelloWorldTest
option from the drop-down next to the green run button. - Once your
HelloWorld
class passes the tests, commit it to your git repo.
Question 2 (5 Marks)
You will be asked to answer one of the following questions:
Question 3 (5 Marks)
You will be asked to answer one of the following questions:
Question 4 (5 Marks)
You will be asked to answer one of the following questions: