.

2's complement help

<<

ethicalhack3r

Full Member
Full Member

Posts: 139

Joined: Fri Nov 28, 2008 11:29 am

Post Tue May 19, 2009 5:44 am

2's complement help

Hello,
I had an exam this morning which had the following question:

What is the largest positive value that can be represented using a 16-bit 2's complement representation?

My answer was 32766

Im sure its wrong tho, any one know the real answer?
<<

hayabusa

User avatar

Hero Member
Hero Member

Posts: 1662

Joined: Mon Jan 29, 2007 2:59 pm

Post Tue May 19, 2009 9:21 am

Re: 2's complement help

Been a while since I've done this.  I think you're one shy, and the answer is 32767.

16-bit would be 1000000000000000, and flipping the bits would yield 0111111111111111, which is equal to 32767 decimal.

To support my thinking, I found the following:

"For instance, a 16-bit word can represent signed integers in the range −32 768 to + 32 767."

which I took from:

http://openlearn.open.ac.uk/mod/resourc ... ?id=175771

HTH.

(edit - please excuse me if I'm incorrect, and someone tell us otherwise...  been a LONG time since I'd done these, too)
Last edited by hayabusa on Tue May 19, 2009 9:29 am, edited 1 time in total.
~ hayabusa ~ 

"All men can see these tactics whereby I conquer, but what none can see is the strategy out of which victory is evolved." - Sun Tzu, 'The Art of War'


OSCE, OSCP , GPEN, C|EH
<<

ethicalhack3r

Full Member
Full Member

Posts: 139

Joined: Fri Nov 28, 2008 11:29 am

Post Tue May 19, 2009 12:39 pm

Re: 2's complement help

I think your right because 0 is a positive number and I completely forgot about it.

Thanks for the help!  :)
<<

jason

User avatar

Hero Member
Hero Member

Posts: 1013

Joined: Sat Jun 21, 2008 6:23 pm

Location: USA

Post Tue May 19, 2009 5:50 pm

Re: 2's complement help

What was the subject matter of the test, out of curiosity?
<<

ethicalhack3r

Full Member
Full Member

Posts: 139

Joined: Fri Nov 28, 2008 11:29 am

Post Wed May 20, 2009 6:11 am

Re: 2's complement help

Computer System Fundamentals

The whole module was based on the following book:
Fundamentals of Computer Architecture - Mark Burrell (2004)

http://www.amazon.co.uk/Fundamentals-Co ... 0333998669
<<

RoleReversal

User avatar

Hero Member
Hero Member

Posts: 928

Joined: Fri Jan 04, 2008 8:54 am

Location: UK

Post Wed May 20, 2009 11:03 am

Re: 2's complement help

Ethicalhack3r,

ethicalhack3r wrote:The whole module was based on the following book:
Fundamentals of Computer Architecture - Mark Burrell (2004)


Just out of interest, was Mark Burrell also one of the module lecturers?
I remember some sleep-inducing lectures from him :D

Andrew
<<

ethicalhack3r

Full Member
Full Member

Posts: 139

Joined: Fri Nov 28, 2008 11:29 am

Post Wed May 20, 2009 4:20 pm

Re: 2's complement help

He wasnt one of my lecturers but he used to lecture at Northumbria, think he left a couple of years ago maybe?!

I think its the logic gates that get me nodding off...
<<

RoleReversal

User avatar

Hero Member
Hero Member

Posts: 928

Joined: Fri Jan 04, 2008 8:54 am

Location: UK

Post Thu May 21, 2009 12:59 am

Re: 2's complement help

Must have left after my days then, tbh think the whole module got me sleeping.

Wish I'd paid more attention now I'm playing with shellcode, turns out the low-level stuff is still relevant. Who'd of thought the lecturers would have a better understanding of the industry than the students? :)

Return to Other

Who is online

Users browsing this forum: No registered users and 1 guest

cron
.
Powered by phpBB® Forum Software © phpBB Group.
Designed by ST Software