|
|
|
|
|
|
c********2 发帖数: 56 | 1 面的是Associate C++ Developer,下面是面试题,光顾着记题了,最后只有56%的通过
率,要到
80%才能ONSITE,算是帮大家做点贡献吧,他家在招人,赶快去投简历
1) #include
using namespace std;
struct A{
A(int value) : m_value(value){}
int m_value;
};
struct B:A {
B(int value):A(value){}
};
int main(){
try {
try{
throw B(5);
}
catch(A a){
a.m_value *=2;
throw;
}
catch(B b){
b.m_value -=2;
throw b;
}
}
catch(A a){
std::cout << a.m_value;
}
return 0;
}
output?
2)how to declare a pointer to class member
3) #include
using namespace std;
struct Foo{
Foo() {std::cout <<"d";}
Foo(int i) {std::cout <<"i";}
Foo(char c) {std::cout <<"c";}
Foo(long l) {std::cout <<"l";}
Foo(float f) {std::cout<<"f";}
};
int main(){
Foo f1('a');
Foo f2('a'+1);
Foo f3(1);
Foo f4(0x01);
Foo f5(0X0001L);
Foo f6(1.0f);
system("pause");
return 0;
}
output?
4) #include
using namespace std;
int main(){
int a = 2|1;
cout << a;
system("pause");
return 0;
}
5)
class X{
public:
X& operator=(const X& rhs);
const X& operator+(const X&rhs) const;
const X& operator+(int m);
private:
int n;
};
int main(){
X a, b, c;
system("pause");
return 0;
}
which one is wrong?
a=c+5;
a=a=b+c;
(a=c+4)=b+2;
a=b+c;
b=a+1;
6) class foo{
public:
foo(int i){}
};
class bar: virtual foo{
public:
bar(){}
};
bar b;
what's wrong with the above code?
7) class deriv2: public mybase, devive1{}
is this correct?
8) ++ operator overload prefix & postfix, dummy parameter, both
prefix&postfix
forget....
9) int main(){
int c=0;
if(c=(c!=1)){}
cout <
system("pause");
return 0;
}
output?
10)int main(){
int a=5;
int b=a++;
int c=++a;
a=b*c;
cout <
system("pause");
return 0;
}
output?
11) template<> class Stack
{
public:
int push(char);
char pop();
};
what template<> signify in this exmple class ?
template queue
default template initialization
emplty template declaration
others
12) F00
| |
BAR BAR2
| |
FOOBAR FOOBAR2
dynamic cast foo to children | t**r 发帖数: 3428 | | g****v 发帖数: 971 | | m**l 发帖数: 306 | | A*****i 发帖数: 3587 | 5 百分之40多的路过,当年年轻气盛啥都没复习就直接上,直接傻眼
感觉flextrade要求C++功底很深厚啊 | x*****n 发帖数: 58 | 6 5) 貌似几个选择都是对的?
7)和12)哪位牛人给指导一下阿 | c********2 发帖数: 56 | 7
我好几道题都是用编译器做的还得这点分呢
现在工作真是难找啊,sign~
【在 A*****i 的大作中提到】 : 百分之40多的路过,当年年轻气盛啥都没复习就直接上,直接傻眼 : 感觉flextrade要求C++功底很深厚啊
| a****n 发帖数: 1887 | 8 这题跟功力没关系, 都是一个题库的, 记住答案就行了
【在 A*****i 的大作中提到】 : 百分之40多的路过,当年年轻气盛啥都没复习就直接上,直接傻眼 : 感觉flextrade要求C++功底很深厚啊
|
|
|
|
|
|
|