conducted online using the TestInvite platform

Practice exam – sample questions

Exam date and time: Friday 20th August at 2 pm NSW time

Duration: 2 hours

Location: The exam will be conducted online using the TestInvite platform. You will receive the link to the exam closer to the date.

Attention students who are currently located in China

  • TestInvite is blocked in China.
  • You will sit the same exam as other students however you will do the exam via zoom instead of TestInvite.
  • This option is only available to students who are located in China at the time of the exam.

ALL STUDENTS please note that:

  • ALL students will need a webcam to take the exam. If you do not own you will need to acquire one prior to the exam.
  • ALL students must have their student id at the exam and will be required to show it to start the exam.
  • The exam is must pass meaning if you do not pass the exam you do not pass the unit.
  • These are some sample questions, the number of the questions in the real exam will vary.
  • The exam is designed to be easily passable by a student who had attended class and completed the workshop activities.
  • The exam is NOT closed book meaning you can assess the study guide, textbook etc. You are also allowed to look at Java documentation or other resources online. HOWEVER, YOU CAN NOT COPY AND PASTE ANYTHING FROM ANY RESOURCE INTO THE EXAM. This includes written answers and code. Any attempt to copy and paste any answer from any resource into the exam will be considered academic misconduct.
  • The only exception to the copy and paste rule is you ARE allowed to write code in NetBeans then copy the answer into the exam as long as you wrote the code yourself and it is not identical to any code provided to you in class.
  • The exam papers will be put through Turnitin to look for any identical answers. Identical answers from any students to any question will mean that the students have copied the answer from a resource (i.e. study guide, website) into the exam paper. Any students found to do this will be submitted for academic misconduct and will fail the unit.
YOU MAY ALSO READ ...  Topic: Research Concepts Matrix Paper – Original Paper

Part A: Short Answer Questions.

  1. What is polymorphism? (2 marks)
  2. What is the difference between accessor method and mutator method? (2 marks)
  3. What annotation is used when implementing a method from an abstract class or interface?
    (2 marks)
  4. What is an overloaded constructor? (2 marks)
  5. What is the difference between Iterator and ListIterator ? (2 marks)
  6. Provide 2 differences between linkedList and ArrayList. (2marks)
  7. Explain what the Super keyword is used for in Java (2 marks)
  8. Write 2 example method signatures for an overloaded method called getName (2 marks)
  9. Write the code for an interface called Car that has a method called numberOfWheels that returns an integer (4 marks)
  10. Write a constructor for the Date class given the following sample object creation code (2 marks)
YOU MAY ALSO READ ...  Can colored pictures be drawn for a picture story for preschool aged children to coincide with the story ?

new Date(“March”, 30, 1932);

  1. Write a default constructor for the Date class above (2 marks)
  1. Given the Animal class below, create a class Dog that inherits animal. The Dog class must have at least 2 instance variables that are initialized in a constructor (6 marks)

abstract class Animal

private int numberOfLegs;

private String colour;

protected Animal(int numberOfLegs, String colour)

this.numberOfLegs = numberOfLegs;

this.colour = colour;

public abstract String colour();

  1. Write the code to use a ListIterator to loop through the following LinkedList (2 marks)

LinkedList colours = new LinkedList();

colours.add(new Colour(“Blue”));

colours.add(new Colour(“Green”));

colours.add(new Colour(“Yellow”));

colours.add(new Colour(“White”));

colours.add(new Colour(“Black”));

  1. Write a declaration for a new HashSet of Person objects, called students. Initialise the new HashSet. Note: you may leave it empty (2 marks)
  2. Write the code to add a Person object to the HashSet declared for question 14 above. Assume the Person class has a default constructor (2 marks)
  3. Write a class called Cat that implements the Animal interface shown below (6 marks)

public interface Animal

String colour(); // return colour

void newColour(String s); // update colour

Part B: Java Programming Problems.

  1. Write a program in Java to store a collection of movie names. There should be no duplicate movies in the collection. The program must contain a method for each of the following: (20 marks):
  • add a movie
  • remove a movie
  • check if a movie exists
  • delete all movies
  • print out the number of movies
  • print a list of all movie names

Hint: each method that does something with a particular movie will need a parameter.

  1. Write a program in java that implements a HashMap to store students (student ID as the key, and student name as the value). The rogram only requires one method that: (10 mark):
  • adds 4 students to the HashMap
  • prints all students’ names
  • removes all of the students at once



YOU MAY ALSO READ ...  I need assistance converting this paper into a proposal as opposed to research, and how it can relate to Borderline Personality disorder.