Part 2,Number Systems Questions

Similar documents
World Inside a Computer is Binary

Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

Semester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC

Part 5,Assembly Language Questions

A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

8/27/2016. ECE 120: Introduction to Computing. Graphical Illustration of Modular Arithmetic. Representations Must be Unambiguous

Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

CS & IT Conversions. Magnitude 10,000 1,

Chapter 1. Digital Systems and Binary Numbers

Lecture 3: Binary Subtraction, Switching Algebra, Gates, and Algebraic Expressions

CS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29

Decimal & Binary Representation Systems. Decimal & Binary Representation Systems

CS 261 Fall Mike Lam, Professor Integer Encodings

COMP2611: Computer Organization. Data Representation

Chapter 4. Operations on Data

Number representations

EE 109 Unit 6 Binary Arithmetic

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

CS 31: Intro to Systems Binary Arithmetic. Kevin Webb Swarthmore College January 26, 2016

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column

Groups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

Chapter 3: Arithmetic for Computers

CS101 Lecture 04: Binary Arithmetic

Chapter 10 Binary Arithmetics

ECE/Comp Sci 352 Digital Systems Fundamentals. Charles R. Kime Section 2 Fall Logic and Computer Design Fundamentals

4/8/17. Admin. Assignment 5 BINARY. David Kauchak CS 52 Spring 2017

Chapter 3: part 3 Binary Subtraction

CMPSCI 145 MIDTERM #1 Solution Key. SPRING 2017 March 3, 2017 Professor William T. Verts

We are quite familiar with adding two numbers in decimal

Number System. Introduction. Decimal Numbers

Signed umbers. Sign/Magnitude otation

Programming Studio #1 ECE 190

Chapter 2 Bits, Data Types, and Operations

Chapter 2 Bits, Data Types, and Operations

Numerical Representations On The Computer: Negative And Rational Numbers

Representation of Non Negative Integers

Arithmetic for Computers

Chapter 4. Combinational Logic

CS/EE1012 INTRODUCTION TO COMPUTER ENGINEERING SPRING 2013 HOMEWORK I. Solve all homework and exam problems as shown in class and sample solutions

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction

Numerical Representations On The Computer: Negative And Rational Numbers

Programming Studio #1 ECE 190

CS 64 Week 1 Lecture 1. Kyle Dewey

Binary Representations and Arithmetic

TOPIC 2 DECIMALS (and INTRODUCTION TO FRACTIONS) WEEK 3

Chapter 2 Bits, Data Types, and Operations

Octal and Hexadecimal Integers

COMP 122/L Lecture 2. Kyle Dewey

Fundamentals of Programming Session 2

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

Binary Addition & Subtraction. Unsigned and Sign & Magnitude numbers

Arithmetic Processing

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

COMP Overview of Tutorial #2

As stated earlier, the declaration

Arithmetic and Logical Operations

8/30/2016. In Binary, We Have A Binary Point. ECE 120: Introduction to Computing. Fixed-Point Representations Support Fractions


The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop.

Floating Point Arithmetic

CHW 261: Logic Design

BINARY SYSTEM. Binary system is used in digital systems because it is:

Introduction to Computer Science-103. Midterm

E40M. Binary Numbers, Codes. M. Horowitz, J. Plummer, R. Howe 1

Number systems and binary

CSC201, SECTION 002, Fall 2000: Homework Assignment #2

Lecture 6: Signed Numbers & Arithmetic Circuits. BCD (Binary Coded Decimal) Points Addressed in this Lecture

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Lecture 2: Number Systems

Data Representation in Computer Memory

Introduction to Computer Science. Homework 1

Question 4: a. We want to store a binary encoding of the 150 original Pokemon. How many bits do we need to use?

CS 101: Computer Programming and Utilization

Chapter 2 Bits, Data Types, and Operations

Integer Representation

INF2270 Spring Philipp Häfliger. Lecture 4: Signed Binaries and Arithmetic

Chapter Three. Arithmetic

Five classic components

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CARLETON UNIVERSITY. Laboratory 2.0

More about Binary 9/6/2016

A Level Computing. Contents. For the Exam:

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

Floating Point Numbers. Lecture 9 CAP

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)

Number Systems and Their Representations

Number Systems. Readings: , Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs

Introduction to Computers and Programming. Numeric Values

Inf2C - Computer Systems Lecture 2 Data Representation

Basic Arithmetic (adding and subtracting)

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

Chapter 2 Bits, Data Types, and Operations

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

The type of all data used in a C++ program must be specified

The type of all data used in a C (or C++) program must be specified

Transcription:

Part 2,Number Systems Questions This study guide is provided as an aid in helping you to study for the ECE Department s 18-240, Fundamentals of Computer Engineering. The guide is a collection of previous test and homework questions for which solutions were handed out. Thus some of these questions are indicative of questions you might find on a test. Since answers are provided for these questions, you can use this guide to get extra practice on course-related problems. The guide consists of several files covering different topics. Please don t infer that this guide is all inclusive in terms of course topics or possible test questions. Further, the topics are distributed among several files. Please don t infer that the first test corresponds to file number one. It probably doesn t. Check with the course announcements regarding topics to be covered on a test. Oh yes, you might find some errors. Please let us know so that we can fix them for others. This file was produced using FrameMaker and saved in PDF format for Adobe Acrobat readers. Acrobat Exchange was used to include hot links between questions and answers. 2.1 Signed Numbers Add the two 4-bit numbers shown below, assuming they are in the representation listed at the top of each box. Note: the numbers in each box are not all the same. Show the bits of the resulting sum, and circle each final answer. Write the decimal value of the final 4-bit sum in the ( If the sum cannot be represented as a 4-bit result, say so. In each of the boxes below: ) 10 space. perform the binary addition assuming the numbers are in the number representation shown provide the result in binary show the result in base 10, and 61/65

tell us if there was an overflow (or underflow). Two s comp: One s comp: Signed magnitude: Unsigned binary: 2.2 Signed Numbers Add the two 4-bit numbers shown below, assuming they are in the representation listed at the top of the box. Note: the numbers in each box are not all the same. Show the bits of the resulting sum. Write the decimal value of the final 4-bit sum in the ( ) 10 space. If the sum cannot be represented as a 4-bit result, say so. 62/65

Interpret as Unsigned Binary 1101 + 0101 Interpret as Signed Magnitude 1110 + 0010 Interpret as 2s Complement 1101 + 0101 Interpret as 1s Complement 1100 + 0100 63/65

2.1 Signed Numbers a. Two s Complement Answers (6) (-6) 10000 (0) In a 2 s complement number scheme, we are taught to ignore the carry. Therefore, we ignore the 1, and the final result of our addition is 0000, which is equal to 0 in base 10. To check ourselves, in 2 s complement form, the number corresponds to 6 in base 10. The number corresponds to -6 in base 10. The addition of 6 and -6 gives us 0. There is no overflow in this example. b. One s Complement (6) (-5) 10000 1 0001 (1) With a 1 s complement number scheme, we remove the carry, then add it back to the result. Our result, 0001, is equivalent to the number 1 in base 10. There is no overflow. c. Signed Magnitude In a 4 bit, signed magnitude number scheme, numbers with a 1 as the 4th bit, are negative. Therefore we are performing an addition between the numbers (+110) and (-010). Our addition now becomes a simple subtraction. +110 (6) -010 (-2) 100 (4) The result is 0100 in signed magnitude (don t forget to include the sign bit back), which equals 4 in base 10. There is no overflow here. d. Unsigned Binary (6) (10) 10000 (16) 64/65

For unsigned binary, we just add the two binary numbers as is. Our result, 10000, or 16 in base 10, is a 5-bit number, therefore we cannot represent this sum in a 4-bit result. There is overflow with the 4-bit result. 2.2 Signed Numbers a. Interpret as Unsigned Binary 1101 (13) 0101 (5) 10010 (18) For unsigned binary, we just add the two binary numbers as is. Our result, 10010, or 18 in base 10, is a 5-bit number, therefore we cannot represent this sum in a 4-bit result. b. Interpret as Signed Magnitude In a 4 bit, signed magnitude number scheme, numbers with a 1 as the 4th bit, are negative. Therefore we are performing an addition between the numbers (-110) and (+010). Our addition now becomes a simple subtraction. -110 (-6) +010 (2) 100 (-4) The result is 1100 in signed magnitude (don t forget to include the sign bit back), which equals -4 in base 10. c. Interpret as 2 s Complement 1101 (-3) 0101 (5) 10010 (2) In a 2 s complement number scheme, we ignore the carry. Therefore, we ignore the 1, and the final result of our addition is 0010, which is equal to 2in base 10. d. Interpret as 1 s Complement 1100 (-3) 0100 (4) 10000 1 0001 (1) With a 1 s complement number scheme, we remove the carry, then add it back to the result. Our result, 0001, corresponds to 1 in base 10. 65/65