本栏目下题库来源于互联网,轻速云承诺对于用户导入平台的题库是严格保密的,不会在此呈现!
轻速云给您提供更好的在线考试系统服务!
2013年9月全国计算机等级《二级C++》上机模考试卷(1)
1、【 单选题 】
算法的空间复杂度是指(  )。 [1分]
、 算法在执行过程中所需要的计算机存储空间
、 算法所处理的数据量
、 算法程序中的语句或指令条数
、 算法在执行过程中所需要的临时工作单元数
答案:
2、【 单选题 】
每个C++程序中都必须有且仅有一个(  )。 [1分]
、 类
、 预处理命令
、 主函数
、 语句
答案:
3、【 单选题 】
对长度为n的线性表排序,在最坏情况下,比较次数不是n(n-1)/2的排序方法是(  )。 [1分]
、 快速排序
、 冒泡排序
、 直接插入排序
、 堆排序
答案:
4、【 单选题 】
数据库系统的三级模式不包括(  )。 [1分]
、 概念模式
、 内模式
、 外模式
、 数据模式
答案:
5、【 单选题 】
SQL语言又称为(  )。 [1分]
、 结构化定义语言
、 结构化控制语言
、 结构化查询语苦
、 结构化操纵语言
答案:
6、【 单选题 】
数据处理的最小单位是(  )。 [1分]
、 数据
、 数据元素
、 数据项
、 数据结构
答案:
7、【 单选题 】
假定MyClass为一个类,那么下列的函数说明中,(  )为该类的析构函数。 [1分]
、 void~MyClass(  );
、 ~MyC|ass(intn);
、 MyClass(  );
、 ~MyClass(  );
答案:
8、【 单选题 】
有以下结构体说明和变量的定义,且指针P指向变量a,指针q指向变量b。则不能把结点b连接到结点a之后的语句是(  )。
structnode
{chardata;
structnode*next;
}a,b,*p=&a,*q=&b; [1分]
、 a.next=q;
、 P.next=&b;
、 p->next=&b;
、 (*p).next=q;
答案:
9、【 单选题 】
若有表达式“(w)?(--x):(++y)”,则其中与w等价的表达式是(  )。 [1分]
、 w==1
、 w==0
、 W!=1
、 W!=0
答案:
10、【 单选题 】
有如下函数模板声明:
template
TMax(Ta,Tb){return(a>b)?a:b;}
下列对函数模板Max(  )的调用中错误的是(  )。 [1分]
、 Max(3.5,4.5)
、 Max(3.5,4)
、 Max(35,4.5)
、 Max(3.5,45)
答案:
11、【 单选题 】
C++语言中关于构造函数的说法正确的是(  )。 [1分]
、 构造函数的函数名不必和类名相同
、 构造函数只能有一个
、 每个类必定有构造函数
、 构造函数必有返回值
答案:
12、【 单选题 】
下列描述中,错误的是(  )。 [1分]
、 公有继承时基类中的公有成员在派生类中仍是公有成员
、 公有继承时基类中的保护成员在派生类中仍是保护成员
、 保护继承时基类中的公有成员在派生类中仍是公有成员
、 保护继承时基类中的保护成员在派生类中仍是保护成员
答案:
13、【 单选题 】
结构化程序所要求的基本结构不包括(  )。 [1分]
、 顺序结构
、 GOTO跳转
、 选择(分支)结构
、 重复(循环)结构
答案:
14、【 单选题 】
在E—R图中,用来表示实体联系的图形是(  )。 [1分]
、 椭圆图
、 矩形
、 菱形
、 三角形
答案:
15、【 单选题 】
下列数据结构中,属于非线性结构的是(  )。 [1分]
、 循环队列
、 带链队列
、 二叉树
、 带链栈
答案:
16、【 单选题 】
对长度为n的线性表进行顺序查找,在最坏情况下所需要的比较次数为(  )。 [1分]
、 log2n
、 n/2
、 n
、 n+1
答案:
17、【 单选题 】
下面程序的运行结果为(  )。#include
voidswap(int&a,intb)
{
inttemp;
temp=a++;
a=b:
b=temp:
}
voidmain()
{
inta=2,b=3;
swap(a,b);
cout<<a<<","<<b<
} [1分]
、 2,3
、 3,2
、 2,2
、 3,3
答案:
18、【 单选题 】
若有以下程序:
#include
usingnamespacestd;
classBase
{public:
Base()
{x=0;}
intx;};
classDerivedl:virtualpublicBase
{public:
Derivedl()
{x=10;}};
classDerived2:virtua11publicBase
{public:
Derived2()
{x=20;}};
classDerived:publicDerivedl,protectedDerived2{};intmain()
{Derivedobj;
cout<<obj.x<
return0;}
该程序运行后的输出结果是(  )。 [1分]
、 20
、 30
、 10
、 0
答案:
19、【 单选题 】
下列选项中不合法的标识符是(  )。 [1分]
、 print
、 FOR
、 &a
、 -00
答案:
20、【 单选题 】
考虑函数原型voidtest(inta,intb=7,charz='*'),下面的函数调用中,属于不合法调用的是(  )。 [1分]
、 test(5);
、 test(5,8);
、 test(6,'#');
、 test(0,0,'*');
答案:
21、【 单选题 】
当需要将一个函数boolisnunlber(charc)声明为内联函数时,此内联函数的函数原型为(  )。 [1分]
、 enumboolisnumber(charc);
、 defineboolisnumber(charc);
、 inlineboolisnumber(charc);
、 extemboolisnumber(charc);
答案:
22、【 单选题 】
有如下程序:
#include
usingnamespacestd;
intmain(  ){
inta[6]={23,l5,64,33,40,58};
ints1,s2;
s1=s2=a[0];
for(int*p=a+1;p<a+6;p++){
if(sl>*p)s1=*P;
if(s2<*p)s2=*p;
}
cout<<s1+s2<
return0;
}
运行时的输出结果是(  )。 [1分]
、 23
、 58
、 64
、 79
答案:
23、【 单选题 】
以下程序中调用cin函数给变量a输入数值的方法是错误的,其错误的原因是(  )。
#include(iostream.h)
voidmain(  )
{int*P,*q,a,b;
p=&a;
cout<<"inputa:";
cin>>P;
} [1分]
、 *P表示的是指针变量P的地址
、 P表示的是变量a的地址,而不是变量a的值
、 *P表示的是指针变量p的值
、 *P只能用来说明P是一个指针变量
答案:
24、【 单选题 】
有以下程序:
classDate
{
public:
Date(inty,intm,intd);
{
year=Y:
month=m;
day=d;
}
Date(inty=2000)
{
year=y;
month=10;
day=1;
}
Date(Date&d)
{
year=d.year;
month=d.month;
day=d.day;
}
voidprint(  )
{
cout<<year<<"."<(month<<"."<<day<
}
private:
intyear,month,day;
};
Datefun(Dated)
{
Datetemp;
temp=d;
returntemp;
}
intmain(  )
{
Datedatel(2000,1,1),date2(0,0,0);
Datedate3(datel);
date2=fun(date3);
return0;
}
程序执行时,Date类的拷贝构造函数被调用的次数是(  )。 [1分]
、 2
、 3
、 4
、 5
答案:
25、【 单选题 】
下面程序的输出结果是(  )。
#include
Usingnamespacestd;
ClassBase{
public:
Base(intx=O){count<
}
};
ClassDerived:publicBase{
public:Derved(intx=0{count<
}
private;
Baseval;
};
intmina(){
Derivedd(1);
retrun0;
} [1分]
、 0
、 1
、 01
、 001
答案:
26、【 单选题 】
软件设计中划分模块的一个准则是(  )。 [1分]
、 低内聚低耦合
、 高内聚低耦合
、 低内聚高耦合
、 高内聚高耦合
答案:
27、【 单选题 】
下列程序的运行结果是(  )。
#include
intx=5;
intfun(inta)
{
intc:
c=X*a: </year<<"."<(month<<"."<<day<
returnC;
}
voidmain()
{
intx=3,a=4;
x=x+fun(a);
cout<<"x="<<x<
} [1分]
、 x=15
、 x=17
、 x=23
、 x=25
答案:
28、【 单选题 】
数据库DB、数据库系统DBS、数据库管理系统DBMS之间的关系是(  )。 [1分]
、 DB包含DBS和DBMS
、 DBMS包含DB和DBS
、 DBS包含DB和DBMS
、 没有任何关系
答案:
29、【 单选题 】
在软件开发中,需求分析阶段产生的主要文档是(  )。 [1分]
、 软件集成测试计划
、 软件详细设计说明书
、 用户手册
、 软件需求规格说明书
答案:
30、【 单选题 】
有如下程序:
#include
usingnamespacestd;
classXA{
inta;
public:
staticintb;
XA(intaa):a(aa){b++;}
~XA(  ){}
intget(  ){returna;}
};
intXA::b=0
intmain(  ){
XAd1(1),d2(3);
cout<<
return0;
}
运行时的输出结果是(  )。 [1分]
、 5
、 6
、 7
、 8
答案:
31、【 单选题 】
   是(  )。 [1分]
、 2*a*b/c/d
、 a*b/c/d*2
、 a/c/d*b*2
、 2*a*b/c*d
答案:
32、【 单选题 】
对于模板定义关键字class和typename说法不正确的是(  )。 [1分]
、 程序中的class并不能都替换为typename
、 class和typename都可互相替换
、 程序中的typename都能替换为class
、 程序中的部分class可以替换为typename
答案:
33、【 单选题 】
下面程序的运行结果为(  )。
#include
ClassA
{
public:A(  ){cout<<"1";}
~A(  ){cout<<"2";}
};
ClassB:public:A
{
public:
B(  ){cout<<"3";}
~B(  ){cout<<"4";}
};
Voidmain(  )
{
Bb;
} [1分]
、 1234
、 1324
、 1342
、 3142
答案:
34、【 单选题 】
有如下程序:
#include
usingnamespacestd;
classPublication{//出版物类
charname[30];
public:
Publication(char*name=”未知名称”){
~strcpy(this一>name,name);
}
constchar*getName(  )const{returnname;}
virtualconstchar*getType(  )const{return”未知类型”;}
};
classBook:publicPublication{//书类
public:
Book(char*name):Publication(name){}
virtualconstchar*getType(  )const{return"书";}
};
voidshowPublication(Publication&p){
cout<<<":"<<<
endl;
}
intmain(  ){
Bookbook(”精彩人生”);
showPublication(book);
return0;
}
运行时的输出结果是(  )。 [1分]
、 未知类型:未知名称
、 未知类型:精彩人生
、 书:未知名称
、 书:精彩人生
答案:
35、【 单选题 】
若有以下程序:
#include
usillgnamespacestd;
classA
{private:
inta;
public:
A(inti)
{a=i;}
voiddisp()
{cout<<a<<",";}};
classB
{private:
intb;
public:
B(intj)
{b=j;}
voiddisp()
{COUt<<b<<",";}};
classC:publicB,publicA
{private:
intC;
public:
C(intk):A(k-2),B(k+2)
(c=k;)
voiddisp()
{A::disp();
B::disp();
cout<<c<
intmain()
{Cobj(10);
obj.disp();
return0;}
程序执行后的输出结果是(  )。 [1分]
、 10,10,10
、 10,12,14
、 8,10,12
、 8,12,10
答案:
36、【 单选题 】
若AA为一个类,a为该类的非静态数据成员,在该类的一个成员函数定义中访问a时,其书写格式为(  )。 [1分]
、 a
、 A
、 a{}
、 AA::a{}
答案:
37、【 单选题 】
静态成员函数没有(  )。 [1分]
、 返回值
、 this指针
、 指针参数
、 返回类型
答案:
38、【 单选题 】
下列程序的运行结果是(  )。
#include
intx=5:
intfun(inta)
{
intC;
C=X*a:
returnC;
}
voidmain(  )
{
intx=3,a=4;
x=x+fun(a);
cout<<"x="<<x<
} [1分]
、 x=15
、 x=17
、 x=23
、 x=25
答案:
39、【 单选题 】
面向对象的没计方法与传统的面向过程的方法有本质不同,它的基本原理是(  )。 [1分]
、 模拟现实世界中不同事物之间的联系
、 强调模拟现实世界中的算法而不强调概念
、 使用现实世界的概念抽象地思考问题从而自然地解决问题
、 鼓励开发者在软件开发的绝大部分中都用实际领域的概念去思考
答案:
40、【 单选题 】
负责数据库中查询操作的数据库语言是(  )。 [1分]
、 数据定义语言
、 数据管理语言
、 数据操纵语言
、 数据控制语言
答案:
12 下一页 末页
共2页,共43个题库
共2页,共43个题库
轻速云给您提供更好的在线考试系统服务!
推荐
推荐题库
众多企事业单位的信赖之选
36万+企事业单位的共同选择
查看更多合作案例
众多企事业单位的信赖之选
开始使用轻速云组织培训考试
四步组织一场考试答题,一键搭建企业培训平台
免费使用 免费使用 预约演示
咨询热线
400-886-8169
周一到周日 8:00-22:00
©2025 轻速云 苏ICP备16049646号-1 轻速云科技提供专业的在线考试系统、在线培训系统
联系我们
客服热线客服热线:400-886-8169 | 周一至周日 8:00-22:00
©2025 轻速云 苏ICP备16049646号-1
轻速云科技提供专业的在线考试系统、在线培训系统
在线咨询 400-886-8169