1、
一、填空题(每空1分,共15分)
1. double a = 0.618;
2. 1
3. x>20&&x< = 30或者(x>20) && (x< = 30)
4. 2
5. 继承、封装 、多态
6. 5 6
7. 公有(public) 私有(private) 保护(protected)
8. 静态绑定 动态绑定
9. 多种功能
二、 单项选择题(每小题2分,共20分)
1. D 2. C 3. A 4. B 5. C 6. B 7. A 8. D 9. D 10. A
三、 阅读程序填空题(共15分)
2、1.
①i=0;
②s1[i]!=’\0’
③s2[j]!=’\0’
2.
④int **r,int **s
⑤&p,&q
3.
⑥ p
⑦ arr[0].score
⑧
int k=0;
四、阅读程序写输出结果(每题5分,共20分)
1. 运行结果为a+b=33
2. 运行结果为:8
3. 运行结果为:
1
1996.5.4
1998.4.9
4. 运行结里为:
destructing der
destructing base
五、编写程序(每小题10分,共30分)
下述答案仅供参考,若采用其它方法答案,只
3、要正确实现题目要求即可。
1.
#include
using namespace std;
int main()
{
int x,y;
cout<<”enter x:”;
cin >>x;
if(x<1)
y=x;
else if(x<10)
y=2*x-1;
else
y=3*x-11;
cout<<”x=”<
using namespace std;
int main()
{
int j=1;s=0;
while
4、j<=100)
{
s=s+j; j++;
}
cout<<”1+2+..+100=”<>Length;}
void SetWidth() { cin >>width;}
int Area() { return Length*width; }
private:
int Length;
int width;
}
第 3 页 共 3 页