[计算机类试卷]国家二级(C++)机试模拟试卷174及答案与解析.doc
《[计算机类试卷]国家二级(C++)机试模拟试卷174及答案与解析.doc》由会员分享,可在线阅读,更多相关《[计算机类试卷]国家二级(C++)机试模拟试卷174及答案与解析.doc(32页珍藏版)》请在麦多课文档分享上搜索。
1、国家二级( C+)机试模拟试卷 174及答案与解析 一、选择题 1 下列叙述中错误的是 ( )。 ( A)算法的时间复杂度与问题规模无关 ( B)算法的时间复杂度与计算机系统无关 ( C)算法的时间复杂度与空间复杂度没有必然的联系 ( D)算法的空间复杂度与算法运行输出结果的数据量无关 2 设表的长度为 20。则在最坏情况下,冒泡排序的比较次数为 ( )。 ( A) 190 ( B) 20 ( C) 19 ( D) 90 3 下列叙述中正确的是 ( )。 ( A)带链栈的栈底指针是随栈的操作而 动态变化的 ( B)若带链队列的队头指针与队尾指针相同,则队列为空 ( C)若带链队列的队头指针与队
2、尾指针相同,则队列中至少有一个元素 ( D)带链栈的栈底指针是固定的 4 设一棵树的度为 3,共有 27个结点,其中度为 3, 2, 0的结点数分别为 4, 1,10。该树中度为 1的结点数为 ( )。 ( A) 12 ( B) 13 ( C) 11 ( D)不可能有这样的树 5 下面描述中正确的是 ( )。 ( A)好的软件设计应是高内聚低耦合 ( B)内聚性和耦合性无关 ( C)内聚性是指多个模块间相互连接的紧 密程度 ( D)耦合性是指一个模块内部各部分彼此结合的紧密程度 6 某系统总体结构如下图所示 该系统结构图的最大扇出数、最大扇入数的总和是 ( )。 ( A) 5 ( B) 7 (
3、 C) 4 ( D) 8 7 下面属于应用软件的是 ( )。 ( A)人事管理系统 ( B) Oracle数据库管理系统 ( C) C+编译系统 ( D) ios操作系统 8 下面选项中不是关系数据库基本特征的是 ( )。 ( A)不同的列应有不同的数据类型 ( B)不同的列应有不同的列名 ( C)与行的次序无关 ( D)与 列的次序无关 9 工厂生产中所需的零件可以存放在多个仓库中,而每一仓库中可存放多种零件。则实体仓库和零件间的联系是 ( )。 ( A)多对多 ( B)一对多 ( C)多对一 ( D)一对一 10 学生和课程的关系模式定义为 S(S#, Sn, Sd, Dc, SA)(其属
4、性分别为学号、姓名、所在系、所在系的系主任、年龄 ); C(C#, Cn, P#)(其属性分别为课程号、课程名、先选课 ); SC(S#, C#, G)(其属性分别学号、课程号和成绩 )。 关系中包含对主属性传递依赖的 是 ( )。 ( A) S#Sd , SdDc ( B) S#Sd ( C) S#Sd , (S#, C#)G ( D) C#P# , (S#, C#)G 11 下列选项中,不属于 C+关键字的是 ( )。 ( A) for ( B) then ( C) inline ( D) while 12 下列选项中,错误的 C+表达式是 ( )。 ( A) a+1 ( B) b=65
5、( C) int(x) ( D) x+=33 13 有如下程序段 int k=10; do cout using namespace std; int main() int sum=0; for(int i=1; ib?(b?c 1: 0): 0; 等价的是 ( )。 ( A) if(ab)&(bc) temp=1; else temp=0; ( B) if(ab)|(bc) temp=1; else temp=0; ( C) if(ab) temp=1; else if(bc) temp=1; else 22 下列有关指针的操作中,正确的是 ( )。 ( A) int a=10; void*
6、ptr=&a; cout ( D)输出流的插入运算符 using namespace std; int fun(char x, char y) if(xy) return x; return y; int main() int a(9), b(8), c(7); cout using namespace std; void hey(_, int&b) int c; c=a; a=b; b=c; int main() int m=14, n=20; hey(m, n); cout using namespace std; void f(int i)cout using namespace std
7、; class Goods货物类 double unit_price;单价 int quantity;数量 public: Goods(double u=0 0, int q=0): unit_price(u), quantity(q) double getPrice()constreturn unit_price; 返回单价 int getQuantity()constreturn quantity; 返回数量 增加数量 Goods operator+(int q)constreturn Goods(unit_price, quantity+q); ; 增加数量 Goods operator
8、+(_)return g+q; 输出货 物信息 ostream&operator using namespace std; class Xabe int*a; int n; public: Xabc(int aa, int nn): n(nn) a=Hew intn; for(int i=0; i class vehicle private: int MaxSpeed; int Weight public: *found* vehicle(int maxspeed, int weight): _ vehicle(); int getMaxSpeed()return MaxSpeed; int
9、getWeight()return Weight; ; *found* class bicycle: _public vehicle private: int Height; public: bicycle(int maxspeed, int weight, int height): vehicle(maxspeed, weight),Height(height) int getHeight()return Height; ; ; *found* class motorcar: _public vehicle private: int SeatNum; public: motorcar(int
10、 maxspeed, int weight, int seatnum): vehicle(maxspeed, weight),SeatNum(seatnum) int getSeatNum()return SeatNum; ; ; *found* class motorcycle: _ public: motorcycle(int maxspeed, int weight, int height): vehicle(maxspeed, weight),bicycle(maxspeed, weight, height), motorcar(maxspeed, weight, 1) ; void
11、main() motorcycle a(80, 150, 100); cout #include using namespace std; class MiniString public: friend ostream&operator(istream&input, MiniString&s)重载流提取运算符 char temp100;用于输入的临时数组 temp0= 0;初始为空字符串 inputsetw(100)temp; int inLen=strlen(temp);输入字符串长度 if(inLen!=0) s 1ength=inLen;赋长度 if(s sptr!=0)deletes
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 试卷 国家 二级 模拟 174 答案 解析 DOC
