文档介绍:中级软件设计师2014下半年下午试题
中级软件设计师2014年11月下午试题
试题一
阅读下列说明和图,回答下列问题。
[说明]
   某大型披萨加工和销售商为了有效管理生产和销售情况,欲开发一披萨信息系统,其主要功能扣  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,mt n) {
   mt I, temp=0
   for(i=0; i<n; i++) {
   (b[i]>temp)
   temp=b[i]
   return temp;
   int main12 {
   int n,a[100],b[100],i,j,len;
   scanf(" % d",&n);
   for(i=0;i<n;i++) {
   scanf("% d",&a[i]);
   ______:
   for(i=1;i<n;i++)   {
   for(j=0,len=0;______;j++){
   if(  ______&&len<b[j])
   Ien=b[j]
   ______;
   }
   Printf("len:% 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++代码]
   class Light{
   public:
   Light(string name){/*代码省略*/}
   void on13{/*代码省略*/}  // 开灯
   void off13{/*代码省略*/}  //关灯
   }:
   class Command{
   public:
   ______;
   }
   class LightonCommand:public Command{//开灯命令
   private:
   Light * light;
   public:
   LightonCommand(Light * light){this->light=light;}
   Void execute13{______;}
   };
   class LightoffCommand:public Command{//关灯命令
   private:
   Light * light;
   public:
   LightoffCommand(Light * light){this->light=light;}
   Void execute13{______;}
   };
   class RemoteControl{ //遥控器
   private:
   Command * onCommands[7];
   Command * offCommands[7];
   public:
   RemoteControl13 { /*代码省略/ }
   void setCommand(int slot Command * onCommand,Command * offCommand) {
   ______= onCommand;
   ______= offCommand;
   }
   void onButtonWasPushed(int slot) {______:)
   void off