计算机类
公务员类
工程类
语言类
金融会计类
计算机类
医学类
研究生类
专业技术资格
职业技能资格
学历类
党建思政类
计算机软件水平考试
全国计算机应用水平考试(NIT)
计算机软件水平考试
计算机等级考试(NCRE)
全国高校计算机等级考试CCT
行业认证
信息素养
程序员(初级)
信息系统项目管理师(高级)
系统分析师(高级)
系统架构设计师(高级)
网络规划设计师(高级)
系统规划与管理师(高级)
软件评测师(中级)
软件设计师(中级)
网络工程师(中级)
多媒体应用设计师(中级)
嵌入式系统设计师(中级)
电子商务设计师(中级)
系统集成项目管理工程师(中级)
信息系统监理师(中级)
信息安全工程师(中级)
数据库系统工程师(中级)
信息系统管理工程师(中级)
软件过程能力评估师(中级)
计算机辅助设计师(中级)
计算机硬件工程师(中级)
信息技术支持工程师(中级)
程序员(初级)
网络管理员(初级)
信息处理技术员(初级)
电子商务技术员(初级)
信息系统运行管理员(初级)
网页制作员(初级)
多媒体应用制作技术员(初级)
PMP项目管理员资格认证
程序员应用技术
程序员基础知识
程序员应用技术
填空题阅读以下函数说明和C语言函数,将应填入 (n) 处的字句写在对应栏内。 [说明] 某银行共发出M张储蓄卡,每张储蓄卡拥有唯一的卡号,每天每张储蓄卡至多支持储蓄卡持有者的N笔“存款”或“取款”业务。程序中用数组card[M][N+3]中的每一行存放一张储蓄卡的有关信息,其中: card[i][0]存放第i张卡的卡号; card[i][1]存放第i张卡的余额; card[i][2]存放第i张卡的当日业务实际发生笔数; card[i][3]~card[i][N+2]存放第i张卡的当日存取款金额,正值代表存款,负值代表取款。 当持卡者输入正确的卡号、存款或取款金额后,程序进行相应的处理;若输入不正确的数据,程序会提示持卡者重新输入;若输入的卡号为负数时,银行终止该卡的当日业务。 [C程序] #include<stdio.H> #define M 6 #define N 5 long card[M][N+3]=9801,2000,0,,9812,2000,2,,9753,3000,1,, 8750,500,0,,9604,2800,3,),(8901,5000,5,; int locate(long card[][N+3],int m,long no) int i; for(i=0;i<m;i++) if( (1) ==no) return i; (2) ; main() long cardNo,money; int k; while(1) printf("请输入卡号:/n"); scanf("%1d", if(cardNo<0) break; k=locate(card,M,cardNo); if(k==-1) printf("不存在%id号的储蓄卡/n",cardNo); continue; printf("请输入金额(正值代表存款,负值代表取款):/n"); scanf("%id", if(card[k][1]+money<0) printf("存款余额不足,不能完成本次的取款业务/n"); continue; if(card[k][2]==N) printf("已完成本卡的当日业务/n"); continue; /*处理一笔业务的数据*/ card[k] (3) =money; (4) ; (5) ;
进入题库练习
填空题阅读以下说明和C++程序,将应填入{{U}} (n) {{/U}}处的字句写在对应栏内 [说明] 以下程序的功能是计算三角形、矩形和正方形的面积并输出。 程序由4个类组成:类Triangle,Rectangle和Square分别表示三角形、矩形和正方形;抽象类Figure提供了一个纯虚拟函数getArea(),作为计算上述三种图形面积的通用接口。 [C++程序] #include<iostream.h> #include<math.h> class Figure{ public: virtual double getArea()=0; //纯虚拟函数 }; class Rectangle:{{U}} (1) {{/U}}{ protected: double height; double width; public: Rectangle(){}; Rectangle(double height,double width){ This->height=height; This->width=width; } double getarea(){ return{{U}} (2) {{/U}}; } }; class Square:{{U}} (3) {{/U}} public: square(double width){ {{U}} (4) {{/U}}; } }; class triangle:{{U}} (5) {{/U}}{ double la; double lb; double lc; public: triangle(double la,double lb,double lc){ this->la=la;thiS->ib;this->lc; } double getArea(){ double s=(la+lb+lc)/2.0; return sqrt(s*(s-la)**(s-lb)*(s-lc)); } }; viod main(){ figure*figures[3]={ new triangle(2,3,3),new Rectangle(5,8),new Square(5)}; for(int i=0; i<3;i++){ cout<<"figures["<<i<<"]area="<<(figures)->getarea()<<endl; } } };
进入题库练习
填空题[说明] 下面程序是一个小型公司工资管理的程序。该公司主要有4类人员:经理、兼职技术人员、销售员和销售经理。基类为employee,由它派生出technician类,manager类,salesman类,最后由manager类和salesman类派生出salesmanager类。月工资计算办法是:经理拿固定月薪8000;兼职技术人员按每小时100元领取月薪; 销售按当月销售额的4%提成; 销售经理既拿固定月工资也领取销售提成,固定月工资5000元,销售提成为所管辖部门当月销售总额的0.5%。 [C++程序] #include<iostream.h> #include<string.h> class employee protected: int no; char name [10] ; float salary; public : employee () cout<< "职工编号: " ; cin>>no ; cout<<"职工姓名:"; cin>>name ; salary= 0 ; void pay () void display () ; class technician:public employee private : float hourlyrate; int workhours; public : technician() hourlyrate=100; void pay () cout<<name本月工作时数: " ; cin>>workhours ; salary=hourlyrate*workhours; void display () cout<<"兼职技术人员"<<name<<"(编号为"<<no/ <<")"<<"本月工资:"<<salary<<endl; ; class salesman: (1) protected: float commrate; float sales; public: salesman() commrate=0.04; void pay() cout<<name<<"本月销售额:"; cin>>sales; salary= (2) ; void display() cout<<"销售额"name<<"(编号"<<no<</ <<")"<<"本月工资:"<<salary<<endl; ; class manager: (3) protected: float monthlypay; public: manager()monthlypay=8000; void pay()salary=monthlypay; void display() cout<<"经理"<<name<<"(编号为"<<no/ <<")"<<"本月工资:"<<salary<<endl; ; class salesmanager: (4) public: salesmanager() monthlypay=5000; commrate=0.005; void pay() cout<<name<<"所管部门月销售量:"; cin>>sales: salary= (5) ; void display() cout<<"销售经理"<<name<<"(编号为"<<no/ <<")"<<"本月工资:"<<salary<<endl; ;
进入题库练习
填空题【说明】 以下程序的功能是计算正方体、球体和圆柱体的表面积和体积并输出。 程序由4个类组成:类cube、sphere和cylinder分别表示正方体、球体和圆柱体;抽象类 container为抽象类,提供了两个纯虚拟函数surface_area()和volum(),作为通用接口。 【C++程序】 #include<iostream.h>   #define pi 3.1416 class container{   protected:   double radius;   public: container(double radius) container::radius=radius; virtual double surface_area()=0; virtual double velum()=0; ; class cube: (1) //定义正方体类 public: cube(double radius):container(radius); double surface_area () return 6 * radius * radius; double volum() return radius * radius * radius; ; class sphere: (2) //定义球体类 public: sphere(double radius): container(radius); double surface_area() return (3) ; double volum() return pi * radius * radius * radius * 4/3; ; class cylinder: (4) //定义圆柱体类 double height; public: cylinder(double radius,double height):container(radius) container::height=height; double surface_are a () return 2 * pi * radius * (height+radius); double volum () return (5) ; ; void main() container * p; cube obj1 (5); sphere obj2(5); cylinder obj3(5,5); p= cout<<“正方体表面积”(<<p->surface_area()<<end1; cont<<“正方体体积”<<p->volume()<<end1; p= cout<<“球体表面积”<<p->surface_area()<<end1; cout<<“球体体积”<<p->volume()<<end1; p= cout<<“球体表面积”<<p->surface_area()<<end1; cout<<“球体体积”<<p->volume()<<end1;
进入题库练习
填空题【说明】 以下程序为求行列式X(5,5)的值S。 【Visual Basic代码】 Private Function col ( byval x ( 5,5 ) as integer ) as long dim fesult as long dim temp as long dim I as integer dim j as integer dim k as imeger result = 0 for I = to 5 {{U}}(1) {{/U}} for j = 1 to 5 if I+j>6 then k= ( 1+j ) mod 5 else k=1 endif temp=temp*x ( k,j ) {{U}} (2) {{/U}} result={{U}} (3) {{/U}} {{U}}(4) {{/U}} {{U}}(5) {{/U}} End function
进入题库练习
填空题[函数8.1说明] 现考虑编写一个扑克游戏:只用一副无大小王的扑克,扑克的花色(suit)分为Spade、Heart、Diamond和Club,每门花色的牌共13张,面值(rank)分别为2、3、4、5、6、7、8、9、10、Jack、Queen、King和Ace,每张扑克牌应包含如下信息:惟一的ID号(1~52)、花色、面值、背面图案的编号等。每张扑克牌的操作有:判断两张扑克牌是相同花色吗?相同面值吗,判断一张扑克牌是给定的花色吗?是给定的面值吗?请补充扑克牌类Card类的声明和实现代码,要求选取适当形式的数据成员描述每张扑克牌的信息,同时以成员函数的形式实现指定的操作。 [C++程序] const enum SUIT {SPADE=0,HEART,DIAMOND,CLUB}; const enum RANK{TWO=0 THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE,TEN,JACK,QUEEN,KING,ACE}; class Card。 { public: {{U}} (1) {{/U}}(int id):mID (id),mSuit((id 1)/13),mRank((id-1)%13) {} bool IsSameSuit (const Card int b; public: vector (int x=0,int y=0):a(x),b(y){} double operator*({{U}} (4) {{/U}}) { double c; {{U}} (5) {{/U}}; return c; } void input (int x, int y) {a=x; b=y; } void output () {cout<<'('<<a<<',' <<b<<") "<<end1; } }; void main() { vector x(10,20),y; //定义x, y, z三个矢量类对象,并将x置初值(10,20) doubled;//定义实数d以存放点乘结果 y. input (2,3); //给y赋值为(2,5) d=x*y;//两矢量点乘 x. output (); //输出矢量x y. output (); //输出矢量y cout<<d<<end1; //输出点乘结果 }
进入题库练习
填空题【说明】 下面程序的功能是找出所有三位数中,个、十、百位数字的立方和等于该数本身的三位数并显示。在程序的每条横线处填写一个适当的词或语句,使程序的功能完整。 public{{U}} (1) {{/U}}class cube_Root { public static void{{U}} (2) {{/U}}main(String args[]) { System. out. println ("个、十、百位数字的立方和等于该数本身的三位数有:"); for(int n=100;n<1000;n++) { int a,b,c; {{U}} (3) {{/U}} b=n/10%10; {{U}} (4) {{/U}} if({{U}} (5) {{/U}}) System.out.println(n); } } }
进入题库练习
填空题[函数说明3.1]假设两个队列共享一个循环向量空间(参见右图),其类型Queue2定义如下:typedefstructDateTypedata[MaxSize];intfront[2],rear[2];Queue2;对于i=0或1,front[i]和rear[i]分别为第i个队列的头指针和尾指针。函数EnQueue(Queue2*Q,inti,DateTypex)的功能是实现第i个队列的入队操作。[函数3.1]intEnQueue(Queue2*Q,inti,DateTypex)//若第i个队列不满,则元素x入队列,并返回1;否则返回0。if(i<0||i>1)return0:if(Q->rear[i]==Q->front[(1)])return0:Q->data[(2)]=x;Q->rear[i]=[(3)];return1:[函数说明3.2]函数BTreeEqual(BinTreeNode*T1,BinTreeNode*T2)的功能是用递归法判断两棵二叉树是否相等,若相等则返回1,否则返回0。函数中参数T1和T2分别为指向这两棵二叉树根结点的指针。当两棵树的结构完全相同并且对应结点的值也相同时才被认为相等。已知二叉树中的结点类型BinTreeNode定义为:structBinTreeNodechardata;BinTreeNode*left,*right;;其中data为结点值域,left和right分别为指向左、右子女结点的指针域。[函数3.2]intBTreeEqual(BinTreeNode*T1,BinTreeNode*T2)if(T1==NULL&&T2==NULL)return1;//若两棵树均为空则相等elseif((4))return0;//若一棵为空一棵不为空则不等elseif((5))return1;//若根结点值相等并且左、右子树//也相等则两棵树相等,否则不等elsereturn0:
进入题库练习
填空题阅读以下函数说明和C语言函数,将应填入{{U}} (n) {{/U}}处的字句写在对应栏内。 [说明] 已知一棵二叉树用二叉链表存储,t指向根结点,p指向树中任一结点。下列算法为输出从t到P之间路径上的结点。 [C程序] #define Maxsize 1000 typedef struct node{ TelemType data; struct node*1child,*rchild; }BiNode,*BiTree; void Path(BiTree t,BiNode*P) { BiTree*stack[Maxsize],*stackl[Maxsize],*q; int tag[Maxsize],top=0,topl; q=t; /*通过先序遍历发现P*/ do(while(q!=NULL stack[top]=q; tag[top]=0; {{U}} (2) {{/U}}; } if(top>0) { if(stack[top]==P) break; /*找到P,栈底到栈顶为t到P*/ if(tag[top]==1)top--; else{q=stack[top]; q=q->rchild; tag[top]=1; } } } {{U}}(3) {{/U}}; top--; topl=0; while(top>0){ q=stack[top]; /*反向打印准备*/ topl++; {{U}} (4) {{/U}}; top--; } while({{U}} (5) {{/U}}){ /*打印栈的内容*/ q=stackl[topl]; printf(q->data); topl--; } }
进入题库练习
填空题【说明】 以下代码实现了当用户退出界面时,判断TextEdit中的文字是否发生改变,弹出对话框判断,让用户选择是否保存文件或取消退出界面操作。阅读下面的代码,将其补充完整。 【代码7-1】 Begin VB.Form Forml //...窗体描述(略) Begin VB.TextBox TextEdit Height = 1830 Left = 180 Tablndex = 0 Text = "TextEdit" Top = 360 Width = 3885 End //...窗体描述(略) End 【代码7-2】 Dim txtchange As Boolean Dim myval As String Private Sub Form Load () TextEdit.Text: "CIU, 中国软考联盟!" txtchange = False End Sub 【代码7-3】 Private Sub TextEdit_Change () Static notchange As Boolean (1) notchange = Tree End Sub Private Sub Form_Unload ( Cancel As Integer ) Dim myval As String If (2) Then myval = MsgBox ( "保存文件的更改吗?", vbYesNoCancel, "提示信息" ) If (3) Then MsgBox "保存成功" End End If If (4) Then End If (5) Then Cancel = 1 End If End Sub
进入题库练习
填空题[说明1]下面[C程序代码1]的设计意图是:计算1~100各数的平方。运行该段代码后,没有得到应有的运算结果。[C程序代码1]
进入题库练习
填空题阅读以下函数说明和C语言函数,将应填入 (n) 处的字句写在对应栏内。 [说明] 该程序从正文文件test.txt中读入一批整数,并将它们按照递增的顺序存放在一个链表中。其中,函数struct Link*insertChain(struct Link*head,structLink*k)用来寻找结点k在链表head中的插入位置,并插入该结点。 [C程序] #include <stdio.h> #include <stdlib.h> struct Link int number; struct Link *next; struct Link *insertChain(struct Link *head,struct Link *k); VOid main() struct Link *ptr, *head; FILE *fd; int hum; if((fd=fopen("test.txt","r"))==NULL) print("Cannot open this file!/n"); return; head=NULL; while(fscanf(fd,"%d",hum)==1) ptr= (1) ; if(!ptr) return; ptr->number=hum; ptr->next=NULL; head=insertChain(head,ptr); (2) ; return; struct Link *insertChain(struct Link *head,struct Link *k) struct Link *ptr,*u; ptr=head; while(ptr && k && k->number>ptr->number) u=ptr; (3) if(ptr == head) head=k; else (4) ; (5) ; return head;
进入题库练习
填空题[说明]某绘图系统存在Point、Line和Square3种图元,它们具有Shape接口,图元的类图关系如图8-5所示。现要将Circle图元加入此绘图系统以实现功能扩充。已知某第三方库已经提供了XCircle类,且完全满足系统新增的Circle图元所需的功能,但XCircle不是由Shape派生而来的,它提供的接口不被系统直接使用。[C++代码1]既使用了Xcircle,又遵循了Shape规定的接口,既避免了从头开发一个新的Circle类,又可以不修改绘图系统中已经定义的接口。[C++代码2]根据用户指定的参数生成特定的图元实例,并对其进行显示操作。该绘图系统定义的接口与XCircle提供的显示接口及其功能如表8-2所示。[C++程序代码1]classCircle:public(1)Private:(2)m_circle;public:voiddisplay()m_circle.(3);[C++程序代码2]classFactorypublic:(4)getShapeInstance(inttype)//生成特定类实例switch(type)case0:returnnewPoint;case1:returnnewRectangle;case2:returnnewLine;case3:returnnewCircle;default:returnNULL;;voidmainintargc,char*argv[])if(argc!=2)cout<<"errorparameters!"<<end1;return;inttype=atoi(argv[1]):Factoryfactory;Shape*s;s=factory.(5);if(s==NULL)cout<<"Errorgettheinstance!"<<end1;return;s->display();(6);return;
进入题库练习
填空题阅读以下函数说明和C语言函数,回答问题。 [说明] 函数Node *difference(A,B)用于求两个集合之差C=A-B,即当且仅当e是A中的一个元素,但不是B中的元素时,e是C中的元素。集合用有序链表实现,用一个空链表表示一个空集合,表示非空集合的链表根据元素之间按递增排列。执行C=A-B之后,表示集合A和B的链表不变,若结果集合C非空,则表示其链表根据元素之值按递增排列。函数append()用于在链表中添加节点。 [C函数] typedef struct node int element; struct node *link; Node; Node *A,*B,*C; Node *append(last,e) Node *last; int e; last->link=(Node *)malloc(sizeof(Node)); last->link->element=e; return(last->link); Node *difference(A,B) Node *A,*B; Node *c,*last; C=last=(Node *)malloc(sizeof(Node)); while( (1) ) if(A->element<B->element) last=append(last,A->element); A=A->link: else if( (2) ) A:A->link; B:B->link; elSe (3) ; while( (4) ) last=append(last,A->element); A=A->link: (5) ; last=c; c=c->link; free(last); return(c);
进入题库练习
填空题[说明]如图8-7所示的流程图用于从数组K中找出一切满足:K(I)+K(J)=M的元素对(K(I),K(J))(1≤I≤J≤N)。假定数组K中的N个不同的整数已按由小到大的顺序进行排列,M是给定的常数。[流程图]在如图8-7所示的流程图中,比较“K(I)+K(J)=M?”最少执行次数约为______。
进入题库练习
填空题【说明2.1】 以下C语言函数用二分插入法实现对整型数组a中n个数的排序功能。 【函数2.1】 void fun1 (int a[]) int i,j,k,r,x,m; for(i=2;i<=n;i++) (1) ; k=1;r=i-1; while(k<=r) m=(k+r)/2; if(x<a[m])r=m-1; else (2) ; for(j=i-1;j>=k;j--) a[j+l]=a[j]; (3) ; 【说明2.2】 以下程序可以把从键盘上输入的十进制数(long型)以二~十六进制形式输出。 【程序2.2】 #include<stdio.h> main() charb[16]='0','l','2','3 ,4,'5','6','7','8','9','A','B','C','D','E','F'; int c[64],d,i=0,base; long n; printf("enter a number:/n"); scanf("%1d", printf("enter new basc:/n"); scanf("%d", do c[i]= (4) ; i++; n=n/base; while(n!=0); printf("transmite new base:/n"); for(--i;i>=0;--i) d=c[i]; printf("%c", (5) );
进入题库练习
填空题 阅读以下函数说明和C语言函数,将应填入{{U}} (n) {{/U}}的字句写在答题纸的对应栏内。 [说明1] 函数int fun1(int m, int n)的功能是:计算并返回正整数m和n的最大公约数。 [函数1] int fun1(int m, int n) { while ({{U}} (1) {{/U}}) { if (m>n) m=m-n; else n=n-m; } {{U}}(2) {{/U}}; } [说明2] 函数long fun2(char*str)的功能是:自左至右顺序取出非空字符串str中的数字字符形成一个十进制整数(最多8位)。 例如,若字符串str的值为“f3g8d5.ji2e3p12fkp”,则函数返回值为3852312。 [函数2] long fun2(char *str) { int i=0; long k=0; char *p=str; while (*p!='\0' ++i; } {{U}} (5) {{/U}}; } return k; }
进入题库练习
填空题[说明] 函数Node*difference(A,B)用于求两个集合之差C=A-B,即当且仅当e是A中的一个元素,但不是B中的元素时,e是C中的元素。集合用有序链表实现,用一个空链表表示一个空集合,表示非空集合的链表根据元素之值按递增排列。执行C=A-B之后,表示集合A和B的链表不变,若结果集合C非空,则表示其链表根据元素之值按递增排列。函数append()用于在链表中添加结点。 [函数] typedef struct node int element; struct node *link; Node; Node *A, *B, *C; Node *append(last,e) Node *last; int e; last->link= (Node *)malloc (sizeof (Node)); last->link->element=e; return(last->link); Node *difference (A,B) Node *A, *B; Node *c, *last; C=last= (Node *)malloc(sizeof (Node)); while( (1) ) if(A->element <B->element) last=append (last,A->element); A=A->link; else if( (2) ) A=A->link; B=B->link; else (3) ; while( (4) ) last=append(last,A->element); A=A->link; (5) ; last=C; C=C->link; free(last); return (C);
进入题库练习
填空题【说明】 下面一段程序从给定的数组b中找出值最小的元素,并输出该元素的数组下标、内存地址minaddr以及元素值本身。函数findmin负责在给定的数组中查找最小值,并返回最小值所在的内存地址,函数有三个参数:array是所要处理的数组;size是数组的大小;index负责从函数返回具有最大值的元素在数组中的数组下标。请填充空白,使其成为一个合乎要求的完整程序。 【程序】 //程序开始 #include<iostream.h> int *findmin(int *array, int size, int void main() { /****** 变量定义部分 ***********/ int b[10] = {34, 34, 23, 89, 1, 2, 13, 42, 5, 54}; {{U}} (1) {{/U}}; int idx; /******* 寻找最小值 ************/ minaddr = findmin(b, sizeof(b)/sizeof(int), idx); /******* 输出最小值的有关信息 ************/ cout << "Min value index: "<<idx<<end1 <<"Min value address: "<<minaddr<<end1 <<"Min value: "<<{{U}} (2) {{/U}}<<end1; } /******* 函数findmin的定义部分 ************ int *findmin(int *array, int size, int //max 是当前具有最小值的数组元素下标值 for(int i = 1;{{U}} (3) {{/U}}; i++) { if(array[i]<{{U}} (4) {{/U}}) min = i; } {{U}} (5) {{/U}}; return array + min;//返回最小值所在内存地址 }
进入题库练习
填空题[函数说明3.1] 假设以带头结点的单循环链表作非递减有序线性表的存储结构。函数deleteklist(LinkList head)的功能是删除表中所有数值相同的多余元素,并释放结点空间。 [函数3.1] Void deleteklist (LinkList head) LinkNode *p,*q; p=head->next; while (p!=head) q=p->next; while( (1) ) (2) ; free(q); q=p->next; p=p->next; [函数说明3.2] 已知一棵完全二叉树存放于一个一维数组T[n]中,T[n]中存放的是各结点的值。下面的程序的功能是:从T[0]开始顺序读出各结点的值,建立该二叉树的二叉链表表示。 [函数3.2] #include<istream.h> typedef struct node int data; stuct node leftChild,rightchild; BintreeNode; typedef BintreeNode *BinaryTree; void ConstrucTree(int T[] , int n, int i, BintreeNode *&ptr) if(i>=n) (3) ; /*置根指针为空*/ else ptr=(BTNode*) malloc(sizeof(BTNode)) ptr->data=T[i]; ConstrucTree (T,n, 2*i+1, (4) ); ConstrucTree (T,n, (5) ,ptr->rightchild); main(void) /*根据顺序存储结构建立二叉链表*/ Binarytree bitree; int n; printf("please enter the number of node: /n%s"; n); int *A=(int*)malloc (n*sizeof (int)) ; for (int i=0; i<n; i++) scanf("%d" ,A+i); /*从键盘输入结点值*/ for (int i=0; i<n; i++) printf("%d",A[i]); ConstructTree (A,n, 0,bitree);
进入题库练习