暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
搜狗2012.9.23校园招聘会笔试题.docx
242
14页
0次
2021-02-22
40墨值下载
1
、以下程序的输出是(
12
[cpp] view plaincopyprint?
1. class Base
2. {
3. public:
4.
Base(int j) : i(j) { }
5.
virtual ~Base() { }
6.
void func1()
7.
{
8.
i *= 10;
9.
func2();
10.
}
11.
int getValue()
12.
{
13.
return i;
14.
}
15. protected:
16.
virtual void func2()
17.
{
18.
i++;
19.
}
20. protected:
21.
int i;
22. };
23.
24. class Child : public Base
25. {
26. public:
27.
Child(int j) : Base(j) { }
28.
void func1()
29.
{
30.
i *= 100;
31.
func2();
32.
}
33. protected:
34.
void func2()
35.
{
36.
i += 2;
37.
}
38. };
39.
40. int main(void)
41. {
42.
Base *pb = new Child(1);
43.
pb->func1();
44.
cout<<pb->getValue()<<endl;
45.
delete pb;
46.
47.
return 0;
48. }
2
、请问程序的输出结果是(
30
#dene DOUBLE(x) x+x // x*2
int i = DOUBLE(5)*5;
cout<<i<<endl;
3
、写出一下程序的输出(死循环
[cpp] view plaincopyprint?
1. int main(void)
2. {
3.
char num;
4.
for(num = 0; num < 255; )
5.
num += num;
6.
printf("%d\n",num);
7.
return 0;
8. }
4
、程序出错在什么阶段?()
[cpp] view plaincopyprint?
1. int main(void)
2. {
3.
http://www.sogou.com
4.
cout<<"welcome to sogou"<<endl;
5.
6.
return 0;
7. }
A
、编译阶段出错
B
、运行阶段出错
C
、编译和运行都出错
D
、程序运行正常
因为
http://www.sogou.com
//
后面是注释,前面的
http:
是标签(类似于
goto
语句中
的标签)。(这个题目碉堡了)
5
、下面程序执行结果为【说明:
X86_64
环境】(
D
[cpp] view plaincopyprint?
1. int main(void)
2. {
of 14
40墨值下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜