amazon笔试题

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

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

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

3.找到下面的bugs
#include<stdio.h>
#include<malloc.h>

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.

猜你喜欢

转载自vergilwang.iteye.com/blog/2011230