1 / 67

CS111 – Fundamentals of CS Lecture 2 Binary System I

CS111 – Fundamentals of CS Lecture 2 Binary System I. Mohammad El-Ramly, PhD 2017 Acadox.com/class/48372 Y1NVWG. دعاء.

blackledge
Download Presentation

CS111 – Fundamentals of CS Lecture 2 Binary System I

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS111 – Fundamentals of CSLecture 2Binary System I Mohammad El-Ramly, PhD 2017 Acadox.com/class/48372 Y1NVWG

  2. دعاء ربنا إننا سمعنا مناديا ينادى للإيمان فآمنا ، ربنا اغفر لنا ذنوبنا و كفر عنا سيئاتنا و توفنا مع الأبرار ، ربنا و آتنا ما وعدتنا على رسلك و لاتخزنا يوم القيامة إنك لا تخلف الميعاد

  3. Homework of last time ….. • Join http://www.acadox.com/join/Y1NVWG • Do Assignment 0 (2 marks) • Formstudy groups of 5 and submit your names to me. • Read lecture 1 slides and chapter 0 from the book (0.1 and 0.2) • ReadWikipedia article on حاسوب • Watch Charles Babbage's Analytical Engine https://www.youtube.com/watch?v=QVxbNZWLP60 • Book a time for oral teston Tuesday • You will be tested in materials of the week before exam • Get familiar with Windows and MS Office

  4. http://www.acadox.com/class/48372Y1NVWG

  5. What we did in lecture 1 • Course Objectives • Overview of Curriculum • Course Administration • Course Assessment

  6. Course Objectives • Learning the basic computer terminology • Learning about digital data representation • Learning about computer architecture • Learning problem solving and algorithms • Learn about computer networks and security • Acquiring computer literacy • Learning programming principles (applied with Python)

  7. Course Contents Computer Basics Dr. Mohammad El-Ramly • Computer Overview • Binary System • Data Representation • Computer Architecture • Data Storage • Networks and Internet • Social Impact of Computers • Problem Solving • & Programming • Dr. NouhSabry • Problem Solving • Flowcharts • Algorithms • Programming

  8. نصائح هامة للدارس فى كلية الحاسبات • حدد موقفك من الكلية • اعتمد على نفسك – اسأل و ابحث • تعرف على أكبر عدد ممكن من الناس • الصاحب ساحب – فأحسن اختيار أصحابك • لكل شئ وقته – فر من الفتن فرارك من الأسد • تابع الجديد – اقرأ الكتاب ، طالع المواقع ، خذ كورسا أونلاين • الدراسة ليست كل شئ – العب رياضة ، احفظ القرآن ، إطلع رحلة

  9. كيف تنجح فى الكلية و فى حياتك أولا: نم مبكرا عقب العشاء 1- وجعلنا الليل لباسا وجعلنا النهار معاشا 2- اللهم بارك لأمتي في بكورها نام بكير فيق بكير شوف الصحة كيف بتصير http://www.huffingtonpost.com/rosie-osmun/go-to-bed-early_b_7157026.html

  10. Lectures 2 & 3 Outline • Bits and bytes • Binary numbers • Binary operations • Binary fractions • Hexadecimal / Octal • Binary system for integers • Binary system for fractions • 2’s compliment and excess notations

  11. Reading for this lecture • Computer Science: An Overview Section 1.5

  12. What Will We Study? 2 H E 3 G 5 4 أ ب ت L Programs 1 Algorithms 4 5

  13. I. The Magic Bits • A bit is a Binary Digit. • A bit is either 0or 1 • 8 bits = 1 byte • 1024 byte = KB • 1024 x 1024 = MB • In computer • Everything is represented in bits • Everything is measured in bytes.

  14. I. The Magic Bits • A computer consists of: • A a “brain” or central processing unit, • RAM (memory) for temporary storage, • Long term storage devices (magnetic, optical, SSD), and • Input and output devices to i/o data • Computer components are made of ICs which are accumulations of transistors. • https://www.build-electronic-circuits.com/how-transistors-work/

  15. Everything is bits …. • Bit Patterns are used to represent information • Numbers ….. 345, 2.87 • Text characters….. aBc, أب, +-* • Images • Sound • And others

  16. How do I know what kind of data this is …… • Bit Patterns are used to represent information • 00000000 00000000 00000000 00000101 00000000 00000000 00000000 00001111 00000000 00000000 00000000 00011001

  17. Where is the bit stored ? • Switch open = input logic state 0 • Switch closed = input logic state1 • Lamp off = output logic state 0 • Lamp on = output logic state1 Electric Circuit

  18. Where is the bit stored ? A flip flop circuit for storing a bit in memory or processor

  19. The Magic Bits …..The Digital Revolution • The digital revolution is an ongoing process of social, political, and economic change brought about by digital technology, such as computers and the Internet

  20. The Digital Revolution • The second phase of the digital revolution materialized when the Internet was opened to public use: • WWW • Email • E-Commerce • E-Learning • VoIP • Social Media • Chatbots

  21. Bits changed ….. • The way we shop • The way we communicate • The way we find information • The way we chat • The way learn • The way we rebel • The way we play

  22. Why Binary? • It is easier to implement hardware to deal with binary values than to deal with 10 different values. • It can be represented by a transistor being off (0) or on (1). • It can be a magnetic stripe magnetized with North in one direction (0) or the opposite (1).

  23. II. Base 10 counting system • We happened to use the current counting system, because we happened to have ten fingers. • If dinosaurs had ruled the earth, they would be happy to use a 8-based counting system.

  24. Numbers • Ancient Africa • Notches on a bone. • Egyptians/Roman • Each magnitude is represented by a symbol. • Indian/Arabian (Modern numbering system) 1,475,268

  25. Egyptian Numbers

  26. Base 10 (Decimal numbers) • What does 157 mean? • 157 = 1 x 100 + 5 x 10 + 7 x 1 = 1 x 102 + 5 x 101 + 7 x 100

  27. Binary Code • Imagine a specie that only has two fingers. how can they count? • A computer is such kind of two-finger specie. 0 and 1 • Each place is the exponential of 2

  28. Base 10 vs Base 2 Base 10 157 157 = 1 x 100 + 5 x 10 + 7 x 1 = 1 x 102 + 5 x 101 + 7 x 100 Base 2 1011 = 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20 1011 = 1 x 8 + 0 x 4 + 1 x 2 + 1 x 1

  29. Base 10 vs Base 2

  30. Binary Bits and Bytes • 1 bit is a single bit of information: • a 1 or 0 • Only two possible values • 1 byte is 8 bits, an 8 bit word • 256 possible values from 0-255 base 10 or 00000000 to 11111111 base 2 • 10100110 is a single byte

  31. Converting Binary to Decimal = 64 + 16 + 2 = 82

  32. Decoding A Binary Number

  33. An algorithm for finding the binary representation of a positive integer

  34. Decimal to Binary

  35. III. Binary mathematics • Binary addition • Binary subtraction • Binary multiplication

  36. Binary Addition

  37. Binary Addition • 0+0=0 • 1+0=1 • 1+1=10

  38. Binary Subtraction 10 _ _ _ _

  39. Binary Subtraction • 0-0=0 • 1-0=1 • 1-1=0 • 0-1=1 (borrow)

  40. Binary Subtraction

  41. Binary Multiplication

More Related