CS 31: Intro to Systems Binary Representation. Kevin Webb Swarthmore College September 6, 2018
|
|
- Amelia Griffin
- 5 years ago
- Views:
Transcription
1 CS 3: Intro to Systems Binary Representation Kevin Webb Swarthmore College September 6, 28
2 Reading Quiz
3 Announcements Sign up for Piazza! Let me know about exam conflicts! Register your clicker (clarification on Piazza)!
4 Abstraction User / Programmer Wants low complexity Applications Specific functionality Software library Reusable functionality Operating system Manage resources Complex devices Compute & I/O
5 Today Number systems and conversion Data types and storage: Sizes Representation Signedness
6 Data Storage Lots of technologies out there: Magnetic (hard drive, floppy disk) Optical (CD / DVD / Blu-Ray) Electronic (RAM, registers, ) Focus on electronic for now We ll see (and build) digital circuits soon Relatively easy to differentiate two states Voltage present Voltage absent
7 Bits and Bytes Bit: a or value (binary) HW represents as two different voltages : the presence of voltage (high voltage) : the absence of voltage (low voltage) Byte: 8 bits, the smallest addressable unit Memory: (address) [] [] [2] Other names: 4 bits: Nibble Word : Depends on system, often 4 bytes
8 One bit: two values ( or ) Two bits: four values (,,, or ) Three bits: eight values (,,,, ) A. 8 B. 8 C. 256 D. 52 E. Some other number of values.
9 Discussion question Green border Recall the sequence Answer individually (room quiet) Discuss in your group (room loud) Answer as a group Class-wide discussion
10 How many unique values can we represent with 9 bits? Why? One bit: two values ( or ) Two bits: four values (,,, or ) Three bits: eight values (,,,, ) A. 8 B. 8 C. 256 D. 52 E. Some other number of values.
11 How many values? bit: 2 bits: 3 bits: 4 bits: 6 values N bits: 2 N values
12 C types and their (typical!) sizes byte: char, unsigned char 2 bytes: short, unsigned short 4 bytes: int, unsigned int, float 8 bytes: long long, unsigned long long, double 4 or 8 bytes: long, unsigned long unsigned long v; short s; long long ll; printf( %lu %lu %lu\n, sizeof(v), sizeof(s), sizeof(ll)); // prints out number of bytes How do we use this storage space (bits) to represent a value?
13 Let s start with what we know Decimal number system (Base ) Sequence of digits in range [, 9] 6425 Digit #4 Digit #
14 What is the significance of the N th digit number in this number system? What does it contribute to the overall value? 6425 A. d N * B. d N * C. d N * N D. d N * N E. d N * d N Digit #4 d 4 Digit # d Consider the meaning of d 3 (the value 4) above. What is it contributing to the total value?
15 Decimal: Base Favored by humans A number, written as the sequence of digits d n d n- d 2 d d where d is in {,,2,3,4,5,6,7,8,9}, represents the value: [d n * n ] + [d n- * n- ] [d 2 * 2 ] + [d * ] + [d * ] 6425 = 6 * * 3 + * * + 5 *
16 Generalizing The meaning of a digit depends on its position in a number. A number, written as the sequence of digits d n d n- d 2 d d in base b represents the value: [d n * b n ] + [d n- * b n- ] [d 2 * b 2 ] + [d * b ] + [d * b ]
17 Binary: Base 2 Used by computers to store digital values. Indicated by prefixing number with b A number, written as the sequence of digits d n d n- d 2 d d where d is in {,}, represents the value: [d n * 2 n ] + [d n- * 2 n- ] [d 2 * 2 2 ] + [d * 2 ] + [d * 2 ]
18 What is the value of b in decimal? A number, written as the sequence of digits d n d n- d 2 d d where d is in {,}, represents the value: [d n * 2 n ] + [d n- * 2 n- ] [d 2 * 2 2 ] + [d * 2 ] + [d * 2 ] A. 26 B. 53 C. 6 D. 6 E. 28
19 Other (common) number systems. Base : decimal Base 2: binary Base 6: hexadecimal Base 8: octal Base 64
20 Hexadecimal: Base 6 Indicated by prefixing number with x A number, written as the sequence of digits d n d n- d 2 d d where d is in {,,2,3,4,5,6,7,8,9,A,B,C,D,E,F}, represents the value: [d n * 6 n ] + [d n- * 6 n- ] [d 2 * 6 2 ] + [d * 6 ] + [d * 6 ]
21 What is the value of xb7 in decimal? A. 397 B. 49 C. 49 D. 437 E = 256
22 Important Point You can represent the same value in a variety of number systems / bases. It s all stored as binary in the computer. Presence/absence of voltage.
23 Other (common) number systems. Base 2: How data is stored in hardware. Base 8: Used to represent file permissions. Base : Preferred by people. Base 6: Convenient for representing memory addresses. Base 64: Commonly used on the Internet, (e.g. attachments).
24 Hexadecimal: Base 6 Fewer digits to represent same value Same amount of information! Like binary, base is power of 2 Each digit is a nibble, or half a byte.
25 Each hex digit is a nibble One hex digit: 6 possible values (-9, A-F) 6 = 2 4, so each hex digit has exactly four bits worth of information. We can map each hex digit to a four-bit binary value. (helps for converting between bases)
26 Each hex digit is a nibble Example value: xb7 Four-bit value: Four-bit value: B (decimal ) Four-bit value: 7 In binary: B 7
27 Converting Decimal -> Binary Two methods: division by two remainder powers of two and subtraction
28 Method : decimal value D, binary result b (b i is ith digit): i = while (D > ) if D is odd Example: Converting 5 set b i to if D is even set b i to i++ D = D/2 idea: D = b example: D = 5 a = D = b D = 52 a = D/2 = b/2 D = 26 a2 = D/2 = b/2 D = 3 a3 = D/2 = b/2 D = 6 a4 = D/2 = b/2 D = 3 a5 = = D = a6 = D = a7 = 5 =
29 Method : decimal value D, binary result b (b i is ith digit): i = while (D > ) if D is odd Example: Converting 5 set b i to if D is even set b i to i++ D = D/2 idea: D = b example: D = 5 a = D/2 = b/2 D = 52 a = D/2 = b/2 D = 26 a2 = D/2 = b/2 D = 3 a3 = D/2 = b/2 D = 6 a4 = D/2 = b/2 D = 3 a5 = = D = a6 = D = a7 = 5 =
30 Method : decimal value D, binary result b (b i is ith digit): i = while (D > ) if D is odd Example: Converting 5 set b i to if D is even set b i to i++ D = D/2 idea: D = b example: D = 5 a = D/2 = b/2 D = 52 a = D/2 = b/2 D = 26 a2 = D/2 = b/2 D = 3 a3 = D/2 = b/2 D = 6 a4 = D/2 = b/2 D = 3 a5 = = D = a6 = D = a7 = 5 =
31 Method 2 2 =, 2 = 2, 2 2 = 4, 2 3 = 8, 2 4 = 6, 2 5 = 32, 2 6 = 64, 2 7 = 28 To convert 5: Find largest power of two that s less than 5 (64) Subtract 64 (5 64 = 4), put a in d 6 Subtract 32 (4 32 = 9), put a in d 5 Skip 6, it s larger than 9, put a in d 4 Subtract 8 (9 8 = ), put a in d 3 Skip 4 and 2, put a in d 2 and d Subtract ( = ), put a in d (Done) d 6 d 5 d 4 d 3 d 2 d d
32 What is the value of 357 in binary? A. B. C. D. E. 2 =, 2 = 2, 2 2 = 4, 2 3 = 8, 2 4 = 6, 2 5 = 32, 2 6 = 64, 2 7 = 28, 2 8 = 256
33 So far: Unsigned Integers With N bits, can represent values: to 2 n - We can always add s to the front of a number without changing it: = = = byte: char, unsigned char 2 bytes: short, unsigned short 4 bytes: int, unsigned int, float 8 bytes: long long, unsigned long long, double 4 or 8 bytes: long, unsigned long
34 Representing Signed Values One option (used for floats, NOT integers) Let the first bit represent the sign means positive means negative For example: -> 5 -> -5 Problem with this scheme?
35 Floating Point Representation bit for sign sign exponent fraction 8 bits for exponent 23 bits for precision value = (-) sign *.fraction * 2 (exponent-27) let's just plug in some values and try it out x4ac49ba: sign = exp = 29 fraction = = * *2 2 = I don t expect you to memorize this
36 Up Next: Binary Arithmetic
CS 31: Intro to Systems Binary Representation. Kevin Webb Swarthmore College January 27, 2015
CS 3: Intro to Systems Binary Representation Kevin Webb Swarthmore College January 27, 25 Reading Quiz Abstraction User / Programmer Wants low complexity Applications Specific functionality Software library
More informationBinary Representations and Arithmetic
Binary Representations and Arithmetic 9--26 Common number systems. Base : decimal Base 2: binary Base 6: hexadecimal (memory addresses) Base 8: octal (obsolete computer systems) Base 64 (email attachments,
More informationHow a computer runs a program. Binary Representa8on and Opera8ons on Binary Data. Opera8ng System 9/17/13. You can view binary file contents
Consider the following type defini8on and variable declara8ons: struct persont { struct persont p1; char name[32]; int age; struct persont people[40] float heart_rate; }; (1) What type is each of the following
More informationCS101 Lecture 04: Binary Arithmetic
CS101 Lecture 04: Binary Arithmetic Binary Number Addition Two s complement encoding Briefly: real number representation Aaron Stevens (azs@bu.edu) 25 January 2013 What You ll Learn Today Counting in binary
More informationT02 Tutorial Slides for Week 2
T02 Tutorial Slides for Week 2 ENEL 353: Digital Circuits Fall 2017 Term Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary 19 September, 2017
More informationMore about Binary 9/6/2016
More about Binary 9/6/2016 Unsigned vs. Two s Complement 8-bit example: 1 1 0 0 0 0 1 1 2 7 +2 6 + 2 1 +2 0 = 128+64+2+1 = 195-2 7 +2 6 + 2 1 +2 0 = -128+64+2+1 = -61 Why does two s complement work this
More informationNumber Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr
Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems
More informationChapter 2 Bits, Data Types, and Operations
Chapter Bits, Data Types, and Operations How do we represent data in a computer? At the lowest level, a computer is an electronic machine. works by controlling the flow of electrons Easy to recognize two
More informationNumber Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example
Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,
More informationCS 31: Intro to Systems Binary Arithmetic. Kevin Webb Swarthmore College January 26, 2016
CS 31: Intro to Systems Binary Arithmetic Kevin Webb Swarthmore College January 26, 2016 Reading Quiz Unsigned Integers Suppose we had one byte Can represent 2 8 (256) values If unsigned (strictly non-negative):
More informationUNIT 7A Data Representation: Numbers and Text. Digital Data
UNIT 7A Data Representation: Numbers and Text 1 Digital Data 10010101011110101010110101001110 What does this binary sequence represent? It could be: an integer a floating point number text encoded with
More informationTOPICS. Other Number Systems. Other Number Systems 9/9/2017. Octal Hexadecimal Number conversion
Topic : Introduction To computers Faculty : Department of commerce and Management BY: Prof.Meeta R. Gujarathi E mail: meetargujarathi@gmail.com Octal Hexadecimal Number conversion TOPICS Other Number Systems
More informationCS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29
CS 31: Introduction to Computer Systems 03: Binary Arithmetic January 29 WiCS! Swarthmore Women in Computer Science Slide 2 Today Binary Arithmetic Unsigned addition Subtraction Representation Signed magnitude
More informationChapter 2 Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations Original slides from Gregory Byrd, North Carolina State University Modified slides by Chris Wilcox, Colorado State University How do we represent data in a computer?!
More informationChapter 2 Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations How do we represent data in a computer? At the lowest level, a computer is an electronic machine. works by controlling the flow of electrons Easy to recognize
More informationMACHINE LEVEL REPRESENTATION OF DATA
MACHINE LEVEL REPRESENTATION OF DATA CHAPTER 2 1 Objectives Understand how integers and fractional numbers are represented in binary Explore the relationship between decimal number system and number systems
More informationPositional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal
Positional notation Ch.. /continued Conversions between Decimal and Binary Binary to Decimal - use the definition of a number in a positional number system with base - evaluate the definition formula using
More informationModule 1: Information Representation I -- Number Systems
Unit 1: Computer Systems, pages 1 of 7 - Department of Computer and Mathematical Sciences CS 1305 Intro to Computer Technology 1 Module 1: Information Representation I -- Number Systems Objectives: Learn
More informationCPS 104 Computer Organization and Programming Lecture-2 : Data representations,
CPS 104 Computer Organization and Programming Lecture-2 : Data representations, Sep. 1, 1999 Dietolf Ramm http://www.cs.duke.edu/~dr/cps104.html CPS104 Lec2.1 GK&DR Fall 1999 Data Representation Computers
More information10.1. Unit 10. Signed Representation Systems Binary Arithmetic
0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system
More informationECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012
Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate
More informationInf2C - Computer Systems Lecture 2 Data Representation
Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack
More informationInformation Science 1
Information Science 1 - Representa*on of Data in Memory- Week 03 College of Information Science and Engineering Ritsumeikan University Topics covered l Basic terms and concepts of The Structure of a Computer
More informationdata within a computer system are stored in one of 2 physical states (hence the use of binary digits)
Binary Digits (bits) data within a computer system are stored in one of 2 physical states (hence the use of binary digits) 0V and 5V charge / NO charge on a transistor gate ferrite core magnetised clockwise
More informationCHAPTER V NUMBER SYSTEMS AND ARITHMETIC
CHAPTER V-1 CHAPTER V CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-2 NUMBER SYSTEMS RADIX-R REPRESENTATION Decimal number expansion 73625 10 = ( 7 10 4 ) + ( 3 10 3 ) + ( 6 10 2 ) + ( 2 10 1 ) +(
More informationBinary Values. CSE 410 Lecture 02
Binary Values CSE 410 Lecture 02 Lecture Outline Binary Decimal, Binary, and Hexadecimal Integers Why Place Value Representation Boolean Algebra 2 First: Why Binary? Electronic implementation Easy to store
More informationCOMP2611: Computer Organization. Data Representation
COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How
More informationChapter 2 Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations Original slides from Gregory Byrd, North Carolina State University Modified by Chris Wilcox, S. Rajopadhye Colorado State University How do we represent data
More informationBINARY SYSTEM. Binary system is used in digital systems because it is:
CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System
More informationTime: 8:30-10:00 pm (Arrive at 8:15 pm) Location What to bring:
ECE 120 Midterm 1 HKN Review Session Time: 8:30-10:00 pm (Arrive at 8:15 pm) Location: Your Room on Compass What to bring: icard, pens/pencils, Cheat sheet (Handwritten) Overview of Review Binary IEEE
More informationData Representation 1
1 Data Representation Outline Binary Numbers Adding Binary Numbers Negative Integers Other Operations with Binary Numbers Floating Point Numbers Character Representation Image Representation Sound Representation
More informationLevel ISA3: Information Representation
Level ISA3: Information Representation 1 Information as electrical current At the lowest level, each storage unit in a computer s memory is equipped to contain either a high or low voltage signal Each
More informationNumbering systems. Dr Abu Arqoub
Numbering systems The decimal numbering system is widely used, because the people Accustomed (معتاد) to use the hand fingers in their counting. But with the development of the computer science another
More informationThe type of all data used in a C++ program must be specified
The type of all data used in a C++ program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values There are
More informationDecimal & Binary Representation Systems. Decimal & Binary Representation Systems
Decimal & Binary Representation Systems Decimal & binary are positional representation systems each position has a value: d*base i for example: 321 10 = 3*10 2 + 2*10 1 + 1*10 0 for example: 101000001
More informationNumber Systems. Both numbers are positive
Number Systems Range of Numbers and Overflow When arithmetic operation such as Addition, Subtraction, Multiplication and Division are performed on numbers the results generated may exceed the range of
More informationCS Programming In C
CS 24000 - Programming In C Week Two: Basic C Program Organization and Data Types Zhiyuan Li Department of Computer Science Purdue University, USA 2 int main() { } return 0; The Simplest C Program C programs
More informationECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014
Problem 1 (4 parts, 21 points) Encoders and Pass Gates Part A (8 points) Suppose the circuit below has the following input priority: I 1 > I 3 > I 0 > I 2. Complete the truth table by filling in the input
More informationUnit 2: Data Storage CS 101, Fall 2018
Unit 2: Data Storage CS 101, Fall 2018 Learning Objectives After completing this unit, you should be able to: Evaluate digital circuits that use AND, OR, XOR, and NOT. Convert binary integers to/from decimal,
More informationIT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1
IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose
More informationComputer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2
Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up
More informationMachine Arithmetic 8/31/2007
Machine Arithmetic 8/31/2007 1 Opening Discussion Let's look at some interclass problems. If you played with your program some you probably found that it behaves oddly in some regards. Why is this? What
More informationCHW 261: Logic Design
CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER
More informationCS & IT Conversions. Magnitude 10,000 1,
CS & IT Conversions There are several number systems that you will use when working with computers. These include decimal, binary, octal, and hexadecimal. Knowing how to convert between these number systems
More informationRui Wang, Assistant professor Dept. of Information and Communication Tongji University.
Data Representation ti and Arithmetic for Computers Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Questions What do you know about
More informationCS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.
CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. 1 Part 1: Data Representation Our goal: revisit and re-establish fundamental of mathematics for the computer architecture course Overview: what are bits
More informationNumber System. Introduction. Decimal Numbers
Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26
More informationWhat Is It? Instruction Register Address Register Data Register
What Is It? Consider the following set of 32 binary digits, written in blocks of four so that the example is not impossible to read. 0010 0110 0100 1100 1101 1001 1011 1111 How do we interpret this sequence
More information1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
CS 64 Lecture 2 Data Representation Reading: FLD 1.2-1.4 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) 1010 10?= 1010 2?= 1
More informationGoals for this Week. CSC 2400: Computer Systems. Bits, Bytes and Data Types. Binary number system. Finite representations of binary integers
CSC 2400: Computer Systems Bits, Bytes and Data Types 1 Goals for this Week Binary number system Why binary? Converting between decimal and binary and octal and hexadecimal number systems Finite representations
More informationObjectives. Connecting with Computer Science 2
Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn how numbering systems are used to count Understand the significance of positional value
More informationElectronic Data and Instructions
Lecture 2 - The information Layer Binary Values and Number Systems, Data Representation. Know the different types of numbers Describe positional notation Convert numbers in other bases to base 10 Convert
More informationCOSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture)
COSC 243 Data Representation 3 Lecture 3 - Data Representation 3 1 Data Representation Test Material Lectures 1, 2, and 3 Tutorials 1b, 2a, and 2b During Tutorial a Next Week 12 th and 13 th March If you
More informationECE 20B, Winter Purpose of Course. Introduction to Electrical Engineering, II. Administration
ECE 20B, Winter 2003 Introduction to Electrical Engineering, II Instructor: Andrew B Kahng (lecture) Email: abk@eceucsdedu Telephone: 858-822-4884 office, 858-353-0550 cell Office: 3802 AP&M Lecture: TuThu
More informationCOMP2121: Microprocessors and Interfacing. Number Systems
COMP2121: Microprocessors and Interfacing Number Systems http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 1 Overview Positional notation Decimal, hexadecimal, octal and binary Converting
More informationLecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee
١ Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee Digital systems Digital systems are used in communication, business transactions, traffic control, spacecraft guidance, medical
More informationNumber Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation
Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur 1 Number Representation 2 1 Topics to be Discussed How are numeric data items actually
More informationSigned Binary Numbers
Signed Binary Numbers Unsigned Binary Numbers We write numbers with as many digits as we need: 0, 99, 65536, 15000, 1979, However, memory locations and CPU registers always hold a constant, fixed number
More informationComputer System and programming in C
1 Basic Data Types Integral Types Integers are stored in various sizes. They can be signed or unsigned. Example Suppose an integer is represented by a byte (8 bits). Leftmost bit is sign bit. If the sign
More informationCourse Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation
Course Schedule CS 221 Computer Architecture Week 3: Information Representation (2) Fall 2001 W1 Sep 11- Sep 14 Introduction W2 Sep 18- Sep 21 Information Representation (1) (Chapter 3) W3 Sep 25- Sep
More informationCMPSCI 145 MIDTERM #1 Solution Key. SPRING 2017 March 3, 2017 Professor William T. Verts
CMPSCI 145 MIDTERM #1 Solution Key NAME SPRING 2017 March 3, 2017 PROBLEM SCORE POINTS 1 10 2 10 3 15 4 15 5 20 6 12 7 8 8 10 TOTAL 100 10 Points Examine the following diagram of two systems, one involving
More informationOctal and Hexadecimal Integers
Octal and Hexadecimal Integers CS 350: Computer Organization & Assembler Language Programming A. Why? Octal and hexadecimal numbers are useful for abbreviating long bitstrings. Some operations on octal
More informationDigital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.
Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we
More informationCMPE223/CMSE222 Digital Logic Design. Positional representation
CMPE223/CMSE222 Digital Logic Design Number Representation and Arithmetic Circuits: Number Representation and Unsigned Addition Positional representation First consider integers Begin with positive only
More informationLogic and Computer Design Fundamentals. Chapter 1 Digital Computers and Information
Logic and Computer Design Fundamentals Chapter 1 Digital Computers and Information Overview Digital Systems and Computer Systems Information Representation Number Systems [binary, octal and hexadecimal]
More informationECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014
Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate
More informationBits, Words, and Integers
Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are
More informationCOMP Overview of Tutorial #2
COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,
More informationCS 31: Intro to Systems Binary Arithmetic. Martin Gagné Swarthmore College January 24, 2016
CS 31: Intro to Systems Binary Arithmetic Martin Gagné Swarthmore College January 24, 2016 Unsigned Integers Suppose we had one byte Can represent 2 8 (256) values If unsigned (strictly non-negative):
More informationFinal Labs and Tutors
ICT106 Fundamentals of Computer Systems - Topic 2 REPRESENTATION AND STORAGE OF INFORMATION Reading: Linux Assembly Programming Language, Ch 2.4-2.9 and 3.6-3.8 Final Labs and Tutors Venue and time South
More informationECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010
Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate
More informationEEM 232 Digital System I
EEM 232 Digital System I Instructor : Assist. Prof. Dr. Emin Germen egermen@anadolu.edu.tr Course Book : Logic and Computer Design Fundamentals by Mano & Kime Third Ed/Fourth Ed.. Pearson Grading 1 st
More informationNumber Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers
Outline of Introduction Administrivia What is computer architecture? What do computers do? Representing high level things in binary Data objects: integers, decimals, characters, etc. Memory locations (We
More informationChapter 2 Number System
Chapter 2 Number System Embedded Systems with ARM Cortext-M Updated: Tuesday, January 16, 2018 What you should know.. Before coming to this class Decimal Binary Octal Hex 0 0000 00 0x0 1 0001 01 0x1 2
More informationNumber System (1A) Young Won Lim 7/7/10
Number System (A) 7/7/ Copyrigt (c) 9-6 Young W. Lim. Permission is granted to copy, distribute and/or modify tis document under te terms of te GNU ree Documentation License, Version. or any later version
More informationNumber Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column
1's column 10's column 100's column 1000's column 1's column 2's column 4's column 8's column Number Systems Decimal numbers 5374 10 = Binary numbers 1101 2 = Chapter 1 1's column 10's column 100's
More informationEngineering Computing I
Engineering Computing I Types, Operators, and Expressions Types Operators Expressions 2 1 2.1 Variable Names Names are made up of letters and digits The first character must be a letter The underscore
More informationDigital Systems COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals
Digital Systems COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals Welcome to COE 202 Course Webpage: http://faculty.kfupm.edu.sa/coe/mudawar/coe202/ Lecture
More informationDeclaration. Fundamental Data Types. Modifying the Basic Types. Basic Data Types. All variables must be declared before being used.
Declaration Fundamental Data Types All variables must be declared before being used. Tells compiler to set aside an appropriate amount of space in memory to hold a value. Enables the compiler to perform
More informationSlide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng
Slide Set 1 for ENEL 339 Fall 2014 Lecture Section 02 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2014 ENEL 353 F14 Section
More informationIntroduction to the Use of Computers
Introduction to the Use of Computers Christophe Rhodes crhodes@goldacuk Autumn 2012, Fridays: 10:00 12:00: WTA & 15:00 17:00: WHB 300 Bits and Bytes Bits A bit: 0 or 1; ( binary digit, or a digit in base
More informationC How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.
C How to Program, 6/e 1992-2010 by Pearson Education, Inc. An important part of the solution to any problem is the presentation of the results. In this chapter, we discuss in depth the formatting features
More informationWhere are we? Compiler. translating source code (C or Java) Programs to assembly language And linking your code to Library code
Where are we? Compiler Instruction set architecture (e.g., MIPS) translating source code (C or Java) Programs to assembly language And linking your code to Library code How the software talks To the hardware
More information1 Digital tools. 1.1 Introduction
1 Digital tools 1.1 Introduction In the past few years, enormous advances have been made in the cost, power, and ease of use of microcomputers and associated analog and digital circuits. It is now possible,
More informationChapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.
Chapter 3: Number Systems and Codes Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc., 5 th edition Decimal System The radix or base of a number system determines
More informationReview: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements
Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja
More informationIntegers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not.
What is an INTEGER/NONINTEGER? Integers are whole numbers; they include negative whole numbers and zero. For example -7, 0, 18 are integers, 1.5 is not. What is a REAL/IMAGINARY number? A real number is
More informationCIS 2107 Computer Systems and Low-Level Programming Fall 2011 Midterm
Fall 2011 Name: Page Points Score 1 5 2 10 3 10 4 7 5 8 6 15 7 4 8 7 9 16 10 18 Total: 100 Instructions The exam is closed book, closed notes. You may not use a calculator, cell phone, etc. For each of
More informationMoodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System
Moodle 1 WILLINGDON COLLEGE SANGLI ELECTRONICS (B. Sc.-I) Introduction to Number System E L E C T R O N I C S Introduction to Number System and Codes Moodle developed By Dr. S. R. Kumbhar Department of
More informationThese are reserved words of the C language. For example int, float, if, else, for, while etc.
Tokens in C Keywords These are reserved words of the C language. For example int, float, if, else, for, while etc. Identifiers An Identifier is a sequence of letters and digits, but must start with a letter.
More informationBinary, Hexadecimal and Octal number system
Binary, Hexadecimal and Octal number system Binary, hexadecimal, and octal refer to different number systems. The one that we typically use is called decimal. These number systems refer to the number of
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationMemory Addressing, Binary, and Hexadecimal Review
C++ By A EXAMPLE Memory Addressing, Binary, and Hexadecimal Review You do not have to understand the concepts in this appendix to become well-versed in C++. You can master C++, however, only if you spend
More informationCS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 3, 2015
CS 31: Intro to Systems Digital Logic Kevin Webb Swarthmore College February 3, 2015 Reading Quiz Today Hardware basics Machine memory models Digital signals Logic gates Circuits: Borrow some paper if
More informationLecture 2: Number Systems
Lecture 2: Number Systems Syed M. Mahmud, Ph.D ECE Department Wayne State University Original Source: Prof. Russell Tessier of University of Massachusetts Aby George of Wayne State University Contents
More informationChapter 2 Binary Values and Number Systems
Chapter 2 Binary Values and Number Systems Chapter Goals 10 進位 2 / 8 / 16 進位 進位系統間轉換 各進位系統小數表示 各進位系統加減法 各進位系統乘除法 2 24 6 Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to
More informationPrinceton University Computer Science 217: Introduction to Programming Systems. Goals of this Lecture. Number Systems and Number Representation
Princeton University Computer Science 27: Introduction to Programming Systems Goals of this Lecture and Number Representation Help you learn (or refresh your memory) about: The binary, hexadecimal, and
More informationNumber Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems
Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems In everyday life, we humans most often count using decimal or base-10 numbers. In computer science, it
More informationUnder the Hood: Data Representation. Computer Science 104 Lecture 2
Under the Hood: Data Representation Computer Science 104 Lecture 2 Admin Piazza, Sakai Up Everyone should have access Homework 1 Posted Due Feb 6 PDF or Plain Text Only: No Word or RTF Recommended: Learn
More information