设为首页收藏本站

嘻皮客娱乐学习网

 找回密码
 中文注册
搜索
打印 上一主题 下一主题
开启左侧

[面试问题] 路透常考笔试题分享

[复制链接]
跳转到指定楼层
楼主
发表于 2014-11-29 05:21:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
路透常考笔试题分享:
1.class
{
public:
void f();
const void g();
private;
int data;
}
下面哪个选项可以访问data?
a.g() b.f() c. g()和f() d.都不可以
2.which one calls a program to halt?(multiple answers)
A.assert(10>0) B.assert(10<0) C.assert(x=0) D.assert(x<0)
3.void time(int year,int moth=10,date=10);
下面哪些选项可以正确调用time()?
a.time(1995);
b.time(1995,1);
c.time(1995,1,2);
d.都不可以
4.下面哪个选项可以访问一个类的私有成员?
a.友元类的公有成员函数 b.类的公有成员函数 c.类的私有成员函数 d.都可以 e.都不可以
5.下面是一个类的几个部分,哪些部分有错误?
a.void ~Time(int);
b.class Time
{
public:
private:
int hour=0;
};
c.int Time(const char*,const char*);
d.Time(const char*,const char*);
6.什么时候会用到模版类?
7.(大概是这么个意思)
#include
int a =0;
void fn(int j,int *k)
{
int i=0;
i++;
int a=1;
*k=a;
j=i;
}
void main()
{
fn(1,2);
cout<
cout<<*k<
cout<
}
a,b,c句的打印结果是什么?
8.void f(________head_ptr);
其中head_ptr是链表的头,f()是一个要对链表进行某种操作的函数,这个链表可能本来有一个头结点。
横线上应该填什么?
a.node *, b.node &, c.node*&, d.node
9. 一个二叉树
10
/
2 15
/ /
1 30 3 5
移去二叉树的根节点并且用其他节点代替,用哪些节点使这个二叉树不受影响?
a. 2 b.15 c.1 d.3 e.5
10.(题目都没看懂)
circular array of CAPACITY elements, last is an index into that array,  formular for the index afer last?
11.MyStruct
{
int a;
char*p;
double b;
}
void main()
{
MyStruct s[20];
MyStruct *p1=(MyStruct*)malloc(sizeof(MyStruct));
MyStruct*p2=new MyStruct;
}
求sizeof(MyStruct),sizeof(s);sizeof(p1),sizeof(p2);
12.
int fn(char *s)
{
int a=0;
while(*s++)
{
a++;
}
return a;
}
void main()
{
char str[20]="AAABBBCCC";
int i=fn(str);
int j=sizeof(str);
strcpy(str+3,"DDD");
cout<
}
i=?,j=?,最后输出的str=?
       
                   
回复

使用道具 举报

小黑屋|手机版|嘻皮客网 ( 京ICP备10218169号|京公网安备11010802013797  

GMT+8, 2024-5-3 19:25 , Processed in 0.152103 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表