# Lecture3 - INFO-1003 Introduction to Computer Systems...

This preview shows pages 1–9. Sign up to view the full content.

INFO-1003 - Lecture 3 1 Copyright Richard Neville 2007 INFO-1003 Introduction to Computer Systems Lectures 3 & 4 Dr Richard Neville [email protected] Room: 1.6 Lamb Building, Booth street East Week 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
INFO-1003 - Lecture 3 2 Copyright Richard Neville 2007 Q3 1. Question What is the 11010 2 in radix 10? ANSWER(S): a) 26 10 . 2. Question a) How is the largest 5-bit binary number calculated? – give equation. b) What is the largest 5-bit binary number? c) What is the decimal equivalent of the largest 5-bit binary number? ANSWER(S): a) For any number base x for positive integers of n digits the range is from: 0 to x n – 1, or [0, x n – 1] e.g. x n – 1 = 2 5 – 1 = 32 -1 = 31; a) 11111 2 ; b) 11111 2 = 1×2 4 + 1×2 3 + 1×2 2 + 1×2 1 + 1×2 0 = 1×16 + 1×8 + 1×4 + 1×2 + 1×1 = 31. Question Convert the number 17 (decimal) to an unsigned binary byte? – using sequential division by 2. circle6 ANSWER(S): 2 )117 circle6 2 )17 R = 1 circle6 2 ) 8 R = 0 Result = 10001 binary circle6 2 ) 2 R = 0 circle6 2 ) 1 R = 0 circle6 0 R = 1 NOTE: In the exam approximately 2 question are taken from the topics (and program examples) coved in each lecture
INFO-1003 - Lecture 3 3 Copyright Richard Neville 2007 Lecture 3: Binary Arithmetic (1) Addition and Subtraction with signed and unsigned integers

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
INFO-1003 - Lecture 3 4 Copyright Richard Neville 2007 Learning Outcomes 1 circle6 To be able to perform calculations like: circle6 Binary Addition; circle6 Addition with 2’s complement numbers; circle6 Addition Applied to Signed Integers; circle6 Subtraction;
INFO-1003 - Lecture 3 5 Copyright Richard Neville 2007 Binary Addition circle6 The following rules apply circle6 0 + 0 = 0 (carry 0) circle6 0 + 1 = 1 (carry 0) circle6 1 + 0 = 1 (carry 0) circle6 1 + 1 = 0 (carry 1) ___ Re. Learning Resources 3.1 & 3.2 , available at the end of the lecture notes.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
INFO-1003 - Lecture 3 6 Copyright Richard Neville 2007 Addition Applied to Unsigned (i.e. Positive) Integers (Example 1) circle6 Using positive (unsigned) integers add the following pair of bytes together circle6 00000101 2 (5 10 ) circle6 00001100 2 (12 10 ) 00000101 + 00001100 00010001 11 barb2left carry Result = 00010001 2 = 17 10
INFO-1003 - Lecture 3 7 Copyright Richard Neville 2007 Addition Applied to Unsigned (i.e. Positive) Integers (Example 2) circle6 Using positive (unsigned) integers add the following pair of bytes together circle6 11111111 2 (255 10 ) circle6 00000010 2 (2 10 ) circle6 Looking at the first binary integer, we can see that we might meet a problem circle6 As noted in Lecture 2, 255 10 is the largest number we represent in an unsigned byte, we should find problems when we do the addition circle6 Next slide

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
INFO-1003 - Lecture 3 8 Copyright Richard Neville 2007 Addition Applied to Positive Integers (Example 2) 11111111 + 00000010 100000001 1111111 barb2left carry This appears to give the correct answer (2 8— 1)+2 1 =255 10 +2 10 =257 10 , but the result is 9 bits, we are adding bytes (8 bits) to produce a byte therefore the leftmost bit must be discarded.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern