中级软件设计师下半年下午试题Word文档下载推荐.docx
- 文档编号:7658477
- 上传时间:2023-05-08
- 格式:DOCX
- 页数:16
- 大小:207.65KB
中级软件设计师下半年下午试题Word文档下载推荐.docx
《中级软件设计师下半年下午试题Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《中级软件设计师下半年下午试题Word文档下载推荐.docx(16页珍藏版)》请在冰点文库上搜索。
根据需求分析阶段收集的信息,设计的实体联系图和关系模式(不完整)如下图:
实体联系图
[关系模式设计]
超市(超市名称、经理、地址、电话)
部门((a),部门经理、联系电话)
员工((b),姓名、联系方式、职位、工资)
商品(商品号、商品名称、型号、单价、数量)
配给((c),配给时间、配给数量、业务员)
4、根据问题描述,补充四个联系,完善图上图的实体联系图。
联系名可用联系1、联系2、联系3和联系4代替,联系的类型分为1:
1、1:
n和m:
n(或1:
*和*:
*)。
5、根据实体联系图,将关系模式中的空(a)~(c)补充完整;
(2)给出部门和配给关系模式的主键和外键。
6、超市关系的地址可以进一步分为邮编、省、市、街道,那么该属性是属于简单属性还是复合属性?
请用100字以内文字说明。
(2)假设超市需要增设一个经理的职位,那么超市与经理之间的联系类型应修改为(d),超市关系应修改为(e)。
试题三
阅读以下说明和图,回答下列问题。
某公司欲开发一个管理选民信息的软件系统。
系统的基本需求描述如下:
7每个人(Person)可以是一个合法选民(Eligible)或者无效的选民(Ineligible)。
8每个合法选民必须通过该系统对其投票所在区域(即选区,Riding)进行注册(Registration)。
每个合法选民仅能注册一个选区。
9选民所属选区由其居住地址(Address)决定。
假设每个人只有一个地址,地址可以是镇(Town)或者城市(City)。
10某些选区可能包含多个镇;
而某些较大的城市也可能包含多个选区。
现采用面向对象方法对该系统进行分析与设计,得到如下图所示的初始类图。
类图
7、根据说明中的描述,给出上图中C1~C4所对应的类名(类名使用说明中给出的英文词汇)。
8、根据说明中的描述,给出上图中M1~M6处的多重度。
9、现对该系统提出了以下新需求:
(1)某些人拥有在多个选区投票的权利,因此需要注册多个选区;
(2)对手满足
(1)的选民,需要划定其“主要居住地”,以确定他们应该在哪个选区进行投票。
为了满足上述需求,需要对上图所示的类图进行哪些修改?
试题四
阅读下列说明和C代码,回答下列问题。
计算一个整数数组a的最长递增子序列长度的方法描述如下:
假设数组a的长度为n,用数组b的元素b[i]记录以a[i](0≤i<n”)为结尾元素的最长递增子序列的长度为
;
其中b[i]满足最优子结构,可递归定义为:
[C代码]
下面是算法的C语言实现。
10常量和变量说明
a:
长度为n的整数数组,待求其最长递增子序列
b:
长度为n的数组,b[i]记录以a[i](0≤i<n”)为结尾元素的最长递增子序列的长度,其中0≤i<n
len:
最长递增子序列的长度
i,j:
循环变量
temp:
临时变量
11C程序
#jnclude<stdio,h>
mtmaxL(int*b,mtn){
mtI,temp=0
for(i=0;
i<n;
i++){
(b[i]>temp)
temp=b[i]
returntemp;
intmain12{
intn,a[100],b[100],i,j,len;
scanf("
%d"
&
n);
i<n;
i++){
%d"
a[i]);
______:
for(i=1;
i++)
{
for(j=0,len=0;
______;
j++){
if(
______&
&
len<b[j])
Ien=b[j]
}
Printf("
%d\n"
maxL(b,n))
Primtf("
\n"
)
10、
根据说明和C代码,填充C代码中的空______~______。
11、
根据说明和C代码,算法采用了______设计策略,时间复杂度为______(用O符号表示)
12、
已知数组a={3,10,5,15,6,8},据说明和C代码,给出数组b的元素值。
试题五
阅读下列说明和c++代码,将应填入横线处的字句写在答题纸的对应栏内。
某灯具厂商欲生产一个灯具遥控器,该遥控器具有7个可编程的插槽,每个插槽都有开关按钮,对应着一个不同的灯。
利用该遥控器能够统一控制房间中该厂商所有品牌灯具的开关,现采用Command(命令)模式实现该遥控器的软件部分。
Command模式的类图如下图所示。
Command模式类图
[C++代码]
classLight{
public:
Light(stringname){/*代码省略*/}
voidon13{/*代码省略*/}
//开灯
voidoff13{/*代码省略*/}
//关灯
}:
classCommand{
classLightonCommand:
publicCommand{//开灯命令
private:
Light*light;
LightonCommand(Light*light){this->light=light;
Voidexecute13{______;
};
classLightoffCommand:
publicCommand{//关灯命令
LightoffCommand(Light*light){this->light=light;
classRemoteControl{//遥控器
Command*onCommands[7];
Command*offCommands[7];
RemoteControl13{/*代码省略/}
voidsetCommand(intslotCommand*onCommand,Command*offCommand){
______=onCommand;
______=offCommand;
voidonButtonWasPushed(intslot){______:
voidoffButtonWasPushed(intslot){______:
}
);
intmain13{
RemoteControl*remoteControl=newRemoteControl13;
Light*livingRoomLight=newLight("
LivingRoom"
Light*kitchenLight=newLight("
kitchen"
LightonCommand*IivingRoomLighton=newLightonCommand(livingRoomLight);
LightoffCommand*livingRoomLightoff=newLightoffCommand(livingRoomLight);
LightonCommand*kitchenLighton=newLightonCommand(kitchenLight);
LightoffCommand*kitchenLightoff=newLightoffCommand(kitchenLight);
remoteControl->setCommand(0,livingRoomLighton,livingRoomLightoff);
remoteControl->setCommand(1,kitchenLighton,kitchenLightoff);
remoteControl->onButtonWasPushed20;
remoteControl->offButtonWasPushed20;
remoteControl->onButtonWasPushed22;
remoteControl->offButtonWasPushed22;
/*其余代码省略*/
return0;
试题六
阅读下列说明和Java代码,将正确答案填入横线处。
Command模式的类图
[java代码]
publicLight20{};
publicLight(stringname){/*代码省略*/}
publicvoidon20{/*代码省略*/}
//开灯
publicvoidoff20{/*代码省略*/}
______{
publicvoidexecute20;
classLightonCommandimplementsCommand{//开灯命令
Lightlight;
publicLightonCommand(Lightlight){this.light=light;
publicVoidexecute20{______;
classLightoffCommandimplementsCommand{//关灯命令
publicLightoffCommand(Lightlight){this,light=ight;
Command[]onCommands[7];
Command[]offCommands[7];
PublicRemoteControl20{/*代码省略*/}
PublicvoidsetCommand(intslotCommandonCommand,CommandoffCommand){
______=onCommand;
______=offCommand;
PublicvoidonButtonWasPushed(intslot){______;
PublicvoidoffButtonWasPushed(intslot){______;
classremoteLoader{
publicstaticvoidmain(string[]args){
RemoteControlremoteControl=newRemoteControl20;
LightlivingRoomLight=newLight("
LightkitchenLight=newLight("
LightonCommandlivingRoomLighton=newLightonCommand(livingRoomLight);
LightoffCommandlivingRoomLightoff=newLightoffCommand(livingRoomLight);
LightonCommandkitchenLighton=newLightonCommand(kitchenLight);
LightoffCommandkitchenLightoff=newLightoffCommand(kitchenLight);
remoteControl.setCommand(0,livingRoomLighton,livingRoomLightoff);
remoteControl.setCommand(1,kitchenLighton,kitchenLightoff);
remoteControl.onButtonWasPushed28;
remoteControl.offButtonWasPushed28;
remoteControl.onButtonWasPushed30;
remoteControl.offButtonWasPushed30;
中级软件设计师2014年11月下午试题答案
试题一
1、E1:
客户;
E2:
供应商
2、D1:
销售订单表;
D2:
库存表;
D3:
生产计划表;
D4:
配方表;
D5:
采购订单表
3、数据流名称:
支付细节;
起点:
财务管理;
终点:
E2
数据流名称:
销售订单:
5运送
生产计划:
D3;
3生产
库存量;
D2;
4采购
原材料数量:
4采购;
D2
未完成订单:
7存储。
4、
5、(a)超市名称、部门名称主键:
(超市名称、部门名称)外键:
超市名称、部门经理
(b)员工号、超市名称、部门名称
(c)商品号主键:
(商品号、业务员、配给时间)外键:
业务员、商品号
6、超市关系中的地址属于复合属性。
所谓复合属性就是指属性中含有多种信息,可以进一步拆分的属性,地址可以拆分成多个简单属性,符合这一特征。
(2)d是1:
n
e超市名称、地址、电话
7、C1:
Address
C2:
Riding
C3:
Ineligible
C4:
Eligi-ble
8、M1:
1,M2:
*,M3:
*,M4:
1,M5:
*,M6:
1
9、将Ml与M4由1,修改为1..*
10、b[0]=1
11、动态规划法O(n2)
12、B={1,2,2,3,3,4}
13、voldexecute(){}
14、light->on() 15、light->off()
16、onCommands[slot] 17、offCommands[slot]
18、onComnlands[slot]->execute() 19、offCommands[slot]->execute()
20、interfaceCommand21、light.on() 22、light.off()
23、onCommands[slot] 24、offCommands[slot]
25、onCommands[slot].execut() 26、offCommands[slot].execute()
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 中级 软件 设计师 下半年 下午 试题