HOMEWORK # 2 SOLUTIO



Similar documents
Solution for Homework 2

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Systems I: Computer Organization and Architecture

Computer Science 281 Binary and Hexadecimal Review

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

CSI 333 Lecture 1 Number Systems

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Base Conversion written by Cathy Saxton

Number Representation

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Numbering Systems. InThisAppendix...

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

The string of digits in the binary number system represents the quantity

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

Lecture 2. Binary and Hexadecimal Numbers

Section 1.4 Place Value Systems of Numeration in Other Bases

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

Number of bits needed to address hosts 8

The use of binary codes to represent characters

Chapter 4: Computer Codes

Binary Adders: Half Adders and Full Adders

Chapter 2. Binary Values and Number Systems

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

Data Storage 3.1. Foundations of Computer Science Cengage Learning

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Levent EREN A-306 Office Phone: INTRODUCTION TO DIGITAL LOGIC

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Useful Number Systems

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

2011, The McGraw-Hill Companies, Inc. Chapter 3

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

Binary Number System. 16. Binary Numbers. Base 10 digits: Base 2 digits: 0 1

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Arithmetic in MIPS. Objectives. Instruction. Integer arithmetic. After completing this lab you will:

The Answer to the 14 Most Frequently Asked Modbus Questions

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Chapter Binary, Octal, Decimal, and Hexadecimal Calculations

The programming language C. sws1 1

Number and codes in digital systems

Counting in base 10, 2 and 16

Basic Use of the TI-84 Plus

Binary Numbers. Binary Octal Hexadecimal

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6

CHAPTER 5 Round-off errors

THE BINARY NUMBER SYSTEM

Unsigned Conversions from Decimal or to Decimal and other Number Systems

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

The Hexadecimal Number System and Memory Addressing

Copyright 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

Solution Guide Chapter 14 Mixing Fractions, Decimals, and Percents Together

Chapter 5 Instructor's Manual

Two's Complement Adder/Subtractor Lab L03

Binary Representation

Lecture 11: Number Systems

Grade 6 Math Circles. Binary and Beyond

Attention: This material is copyright Chris Hecker. All rights reserved.

Vieta s Formulas and the Identity Theorem

Cyber Security Workshop Encryption Reference Manual

Activity 1: Using base ten blocks to model operations on decimals

Computer Science 217

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example

1 Description of The Simpletron

CPU Organization and Assembly Language

Scientific Notation. Section 7-1 Part 2

Today s topics. Digital Computers. More on binary. Binary Digits (Bits)

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

Storing Measurement Data

A-level COMPUTER SCIENCE

Classful Subnetting Explained

Decimal to Binary Conversion

NUMBER SYSTEMS. William Stallings

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Chapter 1: Digital Systems and Binary Numbers

CPEN Digital Logic Design Binary Systems

DNA Data and Program Representation. Alexandre David

Factorizations: Searching for Factor Strings

Positional Numbering System

USB Card Reader Configuration Utility. User Manual. Draft!

Number Systems and Radix Conversion

Notes on Assembly Language

Goals. Unary Numbers. Decimal Numbers. 3,148 is s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1

2003 HSC Notes from the Marking Centre Software Design and Development

Memory Systems. Static Random Access Memory (SRAM) Cell

The New IoT Standard: Any App for Any Device Using Any Data Format. Mike Weiner Product Manager, Omega DevCloud KORE Telematics

3. Convert a number from one number system to another

COMPSCI 210. Binary Fractions. Agenda & Reading

Exponents, Radicals, and Scientific Notation

Chapter 1. Binary, octal and hexadecimal numbers

Japanese Character Printers EPL2 Programming Manual Addendum

COMBINATIONAL CIRCUITS

Intel Hexadecimal Object File Format Specification Revision A, 1/6/88

Transcription:

HOMEWORK # 2 SOLUTIO Problem 1 (2 points) a. There are 313 characters in the Tamil language. If every character is to be encoded into a unique bit pattern, what is the minimum number of bits required to do this? 8 bits can used to encode 2 8 = 256 characters and 9 bits can be used to encode 2 9 = 512 characters. So, we would need 9 bits. b. How many more characters can be accommodated in the language without requiring additional bits for each character? 512 313 = 199 Problem 2 (4 points) Convert the following 2's complement binary numbers to decimal numbers. a. 1010 First bit is 1. So it is a ve number. 2 s complement of 1010 = 0101 + 1 = 0110. So the answer is -6. b. 0010 This is a +ve number since it starts with 0 Answer is 2. c. 111111 This is a ve number since it starts with 1. Its 2 s complement is 000000 + 1 = 000001. So the answer is -1 d. 011111 This is a +ve number since it starts with 0. The answer is 31. Problem 3 (4 points) a. What is the largest positive number one can represent in a 16-bit 2's complement code? Write your result in binary and decimal. 0111 1111 1111 1111 binary and 2 15-1 = 32767 decimal

b. What is the greatest magnitude negative number one can represent in a 16-bit 2's complement code? Write your result in binary and decimal. 1000 0000 0000 0000 binary and -2 15 = -32768 decimal c. What is the largest positive number one can represent in a 16-bit signed magnitude code? Write your result in binary and decimal. 0111 1111 1111 1111 binary and 2 15-1 = 32767 decimal d. What is the greatest magnitude negative number one can represent in a 16-bit signed magnitude code? Write your result in binary and decimal. 1111 1111 1111 1111 binary and (2 15 1) = -32767 decimal Problem 4 (2 points) What are the 8-bit patterns used to represent each of the characters in the string "This Is Easy!"? (Only represent the characters between the quotation marks.) Character Hex (from ASCII table) Binary equivalent T 54 0101 0100 h 68 0110 1000 i 69 0110 1001 s 73 0111 0011 Space 20 0010 0000 I 49 0100 1001 s 73 0111 0011 Space 20 0010 0000 E 45 0100 0101 a 61 0110 0001 s 73 0111 0011 y 79 0111 1001! 21 0010 0001 Problem 5 (4 points) Convert the following decimal numbers to 8-bit 2's complement binary numbers. If there is problem while doing this, describe it. a. 102 0110 0110

b. 64 c. 128 0100 0000 Does not fit in an 8-bit signed number d. -128 1000 0000 Problem 6 (4 points) The following binary numbers are 4-bit 2's complement binary numbers. Which of the following operations generate overflow? Justify your answers by translating the operands and results into decimal. a. 0111 + 1101 No overflow. 0111 1101 10100 Answer is 0100 binary = 4 decimal [7 + (-3)] b. 1001 + 1110 Overflow. 1001 1110 10111 Answer is 0111 binary = 7 decimal. But actual answer is -9 [(-7) + (-2)]

c. 1111 + 1001 No overflow. 1111 1001 11000 Answer is 1000 binary = -8 decimal [(-1) + (-7)] d. 0011 + 0101 Overflow. 0011 0101 1000 Answer is 1000 binary = -8 decimal. But actual answer is 8 [3 + 5] Problem 7 (2 points) A computer programmer wrote a program that adds two numbers. The programmer ran the program and observed that when 5 is added to 8, the result is the character m. Explain why this program is behaving erroneously. The error that is occurring here is that 5 and 8 are being interpreted as characters 5 and 8 respectively. As a result, the addition that is taking place is not 5 + 8; rather, it is 5 + 8. If we look up values in the ASCII table, 5 is 0x35 and 8 is 0x38. 0x35 + 0x38 = 0x6d, which is the ASCII value for m.

Problem 8 (2 points) Compute the following: a. OT(1011) OR (1011) NOT(1011) = 0100 Answer = (0100) OR (1011) = 1111 b. OT(1001 A D (0100 OR 0110)) 0100 OR 0110 = 0110 1001 AND 0110 = 0000 Answer = NOT(0000) = 1111 Problem 9 (4 points) Write the decimal equivalents for these IEEE floating point numbers. a. 0 01111111 11000000000000000000000 Sign bit is 0 (+ve). Exponent = 127. Fraction = 1*2-1 + 1*2-2 = 0.75 Answer = (+) 1.fraction * 2exponent 127 = 1.75 * 2 0 = 1.75 b. 1 01111101 10000000000000000000000 Sign bit is 1 (-ve). Exponent = 125. Fraction = 1*2-1 = 0.5 Answer = (-) 1.fraction * 2exponent 127 = - 1.5 * 2-2 = - 0.375

Problem 10 (2 points) Given a black box which takes n bits as input and produces one bit for output, what is the maximum number of unique functions that the black box can implement? (Hint: Try to visualize a truth table for a single function of n bits. Determine how many rows such a truth table has. Then determine how many combinations are possible with the number of rows that you just found) Consider a single function that this black box implements. If there are n binary inputs, the truth table contains 2 n rows. Now, each of these rows in the truth table can be filled with 0 or 1. The number of ways in which we can fill in these rows (using 0 and 1) gives us the number of unique functions. Since each of the rows can be filled in using 2 possible values and since the number of rows is 2 n, the number of ways = 2 power (2 n ).