亚马逊(amazon)笔试题

1.判断一年是否为闰年的方法
2.非递归实现exists方法

template
class BinaryTree{
protected:
    T* _data;
    BinaryTree * _left;
    BinaryTree * _right;
};

template
class BST:public BinaryTree{
public:
    virtual bool exists(const T& item> const;
};

3.找到下面的bugs
#include
#include

void foo(int a ,char*b)
{
    b=(char *)malloc(64);
    snprintf(b,"you are %d years old!/n",a);
}

int main (void)
{
    char *f;
    foo(23,f);
    printf("%s/n",b);
}

4.Design a subway traffic control system.What objects/classes/modules would you best use for this

purpose?Please draw diagrams and write up class definitions to better illustrate your

design.Write anything additional to clarify your design.

你可能感兴趣的:(参考资料)