WaveMarket Job ApplicationPlease READ AND FOLLOW the instructions below:
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 |