I1100 Computer Science: Number Systems

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which of the following best describes a number system?

  • A method of counting physical objects.
  • A system for organizing data in a computer.
  • A set of rules for mathematical operations.
  • A way to represent numbers using distinct symbols. (correct)

Why is it necessary to repeat digits in a number system?

  • To increase the accuracy of calculations.
  • To ensure compatibility between different computer systems.
  • To represent larger numbers with a limited set of symbols. (correct)
  • To simplify complex mathematical formulas.

What is a key characteristic of positional number systems?

  • They are not used in modern computing.
  • They can only represent whole numbers.
  • The position of a symbol determines its value within the number. (correct)
  • The value of a symbol is constant regardless of its position.

Which of the following is an example of a positional number system?

<p>Decimal system. (A)</p> Signup and view all the answers

What is the base of the decimal number system?

<p>10 (A)</p> Signup and view all the answers

What symbols are used to represent numbers in the decimal system?

<p>0 through 9 (D)</p> Signup and view all the answers

What is the value of the place farthest to the right of the decimal point?

<p>$10^{-1}$ (A)</p> Signup and view all the answers

In the binary system, what does the term 'bit' refer to?

<p>A single binary digit (0 or 1). (A)</p> Signup and view all the answers

Why is the binary system fundamental to computers?

<p>Computers are made of electronic switches that have two states: on/off. (D)</p> Signup and view all the answers

What is the base of the binary number system?

<p>2 (C)</p> Signup and view all the answers

What is the maximum value that can be represented by a 4-bit binary number?

<p>15 (A)</p> Signup and view all the answers

Which set of symbols are used in the hexadecimal number system?

<p>0-9 and A-F (A)</p> Signup and view all the answers

What is the decimal equivalent of the hexadecimal digit 'A'?

<p>10 (B)</p> Signup and view all the answers

In which scenario is the hexadecimal system most useful?

<p>Representing large binary numbers in a more compact form. (B)</p> Signup and view all the answers

Which symbols are used to represent numbers in the octal system?

<p>0 through 7 (C)</p> Signup and view all the answers

In number systems, what is the primary purpose of conversion?

<p>To represent the same number in a different base. (A)</p> Signup and view all the answers

What is the first step in converting a number from base b to decimal?

<p>Multiply each digit with it's place value. (A)</p> Signup and view all the answers

What mathematical operation is used repeatedly when converting a decimal integer to another base?

<p>Remainder division (D)</p> Signup and view all the answers

What is the role of 'remainders' when converting an integer decimal to another base?

<p>They are concatenated to form the converted number. (D)</p> Signup and view all the answers

In the binary-hexadecimal conversion, how many binary bits correspond to one hexadecimal digit?

<p>4 (D)</p> Signup and view all the answers

In the binary-octal conversion, how many binary bits correspond to one octal digit?

<p>3 (B)</p> Signup and view all the answers

Which of the following describes a non-positional number system?

<p>The value of a symbol is the same regardless of its position. (B)</p> Signup and view all the answers

With respect to the roman numeral system, what happens when a symbol of smaller value is placed after a symbol with equal or larger value?

<p>The values are added. (C)</p> Signup and view all the answers

What does 'III' represent in Roman numerals?

<p>3 (D)</p> Signup and view all the answers

Convert (110101)$_2$ to decimal.

<p>53 (B)</p> Signup and view all the answers

Convert (A2)$_{16}$ to decimal

<p>162 (D)</p> Signup and view all the answers

Convert (57)$_8$ to decimal.

<p>47 (A)</p> Signup and view all the answers

Convert 27 to binary.

<p>(11011)$_2$ (B)</p> Signup and view all the answers

Convert 88 to hexadecimal.

<p>(58)$_{16}$ (B)</p> Signup and view all the answers

Convert 67 to octal.

<p>(103)$_8$ (C)</p> Signup and view all the answers

What is the decimal equivalent of (101.11)$_2$?

<p>5.75 (A)</p> Signup and view all the answers

What is the decimal equivalent of (1A.2)$_{16}$?

<p>26.125 (C)</p> Signup and view all the answers

Considering only the integer part, convert 126 to hexadecimal.

<p>(7E)$_{16}$ (B)</p> Signup and view all the answers

What would be decimal number 178.6 expressed in hexadecimal?

<p>(B2.9)$_{16}$ (B)</p> Signup and view all the answers

Convert binary 101110010 to octal.

<p>(562)$_8$ (B)</p> Signup and view all the answers

Convert binary 10011100010 to hexadecimal.

<p>(4E2)$_{16}$ (B)</p> Signup and view all the answers

Flashcards

Number System

How a number can be represented using distinct symbols.

Positional Number System

A number system where the position of a symbol determines its value.

Decimal System

Base-10 number system, using digits 0-9.

Binary System

Base-2 number system, using digits 0 and 1.

Signup and view all the flashcards

Bit

A digit in the binary system.

Signup and view all the flashcards

Hexadecimal System

Base-16 number system, using digits 0-9 and letters A-F.

Signup and view all the flashcards

Hexadecimal Digit

A digit in the hexacecimal system.

Signup and view all the flashcards

Octal System

Base-8 number system, using digits 0-7.

Signup and view all the flashcards

Octal Digit

A digit in the octal system.

Signup and view all the flashcards

Non-positional number system

A number system where the position of symbols doesn't affect its value.

Signup and view all the flashcards

Roman Numerals

A system with symbols representing fixed values.

Signup and view all the flashcards

Base b to Decimal Conversion

Multiply each digit by its "place value" in the origin system and add

Signup and view all the flashcards

Converting to base b

Convert to decimal any base integer with repetitive division.

Signup and view all the flashcards

Binary to Hexadecimal

Bits to Hexadecimal conversion uses how many binary digits?

Signup and view all the flashcards

Binary to Octal

Binary to Octal conversion used how many binary digits?

Signup and view all the flashcards

Study Notes

  • The lecture is titled I1100, Introduction to Computer Science, Semester 1, Academic Year 2023/2024, with 3 credits for 30 hours.
  • Computer architecture and number systems will be covered in the lecture.

Number Systems Outline

  • Definitions

Positional Number Systems

  • Decimal system

  • Binary system

  • Hexadecimal system

  • Octal system

  • Comparison of numbers in the four systems

  • Nonpositional number systems

  • One coin has 2 possibilities, heads or tails, or 0 or 1.

  • Two coins have 4 possibilities.

  • Three coins have 222=8 possibilities.

  • Four coins have 2^4=16 possibilities.

Introduction to Number Systems

  • A number system defines how a number is represented using distinct symbols.
  • A number can be represented differently in different systems
  • Example: (2A)16 = (52)8 = (42)10
  • Characters are used to create words, but the number of symbols is limited, so repetition and combination are crucial to create words. There are a limited number of digits to show the number
  • Digits need to be repeated.
  • Number systems are divided into 2 categories: positional and non-positional.

Positional Number Systems

  • In positional number systems, the position a symbol occupies in the number determines its value.
  • A number in this system can be represented as ±(Sk-1... S2S1S0 . S-1S-2… S-l)b
  • Where b is the base.

Decimal System (Base 10)

  • There are 10 symbols to represent a number: S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
  • The plus sign (+) can indicate the number's positivity, while the minus sign (-) indicates the number's negativity.
  • Signs are not stored in computer.
  • Real numbers in a decimal system are represented as: ±(Sk-1... S2S1S0 . S-1S-2 … S-l) 10
  • The value of an integer (a number with no fractional part) is: n = ±Sk−1 × 10k−1 + ... + S2 × 102 + S1 × 101 + S0 × 10°.
  • An example of place values are 274 = 2x10^2 + 7x10^1 + 4x10^0
  • Example decimal number 15.2 = 1x10^1 + 5x10^0 + 2x10^-1

Binary System (Base 2)

  • The word 'binary' is derived from the Latin root 'bini' (or two by two).
  • The system has only 2 symbols: S = {0, 1}
  • Symbols are referred to binary digits or bits.
  • Data and programs are stored in the computer using a string of bits instead of the other systems because computers have electronic switches with 2 states: on and off.
  • We can represent an integer as ±(Sk-1... S2S1S0)2
  • The value of an integer (a number with no fractional part) is found using the formula n = ±Sk-1 × 2k-1 + ... + S2 × 2² + S1 × 2¹ + S0 × 2⁰..
  • An real number with fractional part is also familiar represented by ±(Sk-1 ... S2 S1 So . S−1S−2… S−l)2
  • Real number example: (101.11)₂ equals 5.75 in decimal = 1x4 + 0x2 + 1x1 + 1 x 2^-1 + 1 x 2^-2 = 4 + 0 + 1 + 0.5 + 0.25 = 5.75
  • Example: (11001)₂ in binary equals 25 in decimal. n= 1 x 2^4 + 1 x 2^3 + 0 x 2^2 + 0 x 2^1 + 1 x 2^0 = 16 + 8 + 0 + 0 + 1
  • The maximum value of a binary integer with k digits is when all digits equal to 1 where nmax=2k-1
  • if k = 5, n=(11111)2 = 2^5-1=(31)10

Hexadecimal System (Base 16)

  • Binary system is used in computers, but it is inconvenient for representing numbers outside the computer while hex is.
  • There's an obvious relation between binary and hexadecimal systems (as well as with the octal system).
  • There are 16 symbols with S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
  • A, B, C, D, E, F are equivalent to 10, 11, 12, 13, 14, and 15 respectively.
  • Symbols are known as hexadecimal digits.
  • An integer can be represented as ±(Sk-1... S2S1S0)16.
  • The value of the integer is found with n = ±Sk−1 × 16k−1 + ... + S2 × 16² + S1 × 16¹ + S0 × 16⁰.
  • For example, (2AE)16 in hexadecimal translates to 686 in decimal, i.e., 2 x 16^2 + 10 x 16^1 + 14 x 16^0.
  • The maximum value of an integer of hex is n^max = 16k-1.
  • For example, if k = 5, n=16^5-1=(1048 575)10
  • Representing real numbers in hexadecimal is not common.

Octal System (Base 8)

  • Devised to show the equivalent of the binary system outside the computer.
  • There are 8 symbols: S = {0, 1, 2, 3, 4, 5, 6, 7}
  • The symbols are referred to as octal digits.
  • An integer is represented as ±(Sk-1... S2S1S0)8.
  • The value of an integer is calculated as n = ±Sk−1 × 8k−1 + … + S2 × 8² + S1 × 8¹ + S0 × 8⁰
  • Example: (1256)₈ in octal is the equivalent to 686 in decimal.
  • The maximum value of an octal integer with k digits is equal to nmax=8^k−1
  • Example: if k = 5, n=8^5-1=(32767)10
  • Representing real numbers in octal is not common.

Summary of Four Positional Systems

  • Decimal: base 10, symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, Example: 2345.56
  • Binary: base 2, symbols 0, 1, Example: (1001.11)₂
  • Octal: base 8, symbols 0, 1, 2, 3, 4, 5, 6, 7, Example: (156.23)₈
  • Hexadecimal: base 16, symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Example: (A2C.A1)16

Conversion

  • Conversion to an equivalent number is possible in another system.
  • Conversion from any base to decimal and from decimal to any base will be shown.
  • Conversion from binary to hexadecimal or octal and vice versa will be shown.

Conversion from Base B to Decimal

  • Multiply each digit with its place value in the source system and add the results to get the number in the decimal system.
  • For Example
  • Convert the binary number (110.11)₂ to decimal. (110.11)2 = 6.75
  • Convert the hexadecimal number (1A.23)16 to decimal. (1A.23)16 ≈ 26.137
  • Convert the octal number (23.17)₈ to decimal. (23.17) ≈ 19.234

Conversion from Decimal to Base B

  • We can convert a decimal number to its equivalent in any base need 2 procedures: one for the integral part, and one for the fractional part.
  • Converting the integral part is done by repetitive division.
  • Converting the fractional part is done by repetitive multiplication.
  • To convert 35 in decimal to binary (base 2), divide by 2 repeatedly to get the result 35 = (100011)₂
  • To convert 126 in decimal to octal, divide by 8 repeatedly to get the result 126= (176)₈
  • To convert 126 in decimal to hexadecimal, divide to to get the result 126= (7E)₁₆
  • Convert the decimal number 0.625 to binary:
      1. 625 = (0.101)10
  • Convert the decimal number 0.634 to octal (with a maximum of 4 digits):
      1. 634= (0.5044)8
  • Convert the decimal number 178.6 to hexadecimal:
      1. 625= (B2.9)16

Number of Digits

  • In a base b, the number of digits of an integer are found using k = [log♭ N]
  • means the smallest integer greater than or equal to x
  • Find the required number of bits in the decimal number 234 in all four systems
    • In decimal k = [log₁₀ 234] = [2.37] = 3
    • In binary k = [log₂ 234] = [7.8] = 8 (because 234=(11101010)₂)
    • In octal k = [log₈ 234] = [2.62] = 3 (because 234=(352)₈)
    • In hexadecimal k = [log₁₆ 234] = [1.96] = 2 (because 234=(EA)₁₆)

Binary – Hexadecimal Conversion

  • Four bits in binary are one digit in hexadecimal.
  • To show the hexadecimal of the binary number (10011100010)2, arrange the number in 4-bit patterns, left to right. The leftmost patter can have 1 to 4 bits. Change the numbers to hexadecimal. As a result (100 1110 0010)2 = (4E2)16.
  • To find the binary equivalent of (24C)16, convert each digit to 4-bit patterns. As a result, the result of (0010 0100 1100)2.

Binary – Octal Conversion

  • Three bits in binary is one octal digit.
  • To show the octal equivalent of the binary number (101110010)2, arrange the number in 3-bit patterns, left to right.

Hexadecimal – Binary – Octal Conversion

  • 3 bits in binary converts to octal digits.
  • For example binary 1 00 001 001 110 can be split as 4 1 1 6 and 8 1 E becomes 1 000 001 110

Nonpositional Number Systems

  • Nonpositional number systems are not used in computers, and use a limited number of symbols in which each symbol has a value
  • The position a symbol occupies in the number normally bears no relation to its value

Nonpositional Number Systems: Roman Numerals

  • In Roman Numerals S={I, V, X, L, C, D, M}
  • Value is 1,5,10,50,100,500 and 1000 respictively
  • When a symbol with smaller value is placed after a symbol having an equal or larger value, the values are added.
  • Example: III → 1+1+1 = 3
  • When a symbol with smaller value is placed before a symbol having a larger value, the smaller value is subtracted from the larger one.
  • Example: IV → 5-1 = 4
  • A symbol S₁ cannot come before another symbol S₂ if S₁≤10* S₂ Example: I or V cannot come before C.
  • Examples
    • VIII →5+1+1+1=8
    • XVIII →10+5+1+1+1=18
    • XIX →10+(10-1)=19
    • LXXII →50+10+10+1+1=72
    • CI →100+1=101
    • MMVII →1000+1000+5+1+1=2007
    • MDC →1000+500+100=1600

Review Questions

  1. What is a number system?
  2. What is a binary system and what is its' base?
  3. How many bits in the binary system are represented by one digit in the hexadecimal system?
  4. How many bits in the binary system are represented by one digit in the octal system?

Multiple Choice Questions

  1. What is the base of the hexadecimal number system?
  2. When converting a decimal integer to base b, do we repeatedly divide or multiply by b?
  3. When converting a decimal fraction to base b, do we repeatedly divide or multiply by b?
  4. Which of the following representations is erroneous?
    • a. (10111)₂, b. (349)₈, c. (3AB)₁₆, d. 256
  5. Which of the following representations is erroneous?
    • a. (10211), b. (342)₈, c. (EEE)₁₆, d. 145
  6. Which of the following representations is erroneous?
    • a. (111)₂, b. (346)₈,c. (EEG)₁₆, d. 221
  7. Which of the following is equivalent to 12 in decimal? a. (1110)₂, b. (15)₈,c. (C)₁₆, d. None of the above
  8. Which of the following is equivalent to 24 in decimal? a. (11000)₂), b. (31)₈, c. (1A)₁₆, d. None of the above

Exercises

  1. Convert the binary number (011110.01)₂ to decimal.
  2. Convert the hexadecimal number (35E.E1)₁₆ to decimal.
  3. Convert the octal number (21.11)₈ to decimal.
  4. Convert the decimal number 14.56 to binary.
  5. Convert the decimal number 72.8 to octal.
  6. Convert the decimal number 16.5 to hexadecimal.
  7. Convert the octal number (13.7)₈ to hexadecimal.
  8. Convert the hexadecimal number (ABC.D)₁₆ to octal.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Sistemas de Numeración en Computación
5 questions
Computer Number System Basics
13 questions
cos(5)
41 questions

cos(5)

FruitfulMesa avatar
FruitfulMesa
Use Quizgecko on...
Browser
Browser