第1题:
阅读下列函数说明和C++代码,回答问题
[说明]
任何一种程序都是为了解决问题而撰写的,解决问题时需要实现一些特定的运算法则。在策略(Strategy)模式下,可以更换实现算法的部分而不留痕迹,切换整个算法,简化改为采用其他方法来解决同样问题。
以下是一个“剪刀石头布”游戏。猜拳时的“策略”有2种方法:第一种是“猜赢后继续出同样的招式”(WinningStrategy),第二种是“从上一次出的招式中,以概率分配方式求出下一个招式的几率”(ProbStrategy)。程序中定义了Hand类表示猜拳时的“手势”,类内部以0(石头)、1(剪刀)、2(布)来表示。Hand类的实例只会产生3个。以下是C++语言实现,能够正确编译通过。
[C++代码]
class Hand{
private:
int handvalue;
static Hand *hand0;
static Hand *hand1;
static Hand *hand2;
(1) ;
Hand(int handvalue){
this->handvalue = handvalue;
}
public:
(2) Hand* getHand(int handvalue){
/*省略具体实现*/
}
};
Hand *Hand::hand0 = new Hand(0);
Hand *Hand::hand1 = new Hand(1);
Hand *Hand::hand2 = new Hand(2);
class Strategy{
public:
(3) Hand* nextHand() = 0;
};
class WinningStrategy : public Strategy{
private:
bool won;
Hand *prevHand;
public:
winningStrategy(){
won = false;
}
Hand* nextHand(){
if(!won){
prevHand = Hand::getHand(rand()%3);
}
return prevHand;
}
};
class probstrategy : public Strategy{
public:
Hand* nextHand(){
int handvalue = 0;
/*省略具体实现*/
return Hand::getHand(handvalue);
}
};
class Player{
private:
string name;
Strategy* strategy;
public:
Player(string name, (4) strategy){
this->name = name;
this->strategy = strategy;
}
Hand *nextHand()(//向战略请示手势
return (5) ;
}
};
第2题:
You need to()those questionnaire papers for your company.
A. hand out
B. hand in
C. hand on
答案:B
解析:句意:你需要把那些问卷交给公司。
A. hand out 分发;施舍; 散发;给予
B. hand in 交上;提交;呈送.
C. hand on 转交;传递下去;移交,转发,这里的on是副词,表示继续的意思,通常会组成词组hand on sth to sb
本句的意思主要表达把问卷上交给公司的意思。故而选择B
第3题:
A.ropes in hand
B.ropes are in hand
C.with hand in ropes
D.hand with ropes
第4题:
The essay requires perfecting
A.hand it over
B.hand over it
C.hand over
D.have handed it over
第5题:
All of the students are__________(suppose) to hand in their homework on time.
第6题:
第7题:
Must we hand in our homework now?()
第8题:
will finish
will have finished
have finished
have been finishing
第9题:
you mustn't
you can't
you needn't
you shouldn't
第10题:
to their final position with the winch operating at slow speed
to the bar stop,and then hand cranked to their final position
until just before they make contact with the limit switch,and then hand cranked to their final position
to the embarkation deck,and then hand cranked to their final position
第11题:
第12题:
the indicators
the starting valves
the cylinder lubricators
the turning gear
第13题:
We have to()our annual work report to the manager next week.
A. hand in
B. hand out
C. hands up
第14题:
I was not late for class yesterday, just having no time to hand in my homework before class. (英译汉)
第15题:
I hope you can () you term papers before the deadline
A、submitted
B、hand out
C、hand in
D、submit to
第16题:
We're ______ to hand in our homework next week.
A、proposed
B、supposed
C、opposed
D、imposed
第17题:
Vessel propellers are classified as being right hand or left hand.A right hand propeller turns clockwise when viewed from______.
A.the bow
B.the stern
C.the port side
D.the starboard side
第18题:
Must we hand in our homework now?()
AYes, you will
BYes, you mustn‘t
CNo, you needn‘t
DNo, you mustn‘t
第19题:
hand over hand(步行模型)
第20题:
Yes, you will
Yes, you mustn‘t
No, you needn‘t
No, you mustn‘t
第21题:
one fixed power pump and one portable hand pump
one fixed hand pump and one portable hand pump
two portable hand pumps
either A or B
第22题:
the indicators
the starting valves
the cylinder lubricators
the turning gear
第23题:
you mustn’t
you can’t
you needn’t
you shouldn’t