Chapter 7—Objects and Memory The Art and Science of An Introduction to Computer Science ERIC S. ROBERTS Java Objects and Memory C H A P T E R 7 Yea, from.

Slides:



Advertisements
Similar presentations
Number Systems and Codes
Advertisements

Review of HTML Ch. 1.
John Owen, Rockport Fulton HS
Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
Representing Numbers: Integers
Copyright (c) 2004 Professor Keith W. Noe Number Systems & Codes Part I.
Level ISA3: Information Representation
28-Jun-15 Number Systems. 2 Bits and bytes A bit is a single two-valued quantity: yes or no, true or false, on or off, high or low, good or bad One bit.
Chapter 4.2 Binary numbers: Arithmetic
Data Representation in Computers
1 Number Systems. 2 Numbers Each number system is associated with a base or radix – The decimal number system is said to be of base or radix 10 A number.
+ Binary Numbers. + + Why Binary? The smallest piece of information in a computer is a bit which stands for binary digit. (Portmanteau: smoke+fog = smog)
The Binary Number System
COE 202: Digital Logic Design Number Systems Part 1
2.1 2 Number Systems Foundations of Computer Science  Cengage Learning.
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
Real Numbers and the Decimal Number System
© Janice Regan, CMPT 128, Jan CMPT 128: Introduction to Computing Science for Engineering Students Integer Data representation Addition and Multiplication.
Lecture for Week Spring.  Numbers can be represented in many ways. We are familiar with the decimal system since it is most widely used in everyday.
Abstraction – Number Systems and Data Representation.
Memory and C++ Eric Roberts CS 106B February 1, 2013.
CMPT 120 How computers run programs Summer 2012 Instructor: Hassan Khosravi.
Chapter 7—Objects and Memory The Art and Science of An Introduction to Computer Science ERIC S. ROBERTS Java Objects and Memory C H A P T E R 7 Yea, from.
Decimal Number System We are used to the decimal number system which is a positional number system The decimal number 4386 represents the value: 41000.
IT-101 Section 001 Lecture #3 Introduction to Information Technology.
1 Number SystemsLecture 8. 2 BINARY (BASE 2) numbers.
DECIMAL BASE Based on power of 10 In the number 2,468 – from right to left -- the 8 represents the ones, the 6 represents the tens, the 4 represents the.
D ATA REPRESENTATION, BINARY SYSTEM, B IT, B YTE, ASCII C ODE Chapter 3 Mr.Mohammed Rahmath.
Representing Data. Representing data u The basic unit of memory is the bit  A transistor that can hold either high or low voltage  Conceptually, a tiny.
Data Representation in Computer Systems. 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
Binary Values and Number Systems
Lesson 8 – Binary Numbers Computer Programming 12.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Number Systems 0, 1 0, 1, 2,
CPIT 201 Introduction to Computing
Chapter 2 Data Representation.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
THE BINARY SYSTEM.
June 10, 2002© Howard Huang1 Number systems To get started, we’ll discuss one of the fundamental concepts underlying digital computer design:
Data Representation. What is data? Data is information that has been translated into a form that is more convenient to process As information take different.
MODULE –I NUMBER SYSTEM Digital Design Amit Kumar Assistant Professor SCSE, Galgotias University, Greater Noida.
Chapter 2 Binary Values and Number Systems Chapter Goals Distinguish among categories of numbers Describe positional notation Convert numbers in.
Data Representation Eric Roberts CS 106A February 10, 2016.
Computer Science LESSON 2 ON Number Bases.
Computer Studies Today Chapter 19 1 Chapter 19. Computer Studies Today Chapter 19 2 »Information stored in a computer is in two states: –ON –OFF.
Chapter 2: Binary Values and Number Systems Chapter 2 Binary Values and Number Systems Page 14 Information may be reduced to its fundamental state by.
CMSC 1041 Binary / Hex Binary and Hex The number systems of Computer Science.
Chapter 32 Binary Number System. Objectives After completing this chapter, you will be able to: –Describe the binary number system –Identify the place.
CPIT 201 King AbdulAziz University Faculty of Computing & Information Technology Information Technology Department CH 2 Number Systems CPIT 201 Introduction.
Lecture 4 Number Systems Lecturer: Sumaira Hussain.
Representing Positive and Negative Numbers
What is a byte? What is it? How would you use it?
Copyright (c) 2004 Professor Keith W. Noe
Data Representation in Computer Systems
Number Systems Lab session 1 Xuan Guo.
Number System conversions
Binary Representation
Objects and Memory Eric Roberts CS 106A February 5, 2010.
Ch2: Data Representation
Binary / Hex Binary and Hex The number systems of Computer Science.
COMS 161 Introduction to Computing
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Binary Representation
AP Computer Science LESSON 1 on Number Bases.
Chapter 7—Objects and Memory
Chapter Four Data Representation in Computers By Bezawit E.
Lecture 4 Number Systems. von Neumann Model Every computer today is based on the von Neumann Model. It is based on 3 ideas: 1.Four subsystems 2.Stored.
William Stallings Computer Organization and Architecture 10th Edition
CHAPTER 69 NUMBER SYSTEMS AND CODES
Presentation transcript:

Chapter 7—Objects and Memory The Art and Science of An Introduction to Computer Science ERIC S. ROBERTS Java Objects and Memory C H A P T E R 7 Yea, from the table of my memory I ’ ll wipe away all trivial fond records. —William Shakespeare, Hamlet, c. 1600

The Structure of Memory The fundamental unit of memory inside a computer is called a bit, which is a contraction of the words binary digit. A bit can be in either of two states, usually denoted as 0 and 1. Numbers are stored in still larger units that consist of multiple bytes. The unit that represents the most common integer size on a particular hardware is called a word. Because machines have different architectures, the number of bytes in a word may vary from machine to machine The hardware structure of a computer combines individual bits into larger units. In most modern architectures, the smallest unit on which the hardware operates is a sequence of eight consecutive bits called a byte. The following diagram shows a byte containing a combination of 0s and 1s:

Binary Notation The rightmost digit is the units place. The next digit gives the number of 2s. The next digit gives the number of 4s. And so on... Bytes and words can be used to represent integers of different sizes by interpreting the bits as a number in binary notation. 0 x = x = x = x = x = x = 32 0 x = x = Binary notation is similar to decimal notation but uses a different base. Decimal numbers use 10 as their base, which means that each digit counts for ten times as much as the digit to its right. Binary notation uses base 2, which means that each position counts for twice as much, as follows:

Numbers and Bases The calculation at the end of the preceding slide makes it clear that the binary representation is equivalent to the number 42. When it is important to distinguish the base, the text uses a small subscript, like this: = Although it is useful to be able to convert a number from one base to another, it is important to remember that the number remains the same. What changes is how you write it down. The number 42 is what you get if you count how many stars are in the pattern at the right. The number is the same whether you write it in English as forty-two, in decimal as 42, or in binary as Numbers do not have bases; representations do.

Octal and Hexadecimal Notation Because binary notation tends to get rather long, computer scientists often prefer octal (base 8) or hexadecimal (base 16) notation instead. Octal notation uses eight digits: 0 to 7. Hexadecimal notation uses sixteen digits: 0 to 9, followed by the letters A through F to indicate the values 10 to 15. The following diagrams show how the number forty-two appears in both octal and hexadecimal notation: 2 x = x = x = x = A 42 octalhexadecimal The advantage of using either octal or hexadecimal notation is that doing so makes it easy to translate the number back to individual bits because you can convert each digit separately.

Exercises: Number Bases What is the decimal value for each of the following numbers? AD 16 1 x = x = 0 2 = 0 4 = x = x = 7 1 = x = x = x = AD As part of a code to identify the file type, every Java class file begins with the following sixteen bits: How would you express that number in hexadecimal notation? AFE CAFE