Podcast
Questions and Answers
Which of the following best describes a number system?
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?
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?
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?
Which of the following is an example of a positional number system?
What is the base of the decimal number system?
What is the base of the decimal number system?
What symbols are used to represent numbers in the decimal system?
What symbols are used to represent numbers in the decimal system?
What is the value of the place farthest to the right of the decimal point?
What is the value of the place farthest to the right of the decimal point?
In the binary system, what does the term 'bit' refer to?
In the binary system, what does the term 'bit' refer to?
Why is the binary system fundamental to computers?
Why is the binary system fundamental to computers?
What is the base of the binary number system?
What is the base of the binary number system?
What is the maximum value that can be represented by a 4-bit binary number?
What is the maximum value that can be represented by a 4-bit binary number?
Which set of symbols are used in the hexadecimal number system?
Which set of symbols are used in the hexadecimal number system?
What is the decimal equivalent of the hexadecimal digit 'A'?
What is the decimal equivalent of the hexadecimal digit 'A'?
In which scenario is the hexadecimal system most useful?
In which scenario is the hexadecimal system most useful?
Which symbols are used to represent numbers in the octal system?
Which symbols are used to represent numbers in the octal system?
In number systems, what is the primary purpose of conversion?
In number systems, what is the primary purpose of conversion?
What is the first step in converting a number from base b to decimal?
What is the first step in converting a number from base b to decimal?
What mathematical operation is used repeatedly when converting a decimal integer to another base?
What mathematical operation is used repeatedly when converting a decimal integer to another base?
What is the role of 'remainders' when converting an integer decimal to another base?
What is the role of 'remainders' when converting an integer decimal to another base?
In the binary-hexadecimal conversion, how many binary bits correspond to one hexadecimal digit?
In the binary-hexadecimal conversion, how many binary bits correspond to one hexadecimal digit?
In the binary-octal conversion, how many binary bits correspond to one octal digit?
In the binary-octal conversion, how many binary bits correspond to one octal digit?
Which of the following describes a non-positional number system?
Which of the following describes a non-positional number system?
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?
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?
What does 'III' represent in Roman numerals?
What does 'III' represent in Roman numerals?
Convert (110101)$_2$ to decimal.
Convert (110101)$_2$ to decimal.
Convert (A2)$_{16}$ to decimal
Convert (A2)$_{16}$ to decimal
Convert (57)$_8$ to decimal.
Convert (57)$_8$ to decimal.
Convert 27 to binary.
Convert 27 to binary.
Convert 88 to hexadecimal.
Convert 88 to hexadecimal.
Convert 67 to octal.
Convert 67 to octal.
What is the decimal equivalent of (101.11)$_2$?
What is the decimal equivalent of (101.11)$_2$?
What is the decimal equivalent of (1A.2)$_{16}$?
What is the decimal equivalent of (1A.2)$_{16}$?
Considering only the integer part, convert 126 to hexadecimal.
Considering only the integer part, convert 126 to hexadecimal.
What would be decimal number 178.6 expressed in hexadecimal?
What would be decimal number 178.6 expressed in hexadecimal?
Convert binary 101110010
to octal.
Convert binary 101110010
to octal.
Convert binary 10011100010
to hexadecimal.
Convert binary 10011100010
to hexadecimal.
Flashcards
Number System
Number System
How a number can be represented using distinct symbols.
Positional Number System
Positional Number System
A number system where the position of a symbol determines its value.
Decimal System
Decimal System
Base-10 number system, using digits 0-9.
Binary System
Binary System
Signup and view all the flashcards
Bit
Bit
Signup and view all the flashcards
Hexadecimal System
Hexadecimal System
Signup and view all the flashcards
Hexadecimal Digit
Hexadecimal Digit
Signup and view all the flashcards
Octal System
Octal System
Signup and view all the flashcards
Octal Digit
Octal Digit
Signup and view all the flashcards
Non-positional number system
Non-positional number system
Signup and view all the flashcards
Roman Numerals
Roman Numerals
Signup and view all the flashcards
Base b to Decimal Conversion
Base b to Decimal Conversion
Signup and view all the flashcards
Converting to base b
Converting to base b
Signup and view all the flashcards
Binary to Hexadecimal
Binary to Hexadecimal
Signup and view all the flashcards
Binary to Octal
Binary to Octal
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:
-
- 625 = (0.101)10
-
- Convert the decimal number 0.634 to octal (with a maximum of 4 digits):
-
- 634= (0.5044)8
-
- Convert the decimal number 178.6 to hexadecimal:
-
- 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)₁₆)
- In decimal k =
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
and8 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
- What is a number system?
- What is a binary system and what is its' base?
- How many bits in the binary system are represented by one digit in the hexadecimal system?
- How many bits in the binary system are represented by one digit in the octal system?
Multiple Choice Questions
- What is the base of the hexadecimal number system?
- When converting a decimal integer to base b, do we repeatedly divide or multiply by b?
- When converting a decimal fraction to base b, do we repeatedly divide or multiply by b?
- Which of the following representations is erroneous?
- a.
(10111)₂
, b.(349)₈
, c.(3AB)₁₆
, d.256
- a.
- Which of the following representations is erroneous?
- a.
(10211)
, b.(342)₈
, c.(EEE)₁₆
, d.145
- a.
- Which of the following representations is erroneous?
- a.
(111)₂
, b.(346)₈
,c.(EEG)₁₆
, d.221
- a.
- Which of the following is equivalent to 12 in decimal?
a.
(1110)₂
, b.(15)₈
,c.(C)₁₆
, d. None of the above - Which of the following is equivalent to 24 in decimal?
a.
(11000)₂)
, b.(31)₈
, c.(1A)₁₆
, d. None of the above
Exercises
- Convert the binary number (011110.01)₂ to decimal.
- Convert the hexadecimal number (35E.E1)₁₆ to decimal.
- Convert the octal number (21.11)₈ to decimal.
- Convert the decimal number 14.56 to binary.
- Convert the decimal number 72.8 to octal.
- Convert the decimal number 16.5 to hexadecimal.
- Convert the octal number (13.7)₈ to hexadecimal.
- 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.