T*****J 发帖数: 193 | 1 选的是advanced的级别,
Brianbench测试得4.2分的样子, 能过Bloomberg的online test了吗?
一般要过,得多少分? 呵呵 |
|
M*******8 发帖数: 85 | 2 Brianbench 测试要想在95%以上, 40题得对多少个?用时的限制呢? 是不是至少要4.
5分以上?
做过的给讲讲吧, 谢谢 |
|
y***y 发帖数: 224 | 3 请问brianbench 25刀的那个java test是不是跟 bloomberg 的java online test 是一
个题库啊? 还有什么其他公司也用brianbench做online test的么?
另外, brianbench的那个199刀的一年的plan有什么特别的地方么? 是不是多做些次那
个25刀的test 也能把题库覆盖了啊~
麻烦各位了~ |
|
|
|
T*****9 发帖数: 2484 | 6 认真看题
bloomberg的online test的确比较简单。。。 |
|
H*M 发帖数: 1268 | 7 it depends on which you choose, adv or beginner? |
|
b*********n 发帖数: 464 | 8 俺选advanced,好像错了10个以上,99%
4. |
|
|
Y**********l 发帖数: 104 | 10 会有STL的内容吗? Brianbench 有, 很烦 |
|
Y**********l 发帖数: 104 | 11 做BB的BT题之前, 最好用Brianbench多练习练习, 不管有多少年经验, 因为有的东
东平时根本用不动的。
好像半年以后你还可以再试试, 不确定黑名单是不是半年期,或者你换个email重新申
请?
谁给确认下?
java |
|
h****b 发帖数: 157 | 12 template class A
{
public:
A(){}
};
template class B
{
public:
B() {};
/* add something here to make A a friend */
};
Referring to the sample code shown above, which one of the following
declares every specialization of A to be a friend class of the
corresponding specialization of B?
哪个对?我试了都可以。。谢谢
template friend class A;
friend class A; |
|
|
|
|
M********5 发帖数: 715 | 16 题目问的是
every specialization of A to be a friend class of the
corresponding specialization of B
我想这句话的意思是,A和B在instantiation的时候,两个的type应该是一样的,我是
从corresponding来理解这句话的
所以答案就是后面那个
第一个答案,没有表示两个类之间的联系,可以看看c++ primer写得很清楚了 |
|
h****b 发帖数: 157 | 17 以下选哪一个
class String {
char *s;
int length;
public:
String(const char *);
String();
/* add code here */
};
int main()
{
String s1 = "abc";
String s2 = "def";
strcmp(s1, s2);
getchar();
return(1);
}
Referring to the sample code above, which one of the following member
functions do you add at the comment in order to allow the strcmp(s1, s2)
statement to compile?
operator const char*() const { return s; }
char* const operator() const { return s; }
operator char* |
|
|
M********5 发帖数: 715 | 19 首先,你要弄清楚这道题的考点。这道题的考点是conversion operator,参考c++
primer的527页。
conversion operator的很明显的一个特点是函数以operator开头,且没有返回值,依
据这一点,排除了三个选项。
第二个考点(本来不是太明显,在这题中),就是const究竟修饰什么,记住一点,
const放在*后面,修饰的就是指针,就是说指针不能再变。
第三个考点,strcmp的参数类型是什么?cstring!cstring又是什么?const char*!
所以这就是我的答案 |
|
h****b 发帖数: 157 | 20 class Foo {
public:
virtual ~Foo() {}
};
class Bar : public Foo {
};
class Bar2 : public Foo {
};
class FooBar : public Bar {
};
class FooBar2 : public Bar2 {
};
以下哪个对?
1. Foo &foo = static_cast(FooBar2 f);
2. Foo &foo = dynamic_cast(*(new FooBar2)); 编译不过。
2肯定对,为啥1不对?我试了,如果1写成,
FooBar2 1;
Foo &foo = static_cast(f);
编译没问题。
指教,谢谢 |
|
h****8 发帖数: 599 | 21 有没有可能是因为Foo &foo = static_cast(FooBar2 f) 中的f在cast完以后就
生命结束了,这样foo是一个无效地址的引用,所以不可以
而FooBar2 f;
Foo &foo = static_cast(f);
中f还是有效的,所以编译通过了 |
|
z****e 发帖数: 2024 | 22 1. static_cast(FooBar2 f)
FooBar2 f; is a "statement", not a "variable".
if you need something should be like this:
const Foo& foo=static_cast(FooBar2());
i guess hhxk18 means the above. |
|
|
J*****n 发帖数: 4859 | 24
我印象中,如果不是buildin type,static_cast只能对指针进行操作吧。 |
|
|
h*******u 发帖数: 15326 | 26 g++ 3.4.4
FooBar2 f;
Foo& foo=static_cast(f);
通过
Foo& foo=static_cast(FooBar2());
通不过
const Foo& foo=static_cast(FooBar2());
通过
谁给讲讲第二个为什么通不过? |
|
d****p 发帖数: 685 | 27 What's the point to get reference of a temporary?
This will fail in vritually all compilers except vs. |
|
d****p 发帖数: 685 | 28 The third one is only syntactically right : converting a temporary into a r-
value is ok.
But it is a programming error. |
|
h*******u 发帖数: 15326 | 29 先不提临时变量,问题是为什么第三个语义上对,而第二个编译却不通过.const区别在
哪里. |
|
d****p 发帖数: 685 | 30 T const & is r-value so it accepts T
T& is l-value so it rejects T as a temporary. |
|
z****e 发帖数: 2024 | 31 什么programming error?
take a const reference of a temporary is a programming error, why?
the reference can be used later on, so why it is an error?
r- |
|
d****p 发帖数: 685 | 32 I think we are gonna start a tricky discussion :-)
The lifetime of a temporary is ended when the expression generating the
temporary is evaluated.
So,
Foo const& foo = static_cast(Foo()) will yield a dead reference,
pointing to destroyed object (the
foo). Isn't it a programming error?
So never explictly construct a reference to a temporary - doing so will
invalidate the object behind the
reference when the initialization statement completes.
The form DoSthForFoo(Foo()) is valid (supp |
|
z****e 发帖数: 2024 | 33 so now i see your point that in the function call, temporary lifetime is
determined in the caller's scope.
i totally agree that the temporary will be destroyed after the expression is
evaluated.
But i also expect there are some situations when the temporary will not be
physically destroyed if a reference is attached to it.
sometimes, i tried this kind of coding, and it usually works.
So, if you are sure that the temporary will be destroyed even if there is a
const reference attached to, then i w |
|
d****p 发帖数: 685 | 34 OK, could you tell if the following code is OK? What's the value of a in
main()?
class Foo
{
public:
....Foo(int a) : a(a) {}
....int GetValue() { return a; }
private:
....int a;
};
int main()
{
....const Foo& foo = static_cast(Foo(1));
... int a = foo.GetValue();
....return 0;
}
is
a
do |
|
z****e 发帖数: 2024 | 35 you may need to have a const member function
int GetValue() const {return a;}
in my machine, the value of 'a' in main is the same as the value of 'a' in the
temporary Foo(x); (assuming the GetValue is a const mem fun.)
so, i mean, i still agree with you that tmp will be destroyed when expression is done the evaluation.
but when there is a const ref attached to the tmp, i'm not quite sure if the tmp will be deleted physically or not. |
|
d****p 发帖数: 685 | 36 Good catch - the GetValue() should be const.
So do you think the code is valid? :-)
the |
|
z****e 发帖数: 2024 | 37 yes of course, it compiles fine and shows the correct value. |
|
z****e 发帖数: 2024 | 38 when a ref is declared, it must be defined. so the ref is attached to some
piece of memory.
if this piece of memory is destoryed, i think the above code shows "
undefined" behavior even the correct result is shown.
let me try an other snip example to see if my understanding is right or not. |
|
z****e 发帖数: 2024 | 39 add this to the code
~Foo(){
cout<<"Foo::~Foo()"<
}
output
Foo::~Foo()
1
so the result should be "undefined" when const refer to a tmp.
i now agree with you about this point.
thanks for digging this out. |
|
d****p 发帖数: 685 | 40 Cool :-)
Offer letter on the way... |
|
z****e 发帖数: 2024 | 41 55555555555555555
and hope it can really happen within a year. |
|
t****t 发帖数: 6806 | 42 i think you are wrong here.
the lifetime of a temporary is ended when expression generating the temp is
fully-evaluated, that's usually correct; except in two cases: 1. temp appear
s in the initializer of a declarator, then temp persists until initializatio
n completes. 2. temp is bind to a (const) reference; then temp persists unti
l the reference is out of bound. see 12.2, clause 3-5.
reference, |
|
t****t 发帖数: 6806 | 43 however, you are right that your example is not OK. let me make it clear:
const A& = A(); //OK
const A& = static_cast(A()); //wrong
you must bind the temp *directly* to the const reference, then clause 5 is
in effect. if cast with static_cast, then clause 5 is not in effect. |
|
d****p 发帖数: 685 | 44 You are right; thanks for pointing it out.
The static cast expression bypasses the rule for extending temporary's
lifetime: the right side of the initializer
is not a temporary of type T (instead, it is another expression yielding a
const reference const T&). So the
temporary's lifetime is only as long as the expression (in this case the
cast).
Hmmm, a cast sometimes does make a difference.
is |
|
|
|