Computer Laboratory

Supervisions 2009/2010

Supervision questions: Further Java

This is the set of questions for my supervisions in Further Java. I will typically email you a list of question numbers before each supervision, but if not, attempt the next two or three. (More questions will appear here as I set them, so come back if you want to make an early start on some of the future work.)

Administrativa & handing in work

I expect you to make a good attempt at producing solutions to the relevant questions before each supervision. I prefer submissions by email (PDF or text format). Please submit your work 24 hours before the supervision. If you want to submit a hard copy of the work to student administration, please hand it in before 17:00 two days before the supervision (i.e. before Wednesday, 17:00 for a Friday afternoon supervision) as I will have to scan it. Remember that Student Administration is closed on weekends.

When emailing me regarding supervisions, please only use my lab address, or your email will be misfiled and may slip by unnoticed:

The mark allocation (whilst very approximate) should give you a rough idea of how you should divide your time between the questions, as well as how much credit I expect a similar question to be worth in the exam. It will also serve as a guide for me when marking the questions.

Some of these questions are asking you to write code. In his case, please submit the source code and a transcript of it compiling and running, as shown in the example below (or the equivalent output from the console in an IDE, e.g. Eclipse):

malte@cassiopeia:~$ javac 
malte@cassiopeia:~$ java Foo
Hello World!

If there is a particular part of the course you would like explaining, or questions you have about the lectures (independent of whether they are covered by the questions or not), please let me know in an email before the supervision so that I can prepare appropriately.

Supervision 1: Extended Java Features, Serialization, Class Loaders and Reflection

  1. 2001 Paper 3 Question 2, parts (a) and (b) only [10 marks]
  2. 1999 Paper 3 Question 3 [20 marks]
  3. If a field is declared with protected access, from where can it be accessed? Is there any situation in which a private field defined on some class A can be accessed but a protected field defined on A cannot? [5 marks]
  4. 2009 Paper 5 Question 5, parts (a) and (b) only [16 marks]
  5. 2005 Paper 4 Question 8, parts (a) and (b) only [14 marks]

Supervision 2: Concurrency, Threads, Transactions and References

  1. 2001 Paper 4 Question 3 [20 marks]
  2. 2009 Paper 5 Question 6 [20 marks]
  3. 2008 Paper 4 Question 1, part (c) only [10 marks]
  4. 2009 Paper 3 Question 3 [20 marks]
  5. 2009 Paper 5 Question 5, part (c) only [5 marks]
  6. Consider two class definitions: A, and B which extends A. In the context of the relationship between the types A[] and B[], explain the difference between covariance and contravariance. Is Java covariant or contravariant? [4 marks]