• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

so confused, help

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I purchased the java 2 study guide exams 310-035 & 310-027 by Kathy Sierra and Bert Bates.
We'll I just finished chapter one and went through the pratice exam and scored only 20% overall, which is pretty depressing. Anyway, something aren't making sense to me. Are there mistakes in this book that have corrections else.
One thing is that it's using the forumal for unsigned as 2^(bits -1)- 1 which doesn't seem correct. Because if you take 16 bits, which is 1111111111111111 in binary and if you count doubling each number from 1 to 32768 it comes out to 65535, which the forumal looks like it should be just 2^(bits)-1
and a byte = 8 bits would be 2^8-1 which is 255 which makes sense.
Am I mistaken or the authors made a mistake? If there's corrections or anything for this book can I have the url for it please?
I don't know java well and after scoring 20% on chapter one doesn't seem like I'm doing well. Is this exam for me?
thanks in advance for any help
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I assume you're saying unsingned integer.
Unsigned integers can be of all sizes, int, long, and short.
The range of unsigned integers is 0 through 2^(k-1), where k is the number of bits, so for 16 bits the maximum unsigned integer is 65535.
I'm not sure whether there is any errata for this book.
Hope this helps.
 
Whod Prompt
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes that's exactly what I'm getting at.
If you have the book on page 12 it has short 16 bits at 2^15-1, which is 32767, not the 2^16-1 which should be the correct value.
also on page 43
Us the forumula -2^(bits-1) to 2^(bits-1)-1 to determine the range of an integer type.
I just don't want to learn something that's wrong. Are there any more mistakes? It's hard learning somethig with a wrong forumla
thanks so much for the fast reply, I really apprecaite the help
 
Whod Prompt
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I didn't write unsigned before. I understand two compliment just fine and unsigned also. I actualy understand this fine, I guess I'm just shocked being a newbie and finding a mistake like this
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The errata for Kathy and Bert's book is available here:
http://www.wickedlysmart.com/StudyGuide/StudyGuideIndex.html
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The (very long) errata for this book is at http://www.wickedlysmart.com
Your problem implies to me that you have not studied any programming language before, is that correct?
The representation of positive and negative integral numbers as a group of bits is basic computer science and common to a large group of programming languages.
If you let us know what knowlege you already possess about programming, we can recommend some notes or books at the appropriate level.
 
Whod Prompt
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the page, this really helps.
I enjoy this book also
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dominic Choo:
I assume you're saying unsingned integer.


Dominic, in Java all the integer types ( except for char) are signed.
 
Dominic Choo
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Barry.
 
reply
    Bookmark Topic Watch Topic
  • New Topic