Win a copy of Rust Web Development this week in the Other Languages forum!

Max Bazhenov

Greenhorn
+ Follow
since Oct 30, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Max Bazhenov

Given the following code, which statements are true?

A. The code will fail to compile.
B. Separate threads can execute the up() method concurrently.
C. Separate threads can execute the down() method concurrently.
D. Separate threads can execute both the up() and down() method concurrently.
E. The assertion in the jump() method will not fail under any circumstances.

ANSWER: C, D
Why D is correct ?
And why E is incorrect ?

(code tags added)
[ November 12, 2004: Message edited by: Barry Gaunt ]
Given the following code, which statements concerning the objects referenced through the member variables i, j and k are true, given that any thread may call the methods a(), b() and c() at any time?

A. i.v is guaranteed always to be 0 or 1.
B. j.v is guaranteed always to be 0 or 1.
C. k.v is guaranteed always to be 0 or 1.
D. j.v will always be greater than or equal to k.v at any give time.
E. k.v will always be greater than or equal to j.v at any give time.

ANSWERS: A, B
Why A is correct? Assume that one thread executes method's a() i.inc(), after that another thread executes method's b() i.inc().
Value of i.v will be 2, isn't it ?
Where am I mistaken ?
[ November 12, 2004: Message edited by: Barry Gaunt ]
Sorry, guys, the test is disabled for a while. Will make it available as soon as I get cool questions from you.
Corey, I've written a response for you.
damn, don't get it.
what is 2's complement form ?
I know how you can crash.
STEP 1: get drunk in the morning
STEP 2: go to the exam
STEP 3: leave all questions without answer
STEP 4: commit
STEP 5: wait for results
STEP 6: get drunk
byte b = -128;
b = (byte) (b >> 1);

The result is negative !
STEP 1: -128 = 1111 1111, correct ?
STEP 2: promote byte to int
result: 1000 0000 0000 0000 0000 0000 0111 1111, correct ?
STEP 3: shift
result: 1100 0000 0000 0000 0000 0000 0011 1111, correct ?
STEP 4: norrowing cast
result: 0011 1111, correct ?

Why do we get negative as a result, where is the error ?

[ November 04, 2004: Message edited by: Max Bazhenov ]
[ November 04, 2004: Message edited by: Max Bazhenov ]
Guys, please share your tricky questions with me !
The are only 13 questions, that's not too much
Gave authorization to everyone, who had asked.
Pardon, 11 out of 13 = 84%.
Correy, what result did you see? Why I see 92% in the report...
OK. Got first results

Corey - 92% (11 questions correct out of 13) - not bad, really )
Who will make 100% ?
Hi, all.

I have created the draft version of "SCJP Tricky Question Test" on www.overalltesting.com
The test contains now 13 questions only, 120sec limitation for each question. Passing score 100%
The test is private, so you will need to register on the site, and then request authorization for the test with ID=A-0045 (you may find the ID in the list of tests). When I get your request I'll give you one try to pass the test and check your knowledge.

Hope it will help someone
Thanks.
Barry, you mean everything posted here is JavaRanch privacy and it is impossible to reproduce questions from here? Sounds weird. There is no privacy for what people say.
Anyway, I think it is possible to implement my idea if you would send tricky questions directly to my email with correct answers (whizz_kid@bk.ru). No need for forum links anymore. Moreover, I hope the administration of this cool site wouldn't be against the idea of helping people to achieve their goals.

Thank you for understanding.
17 years ago