UNIT -II:
COMPUTER ARITHMETIC & STORAGE FUNDAMENTALS:
    Binary, Binary Arithmetic,
    Number System:
        o Positional & Non-Positional,
        o Binary, Octal, Decimal, Hexadecimal
    Converting from one number system to another.
    Primary Vs Secondary Storage:
    Data storage & retrieval methods.
    Primary Storage: - RAM, ROM, PROM, EPROM, EEPROM.
    Secondary Storage: -Magnetic Tapes, Magnetic Disks. Cartridge tape, hard disks,
     Floppy disks, Optical Disks, Compact Disks, Zip Drive, Flash Drives
List of Important Questions:
   1. What is number system? Explain various types of number systems 2021,2022
   2. What is binary arithmetic? How does it help in programming? 2019
   3. Short note on Binary, Decimal, Octal, Hexa decimal  2021
   4. Differentiate between RAM and ROM2021,2022
   5. Discuss about various secondary storage devices.  2021
   6. What is data storage? what are its types  2019
                                                                                  1|Page
What is a Number System?
    Number systems are very important because the design and organisation of a
     computer system depends upon the number system.
    A number system has an ordered set of symbols known as digits with rules defined
     for performing arithmetic operations like addition, multiplication etc.
   Classification of Number System:
   1. Positional or weighted number system
   2. Non-Positional number system
Positional (or Weighted) Number System:
A positional number system is also known as weighted number system.
    Positional number systems use only few symbols called digits.
    According to its position of occurrence in the number, each digit is weighted.
For example:
        1358 =    1 x 103 + 3 x 102 + 5 x 101 + 8 x 100
        13.58 = 1 x 101 + 3 x 100 + 5 x 10-1 + 8 x 10-2
    Few examples of positional number system are
        decimal number system
        Binary number system (Base 2. Digits used: 0, 1)
        octal number system, ( Base 8. Digits used: 0 to 7)
        hexadecimal number system (Base 16. Digits used: 0 to 9, Letters used: A- F)
2. Non-Positional (or Non-weighted) Number System:
    Non-positional number system is also known as non-weighted number system.
    Digit value is independent of its position.
    Non-positional number system is used for shift position encodes and error detecting
     purpose.
    Example of non-weighted number system:
     Roman Code: I II III IV V VI VII VIII IX X
Number System: Binary, Octal, Decimal, Hexadecimal
    When we type some letters or words, the computer translates them in numbers as
     computers can understand only numbers.
                                                                                      2|Page
 A computer can understand the positional number system where there are only a
  few symbols called digits and these symbols represent different values depending on
  the position they occupy in the number.
 The value of each digit in a number can be determined using −
 The digit
 The position of the digit in the number
 The base of the number system (where the base is defined as the total number of
  digits available in the number system)
1. Decimal Number System
 The number system that we use in our day-to-day life is the decimal number system.
  Decimal number system has base 10 as it uses 10 digits from 0 to 9.
 In decimal number system, the successive positions to the left of the decimal point
  represent units, tens, hundreds, thousands, and so on.
 Each position represents a specific power of the base (10).
 For example, the decimal number 1234 consists of the digit 4 in the unit’s position, 3
  in the tens position, 2 in the hundreds position, and 1 in the thousands position.
 Its value can be written as
   (1 x 1000) + (2 x 100) + (3 x 10) + (4 x l)
   1000 + 200 + 30 + 4
   1234
 As a computer programmer or an IT professional, we must understand the following
  number systems which are frequently used in computers.
1.Binary Number System
      Characteristics of the binary number system are as follows −
         Uses two digits, 0 and 1
         Also called as base 2 number system
   Ex: Binary Number: (10101)2
   Calculating Decimal Equivalent –
 Binary Number                         Decimal Number
     (10101)2        ((1 x 24) + (0 x 23) + (1 x 22) + (0 x 21) + (1 x 20))10
                                                                                3|Page
   (10101)2        (16 + 0 + 4 + 0 + 1)10
   (10101)2        (21)10
     Note − 101012 is normally written as 10101.
2. Octal Number System
     Characteristics of the octal number system are as follows −
     Uses eight digits, 0,1,2,3,4,5,6,7
     Also called as base 8 number system
  Example
  Octal Number:(129570)8
  Calculating Decimal Equivalent −
   Octal Number                       Decimal Number
      (12570)8      ((1 x 84) + (2 x 83) + (5 x 82) + (7 x 81) + (0 x 80))10
      (12570)8      (4096 + 1024 + 320 + 56 + 0)10
      (12570)8      (5496)10
  Note − 125708 is normally written as 12570.
3. Hexadecimal Number System
  Characteristics of hexadecimal number system are as follows −
       Uses 10 digits and 6 letters, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
      Letters represent the numbers starting from 10. A = 10. B = 11, C = 12, D = 13, E =
        14, F = 15
      Also called as base 16 number system
     Example:
     Hexadecimal Number: (19FDE)16
     Calculating Decimal Equivalent –
     Hexa Decimal Number                                    Decimal Number
              (19FDE)16            ((1 x 164) + (9 x 163) + (F x 162) + (D x 161) + (E x 160))
              (19FDE)16            ((1 x 164) + (9 x 163) + (15 x 162) + (13 x 161) + (14 x 160))
                                                                                                    4|Page
                   (19FDE)16         (65536+ 36864 + 3840 + 208 + 14)10
                   (19FDE)16         (106462)10
       Note – (19FDE)16 is normally written as 19FDE.
Number Conversion:
There are many methods or techniques which can be used to convert numbers from one
base to another.
         Decimal to Binary                                      Binary to Decimal
Decimal Number: (29)10                    Binary Number: (11101)2
Calculating Binary Equivalent −           Calculating Decimal Equivalent −
 Division Quotient Remainder                  Binary                    Decimal Number
   by 2                                      Number
  29 / 2    14        1                      (11101)2       ((1 x 24) + (1 x 23) + (1 x 22) + (0 x 21) +
  14 / 2     7        0                                     (1 x 20))10
   7/2       3        1                      (11101)2       (16 + 8 + 4 + 0 + 1)10
   3/2       1        1                      (11101)2       (29)10
   1/2       0        1                   Binary Number: (11101)2 = Decimal Number: (29)10
Decimal Number: 2910 = Binary
Number: (11101)2.
              Decimal to Octal                                    Octal to Decimal
Decimal number (100)10
                                                   Convert Octal number (144)8 to a Decimal
To convert decimal numbers to octal numbers,
we need to divide 100 by the octal base number     number.
i.e. 8.                                            (144)8 =      (1 × 82 ) + (4 × 81 )+ (4 × 80 )
                                                   (144)8 =      (1x64) + (4x8 ) + (4x1)
Division by 8 Quotient Remainder                   (144)8   =     64 + 32          +    4
100/8         12       4
                                                   (144)8   =     100
12/8           1           4
1/8           0            1                       Therefore, (144)8 = (100)10
Therefore, (100)10 = (144)8
                                                                                                    5|Page
             Decimal to Hexa decimal                      Hexa decimal to Decimal
 Convert the (740)10 decimal to hexadecimal      Convert (2E4)16 to decimal number
 number.
  Division     quotient   Remainder in           (2E4) 16 = (2x 162) +(14 x161 ) + (4x 160)
  Fact                    Hexadecimal
  740 /16      46         4                      (2E4) 16 = (2x 256) + (14 x 16) + (4x1)
  46 / 16      2          14 = E                 (2E4) 16 = 512       +    224    +    4
                          (14 is represented     (2E4) 16 = (740)10
                          by ‘E’ in
                          hexadecimal
                          system)
  2 / 16       0          2
 Now, write the remainders from bottom to
 top (in the reverse order). (740)10 = (2E4)16
Binary Arithmetic:
    Binary arithmetic is essential part of all the digital computers and many other digital
     systems.
Binary Addition
There are four rules of binary addition.
                                                                                              6|Page
In fourth case, a binary addition is creating a sum of (1 + 1 = 10) i.e. 0 is written in the given
column and a carry of 1 over to the next column.
Example − Addition
Binary Subtraction
Subtraction and borrow, these two words will be used very frequently for the binary
subtraction. There are four rules of binary subtraction.
Example − Subtraction
Binary Multiplication
Binary multiplication is similar to decimal multiplication. It is simpler than decimal
multiplication because only 0s and 1s are involved. There are four rules of binary
multiplication.
Example − Multiplication
                                                                                         7|Page
Binary Division
Binary division is similar to decimal division. It is called as the long division procedure.
Example – Division
Primary Vs Secondary Storage:
    A memory is just like a human brain.
    It is used to store data and instructions.
    Computer memory is the storage space in the computer, where data is to be
     processed and instructions required for processing are stored.
    The memory is divided into large number of small parts called cells.
    Each location or cell has a unique address
                                                                                               8|Page
Comparison Between Primary and Secondary Memories
   1. Primary memory is the computer’s main memory and stores data temporarily.
   2. Secondary memory is external memory and saves data permanently.
   3. Data stored in primary memory can be directly accessed by the CPU, which cannot be
      accessed in secondary memory.
   4. Primary memory is lost during a power outage, while secondary memory saves the
      data.
   5. Primary memory is volatile, while secondary memory is non-volatile.
   6. Primary memory is stored on semiconductor chips, while secondary memory is
      stored on external hardware devices.
   7. Primary memory is classified into cache memory and random-access memory, while
      secondary memory has no such categories.
   8. Primary memory is faster than secondary memory.
   9. Primary memory uses the computer’s current data, while secondary memory can
      save data in various formats that can be accessed at any time.
Data storage & retrieval methods.
Data storage and retrieval methods can be broadly classified into two categories:
      Local storage: This involves storing data on a device that is physically connected to
       the computer or device that is accessing the data. Common local storage devices
       include hard drives, solid-state drives (SSDs), and optical drives (CDs, DVDs, and Blu-
       rays).
      Remote storage: This involves storing data on a device that is not physically
       connected to the computer or device that is accessing the data. Common remote
       storage methods include cloud computing and network-attached storage (NAS).
Local storage methods
      Hard drives: Hard drives are the most common type of local storage device. They are
       relatively inexpensive and have a large storage capacity. However, hard drives can be
       slow and noisy.
      Solid-state drives (SSDs): SSDs are faster and more durable than hard drives, but
       they are also more expensive. SSDs are a good choice for applications that require
       fast data access, such as gaming and video editing.
                                                                                       9|Page
      Optical drives: Optical drives are used to store data on CDs, DVDs, and Blu-rays.
       Optical drives are relatively slow and have a limited storage capacity, but they are
       portable and can be used to share data with others.
Remote storage methods
      Cloud computing: Cloud computing is a service that allows users to store and access
       data over the internet. Cloud computing offers a number of advantages over local
       storage, including scalability, accessibility, and security. However, cloud computing
       can be more expensive than local storage, and there may be concerns about data
       privacy and security.
      Network-attached storage (NAS): NAS is a storage device that is connected to a
       network. NAS devices can be used to share data between multiple computers on the
       network. NAS devices are a good choice for applications that require centralized data
       storage and sharing.
Data retrieval methods
Once data has been stored, it needs to be able to be retrieved efficiently. Some of the most
common data retrieval methods include:
      File systems: File systems are used to organize data on storage devices. They allow
       users to create, delete, and modify files, and to move files between different storage
       devices.
      Databases: Databases are used to store structured data in a way that makes it easy
       to retrieve and analyse. Databases use a variety of techniques to index and organize
       data, which allows users to quickly and easily find the data they need.
      Search engines: Search engines are used to search for data on the internet. They
       index websites and other online content, and they allow users to search for specific
       keywords or phrases.
      Data mining: Data mining is a process of extracting knowledge from large amounts of
       data. It can be used to identify trends, patterns, and relationships in data.
                                                                                     10 | P a g e
Primary Storage: - RAM, ROM, PROM, EPROM, EEPROM:
  Primary storage (also known as main memory) is the component of the computer
    that holds data, programs and instructions that are currently in use.
  Primary storage is located on the motherboard. As a result, data can be read from
    and written to primary storage extremely quickly.
  This gives the processor fast access to the data and instructions that the primary
    storage holds.
  There are two types of primary storage:
 1. Random access memory (RAM)
 2. Read Only Memory (ROM)
  RAM:
  RAM (Random Access Memory) is the internal memory of the CPU for storing data,
   program, and program result.
  It is a read/write memory which stores data until
   the machine is working.
  As soon as the machine is switched off, data is
   erased.
  Data in the RAM can be accessed randomly but it is
   very expensive.
                                                                               11 | P a g e
   RAM is volatile, i.e., data stored in it is lost when we switch off the computer or if
    there is a power failure.
   Hence, a backup Uninterruptible Power System (UPS) is often used with computers.
    RAM is small, both in terms of its physical size and in the amount of data it can hold.
   RAM is of two types −
  1. Static RAM (SRAM)
  2. Dynamic RAM (DRAM)
 ROM
   ROM stands for Read Only Memory.
   The memory from which we can only read but
    cannot write on it.
   This type of memory is non-volatile.
   The information is stored permanently in such
    memories during manufacture.
   A ROM stores such instructions that are required
    to start a computer.
   This operation is referred to as bootstrap.
   ROM chips are not only used in the computer but
    also in other electronic items like washing machine and microwave oven.
PROM: (Programmable Read-Only Memory)
   It is a chip on which data can be written only once.
    Once a program has been written onto a PROM, it
    remains there forever.
   The difference between a PROM and a ROM
    (read-only memory) is that a PROM is
    manufactured as blank memory, whereas a ROM
    is programmed during the manufacturing process.
   To write data onto a PROM chip, you need a
    special device called a PROM programmer or
    PROM burner.
EPROM: (Erasable Programmable Read-Only Memory)
   EPROM is a special type of memory that retains its
    contents until it is exposed to ultraviolet light.
   The ultraviolet light clears its contents, making it
    possible to reprogram the memory.
                                                                                   12 | P a g e
    To write to and erase an EPROM, you need a special device called a PROM
     programmer or PROM burner.
EEPROM: (Electrically erasable programmable read-only
memory)
    EEPROM is a special type of PROM that can be
     erased by exposing it to an electrical charge.
    Like other types of PROMS, EEPROM retains its
     contents even when the power is turned off.
Secondary Storage:
    Secondary storage is a memory that is stored external to the computer.
    It is mainly used for the permanent and long-term storage of programs and data.
    Hard Disk, CD, DVD, Pen/Flash drive, SSD, etc, are examples of secondary storage.
1. Magnetic Tapes:
    In magnetic tape only one side of the ribbon is used
     for storing data.
    It is sequential memory which contains thin plastic
     ribbon to store data and coated by magnetic oxide.
    Data read/write speed is slower because of
     sequential access.
    It is highly reliable which requires magnetic tape
     drive writing and reading data.
2. Magnetic Disks.
    A magnetic disk is a type of secondary memory.
    It is used to store various programs and files.
    Magnetic disks are less expensive than RAM and can store large amount of data, but
     the data access rate slower than main memory.
    Data can be modified or can be deleted easily in the magnetic disk memory.
                                                                                 13 | P a g e
    It also allows random access to data.
3. Cartridge tape:
    A tape cartridge is a storage device that
     contains a spool of magnetic tape used to
     store different kinds of data, from corporate
     data to audio and video files.
    Each cartridge is designed to fit into a
     compatible audio/video recorder system or
     computer system.
4. hard disks:
    A computer hard disk drive (HDD) is non-volatile data
     storage device.
    All computers need a storage device, and HDD are
     just one example of a type of storage device.
    Hard disks are usually installed inside desk-top
     computers.
    Most basic hard drives consist of several disk platters
     -- a circular disk made of either aluminium, glass or
     ceramic -- that are positioned around a spindle inside
     a sealed chamber.
5. Floppy disks:
    A floppy disk is a magnetic storage medium for
     computer systems.
    The floppy disk is composed of a thin, flexible
     magnetic disk sealed in a square plastic carrier.
                                                               14 | P a g e
    In order to read and write data from a floppy disk, a computer system must have a
     floppy disk drive (FDD).
    A floppy disk is also referred to simply as a floppy. Since
     the early days of personal computing, floppy disks were
     widely used to distribute software, transfer files, and
     create back-up copies of data.
    When hard drives were still very expensive, floppy disks
     were also used to store the operating system of a
     computer.
6. Optical Disks:
       An optical disk is any computer disk that uses optical
        storage techniques and technology to read and write
        data.
       It is a computer storage disk that stores data digitally
        and uses laser beams (transmitted from a laser head
        mounted on an optical disk drive) to read and write
        data.
       An optical disk is primarily used as a portable and
        secondary storage device.
       It can store more data than the previous generation of magnetic storage media,
        and has a relatively longer lifespan.
       Compact disks (CD), digital versatile/video disks (DVD) and Blu-ray disks are
        currently the most commonly used forms of optical disks.
          These disks are generally used to:
                Distribute software to customers
                Store large amounts of data such as music, images and videos
                Transfer data to different computers or devices
                Back up data from a local machine.
7. Compact Disks:
    Abbreviated as CD, a compact disc is a flat, round, optical storage medium invented
     by James Russell.
    The first CD was created at a Philips factory in Germany on August 17, 1982.
    The main material of the CD is plastic
    The shape of the plastic is circular and one side of the circular plastic is coated with
     the reflecting metal coating, usually aluminium.
                                                                                      15 | P a g e
8. Zip Drive:
    A Zip drive is a medium-capacity and portable magnetic
     disk storage system launched by Iomega in the mid-
     1990s.
    It was popular at the time of launch as cost per storage
     unit was lower than that of hard disks, and it could store
     a larger amount of data than a floppy disk.
    The Zip drive was capable of fast data transfer and was
     durable and reliable.
    The rise of other devices that later came to market, such
     as USB drives, were favoured over the Zip drive and Zip
     disk, and these became obsolete soon afterward.
   9.Flash Drives:
    A USB flash drive is a device used for data storage that includes a flash memory and an
integrated Universal Serial Bus (USB) interface.
    Most USB flash drives are removable and rewritable.
    Physically, they are small, durable and reliable.
    The larger their storage space, the faster they tend to
     operate.
    USB flash drives are mechanically very robust because
     there are no moving parts.
    They derive the power to operate from the device to
     which they are connected (typically a computer) via the
     USB port.
                                                                                   16 | P a g e