2010计算机等级考试二级(C++)笔试149(一)

时间:2011-01-17 21:35:01

微信搜索关注"91考试网"公众号,领30元,获取事业编教师公务员等考试资料40G
1、汇编程序的功能是将汇编语言所编写的源程序翻译成由___1___组成的目标程序。

参考答案: 机器语言

机器语言

----------------------------------------

2、在面向对象方法中,类之间共享属性和操作的机制称为___2___。

参考答案: 分类性

分类性

----------------------------------------

3、若按功能划分,软件测试的方法通常分为白盒测试方法和___3___测试方法。

参考答案: 黑盒(或黑箱)

黑盒(或黑箱)

----------------------------------------

4、数据的逻辑结构有线性结构___4___两大类。

参考答案: 非线性结构

非线性结构

----------------------------------------

5、___5___是一种信息隐蔽技术,目的在于将对象的使用者和对象的设计者分开。

参考答案: 封装

封装

----------------------------------------

6、含有纯虚函数的类称为___6___。

参考答案: 抽象类

抽象类

----------------------------------------

7、 下面程序的输出结果是___7___。 #include<iostream.h> int add(int a, int b); void main() { extern int x, y; cout<<add(x, y)<<end1; } int x(20),y(5); int add(int a, int b) { int s=a+ b; return s; }

参考答案: 25

25

----------------------------------------

8、 在下面函数的横线处填上适当的内容,使该函数能够利用递归方法求解字符串str的长度 (不得使用系统提供的字符串处理函数)。 int GJetLen(char*str) { if(___8___) return 0; else return 1+GetLen (str+1); }

参考答案: *str==NULL

*str==NULL

----------------------------------------

9、 将以下程序写成三日运算表达式是___9___。 if(a>b) max=a; else max=b;

参考答案: max=(a>b)?a: b;

max=(a>b)?a: b;

----------------------------------------

10、 下面程序的运行结果是___10___。 #include<iostream> using namespace std; class count { static int n; public: count() { n++; } static int test() { for(int i=0;i<4;i++) n++; return n; } }; int count::n = 0; int main() { cout<<count :: test()<< ; count c1, c2; cout<<count :: test()<<end1; return 0; }

参考答案: 4 10

4 10

----------------------------------------

11、 下面程序的输出为___11___。 #include <iostream.h> void main() { int a[10],i, k=0; for(i=0,i<10;i++) a[i]=i; for(i=1;i<4;i++) k+=a[i]+i; cout<<k<<end1; }

参考答案: 12

12

----------------------------------------

12、 以下程序的执行结果是___12___。 #include <iostream.h> class B { public: B(){} B(int i.int j); void printb(); private: int a,b; }; class A { public: A() { } A(int i,int j); void printa(); private: B c; }; A:: A(int i,int j):c(i, j) { } void A:: pfinta() { c. printb(); } B::B(int i,int j) { a=i; b=j; } void B::printb() { cout<<a=<<a<<,b=<<b<<end1; } void main() { A m(7,9); m. printa(); }

参考答案: a=7,b=9

a=7,b=9

----------------------------------------

13、 下列程序的输出结果为___13___。 #include <iostream. h> void main() { char a[]=abcdabcabfgacd; int i1=0,i2=0,i=0; while (a[i]) { if (a[i]==''''a'''') i1++; if (a[i]==''''q'''') i2++; i++; } cout<<i1<<''''''''<<i2<<end1; }

参考答案: 43

43

----------------------------------------

14、 Staff类含有int 型数据成员ID,两个Staff 对象相等是指它们的ID相同。下面的函数重载了运算符==,它用来判断两个Staff 对象是否相等,相等时返回true,否则返回false。 请将横线处缺失部分补充完整。 bool Staff::Staff==(const Staff &s) { return(___14___); }

参考答案: ID==s. D 或 s. ID==ID 或 this->ID==s. ID 或 s. ID== this->ID

ID==s. D 或 s. ID==ID 或 this->ID==s. ID 或 s. ID== this->ID

----------------------------------------

15、 若有以下程序: #include <iostream> using namespace std; class Base { public: Base() { x=0; } int x; }; class Derived1: virtual public Base { public: Derived1() { x=10; } }; class Derived2: virtual public Base { public: Derived2() { x=20; } }; class Derived: public Derived1, protected Derived2 { }; int main() { Derived obj; cout<<obj.x<<end1; return 0; } 该程序运行后的输出结果是___15___。

参考答案: 20

20

----------------------------------------

1、对于算法的每一步,指令必须是可执行的。算法的( )要求算法在有限步骤之后能够达到预期的目的。

A.可行性

B.有穷性

C.正确性

D.确定性

参考答案: A

----------------------------------------

2、下列叙述中错误的是( )。

A.一种数据的逻辑结构可以有多种存储结构

B.数据的存储结构与数据处理的效率无关

C.数据的存储结构与数据处理的效率密切相关

D.数据的存储结构在计算机中所占的空间不一定是连续

首页 上页 1 2 3 下页 尾页 1/3/3
微信搜索关注"91考试网"公众号,领30元,获取公务员事业编教师考试资料40G
【省市县地区导航】【考试题库导航】

电脑版  |  手机版  |  返回顶部