This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
It's -1, it took me 10ms or less. Any bit flippers you get will be simple. Stop worrying, go through a few more mock exams - like Marcus Green's. I lost my 4% in SCJP when solving the loops questions - they are difficult especially when you have three people trying to fix a defective computer next to you when you are trying to do the exam.
That can't be -1. It's a positive number that's equal to
0000 1111 1111 1111 1111 1111 1111 1111 (binary)
I'm fairly certain they will never ask you to convert such a number to decimal. But they might to binary, which is much easier. As far as I know pretty much all questions on this topic are easy and if they look hard to you then you're missing a trick that will make it easy. [ August 15, 2005: Message edited by: Sergei Iakhnin ]
Originally posted by Marzo Kaahn: Sergei, what trick?
There is no one trick that will let you solve all the questions easily you just need to be observative about what they are asking you to do in a particular question. But if you are doing a question where you find yourself having to multiply 431531 by 85923523 in with only the pen and piece of paper that they give you then you are obviously missing something key.
The will do things like shifting integers by 33 for instance. There you know that you only need to shift by 1 as a result. Or they will downcast the result to a byte so you know that you only need to look at the 8 lowest bits which will be some small number.
You will need to remember two's complement well and be able to convert any base to binary well. With that mastered you shouldn't encounter any problems.
Originally posted by Barry Gaunt: ...especially when you have three people trying to fix a defective computer next to you when you are trying to do the exam.
Don't get me started on Prometric. [ August 15, 2005: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
The SCJP exam tests your knowledge of Java, not your ability to convert hex or binary to decimal. As long as you understand 2's complement, you'll be fine.
-- Phil
Consultant to SCJP team.<br />Co-designer of SCJD exam.<br />Co-author of "Complete Java 2 Certification Study Guide".<br />Author of "Ground-Up Java".
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
posted
0
Originally posted by Sergei Iakhnin: That can't be -1. It's a positive number that's equal to
0000 1111 1111 1111 1111 1111 1111 1111 (binary)
Well, um, ah, ouch, yes. Moral: When you are at a party, never slip away for five minutes to checkout SCJP. Just have another drink and relax.
Sergei Iakhnin
Ranch Hand
Joined: Nov 09, 2004
Posts: 53
posted
0
Originally posted by Barry Gaunt:
Well, um, ah, ouch, yes. Moral: When you are at a party, never slip away for five minutes to checkout SCJP. Just have another drink and relax.
Dionysus' revenge is swift for those who betray him thus.
Regarding bits, I know how to work with bitwise operators like &,| or ^. Also know about ~.I know that binary to octal and hexadecimal conversion. Now, where do we need 2s complement here? I just know its negating the bits and adding 1.Do I need to read more about 2s complement for the exam and where do i use it? In most of the forums thay have indicated you need to know 2s complement well?I am confused as to where it is to used?
Cheers
Sergei Iakhnin
Ranch Hand
Joined: Nov 09, 2004
Posts: 53
posted
0
You just need to know 2's complement to be able to negate binary numbers so that when you need to evaluate 1111 1111 1111 1111 1111 1111 1111 1011 you don't start pulling hair but instead know that it's -5
Smitha Ballikar
Ranch Hand
Joined: Aug 02, 2005
Posts: 99
posted
0
You just need to know 2's complement to be able to negate binary numbers so that when you need to evaluate 1111 1111 1111 1111 1111 1111 1111 1011 you don't start pulling hair but instead know that it's -5
Hi Sergei,
Thanks for your reply... But now I didnt get how it is -5.Could you please explain this in detail.I think I am missing something about 2s complement.
Binary negative numbers are expressed in 2's complement. To get 2's complement of binary number b you need to do following:
~b + 1 (I guess you know ~, i,e changing 1 to 0 and viceversa)
for ex:
+9 in base 10(Decimal) = 0000 1001 in base 2(Binary) 1. ~(+9) = 1111 0110 2. add 1 = 1111 0111 = -9 in binary.
Also remember when you have a binary negative number (Sign bit is 1) then you can 2's complement that and calculate the decimal to findout what number is that.
for ex if somebody asks you what is 1111 0111 in decimal:
now:
1. you know its a negative number (sign bit is 1)
2. 2's complement will be - 0000 1001 -- thats 9 so the original decimal number is -9.
Note: All my examples are in 8 bit format, but Java used 32 bits for integer. Anyway I can assure you that the concept is the same.
Now I guess you can understand how 1111 1011 is -5.