Written One

Candidate Name:                                          

Date:

 

This is a short test designed to allow you to demonstrate your technical knowledge and problem solving ability. It should be completed in under an hour and submitted prior to interview.

 

In each case credit will be awarded to thoughtful responses even if the answer is not correct.

 

Section 1: Try to answer all questions. We suggest you spend no longer than 20 mins on this section.

 

  1. Why would you use a Map instead of a List?

 

 

 

 

 

 

 

 

 

  1. What basic problems might occur when you are using threads?

 

 

 

 

 

 

 

 

 

  1. You want to sort a java.util.Collection. Identify the two interfaces in java.util which support this kind of action and how you might do this?

 

 

 

 

 

 

 

 

 

  1. You are writing code that makes changes to a TableModel periodically using a Timer. Do you need to consider what thread you are running on?

 

 

 

 

 

 

 

 

 

  1. When does the Event Dispatch Thread start?

 

 

 

 

 

 

 

 

 

  1. What is the difference between the glass pane and the content pane?

 

 

 

 

 

 

 

 

 

  1. What is the difference between invokeLater and invokeAndWait in SwingUtilities?

 

 

 

 

 

 

 

 

 

  1. Describe how you would write a unit tests for the method boolean isNegative( Integer anInt ).

 

 

 

 

 

 

 

 

 

  1. Describe a pattern (not Singleton and preferably not Observer)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

Section 2: Try to answer all three Questions. Extra time is allocated for these questions as the answers

 

(1) The Bricks and the Scales (~10 mins)

 

 

You have seven bricks. One brick weighs more than the other six. Using a pair of scales, find a strategy for discovering the heavier brick in the minimum number of weighing attempts.

(Hint: it is possible to do it in 2 weighing attempts).

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

(2a) The Light Bulb Question (~10 mins)

 

 

 

 

 

 

 

Switch 1

Switch 2

Switch 3

 

 

 

 

 

 

 

 

 

Which switch turns on which bulb?

Rules

  1. The switches are all standard i.e. down is on, up is off
  2. You may play with the switches as much as you like.
  3. You may only go into the room once.
  4. The door only opens once when you enter the room and there is no way to see in or out of the room when the door is closed.

 

 

 

 

 

 

 

 

 

 

 

 

(2b) The Light Bulb Question II (~5 mins)

 

 

 

 

 

 

 

Switch 1

Switch 2

Switch 3

Switch 4

 

 

 

 

 

 

 

 

 

Which switch turns on which bulb?

Rules

  1. The switches are all standard i.e. down is on, up is off
  2. You may play with the switches as much as you like.
  3. You may only go into the room once.
  4. The door only opens once when you enter the room and there is no way to see in or out of the room when the door is closed.

 

 

 

 

 

 

 

(3) The Duck and the Fox (~15 mins)

 

 

 

 

There is a duck sitting on a pond. A fox is circling the pond trying to catch the duck. The duck can only take off from land so needs to get to the bank before the fox can catch her.

Assumptions:

 

The duck can make it to the bank without being eaten by the fox? Explain your how.

 

Hint: You do not need to provide a mathematical proof for this. You just need to provide an intuitive argument. Extra credit will be given for comments for how your argument might be provable.