WaveMarket Job Application

Please READ AND FOLLOW the instructions below:

  1. Pick and solve at least two of the challenge problems below.
  2. Go beyond your resume: Write a few paragraphs describing ways in which you might add value to our software engineering efforts.
  3. Send these paragraphs, your answers, and your resume (as in-line text, attached text, or attached PDF) to wavemarket_jobs [.at.] wavemarket [.d0t.] com
Note: Submissions with Microsoft Word documents attached will not be considered. (Yes, this is part of the selection process!)



Problem 1

In 100 words or fewer, explain what this code sample does:

#include <stdlib.h>

struct A;
struct B;
struct C;

struct A
{
  static A * ptr;
  int & a, & b, &c;

  A(int & x, int & y,int & z) : a(x), b(y), c(z) {}
  virtual ~A();
};

struct B: public A
{
  typedef C D;
  B(int & b,int & c) : A(b,b,c) {}
  ~B();
};

struct C : public A
{
  typedef B D;
  C(int & b,int & c) : A(c,b,c) {}
  ~C();
};

A::~A() { a = b + c;        }
B::~B() { ptr = new D(b,c); }
C::~C() { ptr = new D(b,c); } 

int x = 0;
int y = 1;

A * A::ptr = new B(x,y);

int main(int argc, char** argv) 
{
  int n = argc > 1 ? atoi(argv[1]) : 0;

  for (int i = 0; i < n; ++i)
  {
    delete A::ptr;
  }
}


Problem 2

With a standard 52 card deck, I deal 13 hands of 4 cards. What is the probability that no hand contains a duplicate suit? It is not necessary to reduce your answer to decimal form, but you should attempt to express the result as simply as possible.



Problem 3

When does X + ~X + 1 == 0 ?



Problem 4

Write a "URLGetter" class in Java that reads a list of URLs from the command line, retrieves each URL, and informs a Observer of its progress. Then, write a "ProgressObserver" class that prints the progress information, e.g.

$ java -classpath . ProgressObserver http://www.wavemarket.com
http://www.wavemarket.com: 3467 bytes
1024/3467
2048/3467
3072/3467
3467/3467