Task: Use C++ to implement the functionality of matrix and a simple user interface to manipulate matrix
Requirements:
1. Good programming style, design & production code quality
2. Can hold any type of data which meet certain requirements
3. Support any number of elements
4. Support common matrix operators (Only +, -, * are required)
5. Correct copy behavior
6. Support different ways to store the matrix data in a optimized way(For example, does sparse matrix & normal matrix use the same data structure?)
Optional Requirements:
7. Can send events occurring inside matrix to others (For example, when the size of matrix changes, send a OnSizeChange event to those who are interested in this event)
8. Achieve best possible performance
9. Or whatever you think appropriate(Reference counting, etc)
这是今年AUTODESK招聘实习生的题目
Autodesk笔试题目
C/C++ Programming
1,列出两个情况是必须使用成员初始化列表,而不在构造函数里面赋值
2,#define DOUBLE(x) x+x
i = 5 * DOUBLE(10)
这个时候i是什么结果?
正确的DOUBLE应该怎样写?
3,static_cast和dynamic_cast有什么区别?
4,namespace解决了什么问题?
5,auto_ptr是什么东西,有什么用?
Algorithm and GP
1, 写出三个你熟悉的排序法,以时间复杂度的大小排序
2, 写出一个使用递归来反转一个单向链表的函数
3, 写一个程序测试系统是Big_Endian的还是Little_Endian的(以前万老师发帖讨论过了)
C++ Programming
1, C++有管理多种内存,分别写出他们是什么,他们的特性和性能如何?
2, 写出一个基于char*的string类,包括构造析构函数和赋值运算符,取字串长度等基本操作
Graphic(两题都不会,全忘了)
……
IQ
1, 称面粉(经典题)
2, 在平面上有一系列间距为2的无限长的平行线,在上面扔单位长度的线段,和平行线相交的概率是多少?
3, A君和B君见到B君的三个熟人X,Y,Z
A君问B君:“他们的多大”
B君说:“他们的年龄之和是我们的年龄之和,他们的年龄的乘积是2450”
A说:“我还是不知道”
B说:“他们都比我们的朋友C要小”
A说:“那我知道了”
问C的年龄是多少?
MFC(不太会做,记不清楚了)
1, 怎么为窗口自定义消息
2, SendMessage和PostMessage的区别
3, CRuntimeClass是由什么用的?他是怎样得到的?
4, 怎样通过一个句柄得到CWnd的指针
在网上瞎逛,看到这样一道题目“鼠标左键点击在非当前窗口的标题栏上,会产生什么样的win32消息?”。当时感觉有点茫然,不就是WM_LBBUTTONDOWN、WM_ACTIVATE和WM_SETFOCUS吗?后来感觉可能不是这么简单,就用Spy++跟踪了一下,果然多了不少消息。
在NC点击发出的消息流程如下:
WM_NCHITTEST
//在鼠标点击非激活窗体的时候发出的,如果是点在子窗体上,还会通过DefWindowProc发给父窗体
WM_MOUSEACTIVATE
//鼠标左键点在NC发出的消息
WM_NCLBUTTONDOWN
WM_WINDOWPOSCHANGING
WM_WINDOWPOSCHANGED
//在应用程序切换的时候,用来Deactivate和Activate应用程序
WM_ACTIVATEAPP
//改变窗体在Activated和Deactivated状态下的NC
WM_NCACTIVATE
//Activate和Deactivate窗体,在同一个输入消息队列中Deactivate消息在前,随后才是activate消息;在不同的输入消息队列中,这两个消息被异步处理
WM_ACTIVATE
WM_NCLBUTTONMOVE
WM_NCLBUTTONUP
//当窗体获取键盘焦点的时候,才会发出这个消息
WM_SETFOCUS
在用户区的子窗体上点击的消息流程如下:
//一般用来处理create、destroyed和鼠标消息,是子窗体发给所属父窗体的消息
WM_PARENTNOTIFY(WM_LBUTTONDOWN)
WM_MOUSEACTIVATE
WM_WINDOWPOSCHANGING
WM_WINDOWPOSCHANGED
WM_ACTIVATEAPP
WM_NCACTIVATE
WM_ACTIVATE
通过Alt+Tab让该应用程序Deactivate的消息流程如下:
//The WM_CANCELMODE message is sent to cancel certain modes, such as mouse capture. For example, the system sends this message to the active window when a dialog box or message box is displayed. Certain functions also send this message explicitly to the specified window regardless of whether it is the active window. For example, the EnableWindow function sends this message when disabling the specified window.
WM_CANCELMODE
WM_NCACTIVATE(FALSE)
WM_ACTIVATE(FALSE)
//An application sends the WM_CHANGEUISTATE message to indicate that the user interface (UI) state should be changed
WM_CHANGEUISTATE
WM_ACTIVATEAPP(FALSE)