问题 完形填空
完形填空。
     Henry was not   1   at math. Even when the teacher explained something a second time, he still couldn't 
  2   it.
     "Never mind. I'll sit   3   the boy who's the best at   4  , " Henry thought, "and   5   his answers."
      The day of the exam   6  , and Henry sat next to Allan,   7   was   8   at the top of the class in math.
Henry copied Allan's answers   9   his own exam paper. At the end of the exam, the teacher said, "Well, boys
and girls, I've decided to give a red  10  to the student who got the  11  grade. It's  12  for me to decide who
I'll give the star to, however,  13  two students, Henry and Allan, got the  14  grade." After a moment she
went on, " 15  I've decided to give the star to  16  this time."
      Henry was  17  when he heard this. He stood  18  and said, "But I got the same grade as Allan, madam."
      "That's  19 ." The teacher said. "However, Allan's answer to Question 6 was 'I don't know.', but  20  was
'Nor do I.'"

( )1. A. well         
( )2. A. retell      
( )3. A. next to     
( )4. A. English   
( )5. A. check     
( )6. A. ended     
( )7. A. which     
( )8. A never      
( )9. A. in       
( )10. A.book     
( )11. A. highest   
( )12. A. hard    
( )13. A. if       
( )14. A. low      
( )15. A. So        
( )16. A. Allan      
( )17. A. afraid    
( )18. A. out        
( )19. A. true    
( )20. A. his      

B. good        
B. answer      
B. besides     
B. math        
B. copy        
B. over        
B. that        
B. almost      
B. on          
B. coat         
B. best        
B. easy        
B. though      
B. high        
B. Because     
B. Henry      
B. angry      
B. for         
B. wrong       
B. mine        
C. better   
C. remember   
C. behind   
C. science 
C. keep     
C. came     
C. whom     
C. always   
C. onto     
C. pen      
C. lowest   
C. unusual 
C. until   
C. same     
C. But      
C. nobody   
C. pleased 
C. up       
C. OK       
C. yours   
D. best         
D. understand   
D. in front of  
D. Chinese      
D. choose       
D. start        
D. who          
D. sometimes    
D. at           
D. star         
D. least        
D. important                       
D. because      
D. different    
D. And          
D. anybody      
D. worried      
D. by           
D. all right    
D. others'     
答案

1-5 B D A B B  6-10 C D C C D  11-15 A A D C C  16-20 A B C A C

单项选择题
填空题

阅读以下说明和C++代码,将应填入 (n) 处的字句写在对应栏内。

[说明]

传输门是传输系统中的重要装置。传输门具有Open(打开)、Closed(已关闭)、Opening(正在打开)、StayOpen(保持打开)、Closing(正在关闭)5种状态。触发传输门状态转换的事件有crick、complete和timeout三种。事件与其相应的状态转换如图18-5所示。

下面的“C++代码1”与“C++代码2”分别用两种不同的设计思路对传输门进行状态模拟,请填补代码中的空缺。

[C++代码1]

const int CLOSED=1;const int OPENING=2;

const int OPEN=3;const int CLOSZNG=4;

const int STAYOPEN=5;//定义状态变量,用不同整数表示不同状态

class Door

private:

int state;//传输门当前状态

void setState(int state)(this->state=state;)//设置当前状态

public:

Door():state(CLOSED):

void getstate()//根据当前状态输出相应的字符串

switch(state)

case OPENING:cout<<""OPENING""<<end1;break;

case CLOSED:cout<<("CLOSED"<<end1;break;

case OPEN:cout<<"OPEN"<<end1;break;

case CLOSZNG:cout<<"CLOSZNG"<<end1;break;

case STAYOPEN:cout<<"STAYOPEN"<<end1;break;

void cliok()//发生click事件时进行状态转换

if( (1) )setStsate(OPENING);

else if( (2) )setState(CLOSZNG);

else if( (3) )aetState(STAYOPEN);

void timeout()//发生timeout事件时进行状态转换

if(state==OPEN)setState(CLOSZNG);

void complete()//发生complete事件时进行状态转换

if(state==OPENING)setState(OPEN):

else if(state==CLOSZNG)setState(CLOSED);

int main()

Door aDoor;

aDoor.getState();aDoor.click();aDoor.getStaLe();aDoor.Complete();

aDoor.getState();aDoor.click();aDoor.getState();aDoor.click();

aDoor.getState();return 0;

[C++代码2]

Class Door

public:

Doorstate *CLOSED,*OPENING,*0PEN,*CLOSZNG,*STAYOPEN,*state:

Door():

virtual ~Door()……//释放申请的内存,此处代码省略);

void setState(Doorstate *state)(this->state=state;

void getState()

//此处代码省略,本方法输出状态字符串

//例如,当前状态为CLOSED时,输出字符串为"CLOSED"

void C1ick();

void timeout();

void complete();

Door::Door()

CLOSED=new DoorClosed(this);OPENING=new Dooropening (this);

OPEN=new DoorOpen(this);CLOSING=new DoorClosing(this);

STAYOPEN=new DoorStayOpen(this);state=CLOSED:

void Door::C1ick()( (4)

void Door::timeout()( (5)

void Door::complete()( (6)

class DoorState//定义一个抽象的状态,它是所有状态类的基类

protected:Door *door;

public:

DoorState(Door *door)(this->door=door;

virtual ~DoorState(void);

virtual void click()

virtual void complete()

virtual void timeout()

class DoorClosed:PubliC DoorState(//定义一个基本的Closed状态

public:

DoorClosed(Door *door):DoorState(door)

Virtual ~DoorClosed()

void click();

void DoorClosed::click()( (7)

int main()

Door aDoor;

aDoor.getState();aDoor.click();aDoor.getState();aDoor.complete();

aDoor.getState();aDoor.timeout();aDoor.getState();return 0;

(6)处填()。