推荐给好友 上一篇 | 下一篇

上海外企英语面试题目和答案

Email test questions. Test time: 40 minutes. 可以用中文回答.
姓名:                           电话:                                 email:                                                                                      
日期:                             开始时间:                        学校:
 
1. How to calculate the execution time of an instruction x=3*a?  (Don’t write code to find out)
  gettimeofday()
jb,hB2w)R"ekX/*
M nu1jsdct f^
需要的头文件: <sys/time.h>外企吧-中国外企1d;h*t7C{&H
int gettimeofday(struct timeval *tv,struct timezone *tz);
a+F3f9~/D;Bn
Y8Y ]i.x6}$a1nstrut timeval {
6j6r3YuKY_long tv_sec; /*
秒数 */
1F!f5EI vS Z.L.f8I3NOlong tv_usec; /*
微秒数 */
CD*B`[G"v#iQ}; 外企吧-中国外企1{o"cN,nv"Q
*/外企吧-中国外企WriYM3G,l
外企吧-中国外企^!h&Q{O9[$~
#include <sys/time.h>
D to(]!c({*?$Rvoid function(void); /* your function */外企吧-中国外企k+? a&u!pj@
外企吧-中国外企i?:[ OOK h
int main(void)外企吧-中国外企NR_*h@ lr}
{
d6[}#^*jg-W+rKJnstruct timeval fun_start,fun_end;
4e@2oB)[z~gettimeofday(&fun_start,NULL);外企吧-中国外企mpn5K }? [6r G"Z
function();外企吧-中国外企`%G}"a].O?&t!}
gettimeofday(&fun_end,NULL);
:MYC1_ [_ }?@q.zreturn 0;
j$],j*e?V}
 一般都这样获得执行时间,但是不太精确,如果我想要精确可以利用CPU的运算周期来计算不过那个代码不哪么容易写的。
2. Write pseudo code to show your algorithm.
  void   Delete(   Student*   head,   long   number   )  
J/L"r8YRce$g V  {  
&}i;{!G g2h2z  Student*   p;   外企吧-中国外企5a[6yQj
    外企吧-中国外企\ wj h'HuoP
  if(!head)  
DtT:Vu:m4sJ'c  {  
f%yX(a O1K;I'y  cout   <<   "\nList   Null!"   <<   endl;  
2I+~9G&jd"Xo,D            return;   外企吧-中国外企)J7no9FN;f
          }   外企吧-中国外企H3A(h]GS'K7Z9P
    外企吧-中国外企EwM2ub N%c0f]
  if(head->number   ==   number)  
\cCmTL `t0t9w  {   外企吧-中国外企@xF7fb-c"\
  p         =   head;   外企吧-中国外企Ji#L,p2h-RzxV
  head   =   head->next;   外企吧-中国外企B G5hE~x
  delete   p;  
+M^5wN'tLGb  return;   外企吧-中国外企vu2p\(S
  }  
4y)BZKn$Zbb4D   
\@d?DP  for(Student*   pGuard   =   head;   pGuard->next;   pGuard   =   pGuard->next)   外企吧-中国外企^~8@n.BXFN
  {   外企吧-中国外企$B4S,xCZE Y \f
  if(pGuard->next->number   ==   number)  
6W\+W^ J*D  {   外企吧-中国外企#U] U9gq){X
  p   =   pGuard->next;  
}d@]Q  pGuard->next   =   p->next;  
-l7q5c%_hB&i$w4H  delete   p;   外企吧-中国外企 u0]o*_ g!_]1sU
  cout   <<   number   <<   "has   been   deleted"   <<   endl;  
e+w&~9r G)cxXC{uG$S  return;   外企吧-中国外企3f.{:N K4u$ht[
  }   外企吧-中国外企 {pkhwH5uL3YVZ
  }  
6S^'r4a ]   
R`"DydU'r O*~  cout   <<   number   <<   "is   not   found"   <<   endl;  
y|(bj1@$o  }  
其实 现在现在几乎所有语言都hashtable的对象,一句话估计就搞定的,估计我这样些出来你们要说不正确。
3a. Ball and buttons: State machine table
State \ Event
Click Play
Click Pause
Reach to the end
Init
消失
 消失
可用
Play
消失
可用
消失
Pause
可用
消失
消失
 
3b. OO class design of “Ball and buttons”
a) How many classes? What are the names of classes?
2
Ball buttons
b) What are the key attributes and methods?
属性
Enabled
方法
Click()
c) Draw the uml class diagram. (bonus,选做题)


查看全部1条评论

最新评论

  • 删除 Guest (2008-10-07 15:41:37, 评分: 5 )

    5
 

评分:0

我来说两句

seccode