Data Representation - Notes & Worksheet
Data Representation - Notes & Worksheet
Number systems are the technique to represent numbers in the computer system architecture,
every value that you are saving or getting into/from computer memory has a defined number
system.
Computer architecture supports following number systems.
1. Binary number system
2. Octal number system
3. Decimal number system
4. Hexadecimal (hex) number system
DECIMAL TO OTHER
1. DECIMAL TO BINARY
Decimal Number System to Other Base
To convert Number system from Decimal Number System to Any Other Base is quite
easy; you have to follow just two steps:
A) Divide the Number (Decimal Number) by the base of target base system (in which you
want to convert the number: Binary (2), octal (8) and Hexadecimal (16)).
B) Write the remainder from step 1 as a Least Signification Bit (LSB) to Step last as a Most
Significant Bit (MSB).
Decimal Number is :
(12345)10
Binary Number is
(11000000111001)2
2. DECIMAL TO OCTAL
Decimal to Octal Conversion Result
Octal Number is
(30071)8
3. DECIMAL TO HEXADECIMAL
Decimal to Hexadecimal Result
Conversion
Example 1
Example 2
Hexadecimal Number is
Decimal Number is : (725)10 (2D5)16
Convert
to its equivalent... A, B, C, D, E,
F
BINARY TO OTHER
A) Multiply the digit with 2(with place value exponent). Eventually add all the multiplication
becomes the Decimal number.
1. BINARY TO DECIMAL
2. BINARY TO OCTAL
An easy way to convert from binary to octal is to group binary digits into sets of three, starting
with the least significant (rightmost) digits.
Binary: 11100101 11 100 101
=
Octal: 0 1 2 3 4 5 6 7
3. BINARY TO HEXADECIMAL
An equally easy way to convert from binary to hexadecimal is to group binary digits into
sets of four, starting with the least significant (rightmost) digits.
Binary: 11100101 = 1110 0101
Then, look up each group in a table:
Hexadecimal: 0 1 2 3 4 5 6 7
Hexadecim 8 9 A B C D E F
al:
Hexadecimal = E 5 = E5 hex
OCTAL TO OTHER
1. OCTAL TO BINARY
Converting from octal to binary is as easy as converting from binary to octal. Simply look
up each octal digit to obtain the equivalent group of three binary digits.
Octal: 0 1 2 3 4 5 6 7
2. OCTAL TO HEXADECIMAL
When converting from octal to hexadecimal, it is often easier to first convert the octal
number into binary and then from binary into hexadecimal. For example, to convert 345
octal into hex:
(from the previous example)
Octal = 3 4 5
Drop any leading zeros or pad with leading zeros to get groups of four binary digits (bits):
Binary 011100101 = 1110 0101
Then, look up the groups in a table to convert to hexadecimal digits.
Binary: 0000 0001 0010 0011 0100 0101 011 0111
0
Hexadecimal: 0 1 2 3 4 5 6 7
Hexadecimal 8 9 A B C D E F
:
Therefore, through a two-step conversion process, octal 345 equals binary 011100101
equals hexadecimal E5.
3. OCTAL TO DECIMAL
The conversion can also be performed in the conventional mathematical way, by showing
each digit place as an increasing power of 8.
HEXADECIMAL TO OTHER
1. HEXADECIMAL TO BINARY
Converting from hexadecimal to binary is as easy as converting from binary to hexadecimal.
Simply look up each hexadecimal digit to obtain the equivalent group of four binary digits.
Hexadecimal: 0 1 2 3 4 5 6 7
Hexadecimal: 8 9 A B C D E F
Hexadecimal A 2 D E
2. HEXADECIMAL TO DECIMAL
Convert 42A.1216 into a decimal number.
Solution-
The hexadecimal number given is 4 2 A. 1 2
Positional weights 2 1 0 -1-2
The positional weights for each of the digits are written in italics below each digit.
Hence the decimal equivalent number is given as:
4× +2× + 10 × +1× +1×
= 1024 + 32 + 10 + 0.0625 + 0.00390625
=
3. HEXADECIMAL TO OCTAL
ENCODING SCHEMES
American Standard Code for Information Interchange (ASCII)
In the early 1960s, computers had no way of communicating with each other due to different
ways of representing keys of the keyboard. Hence, the need for a common standard was
realised to overcome this shortcoming. Thus, encoding scheme ASCII was developed for
standardising the character representation. ASCII is still the most commonly used coding
scheme.
Initially ASCII used 7 bits to represent characters. Recall that there are only binary digits (0
or 1). Therefore, total number of different characters on the English keyboard that can be
encoded by 7-bit ASCII code is 27 = 128. Following Table shows some printable characters
for ASCII code. But ASCII is able to encode character set of English language only.
In order to facilitate the use of Indian languages on computers, a common standard for coding
Indian scripts called ISCII was developed in India during mid 1980s.
It is an 8-bit code representation for Indian languages which means it can represent 28=256
characters. It retains all 128 ASCII codes and uses rest of the codes (128) for additional Indian
language character set. Additional codes have been assigned in the upper region (160 255)
UNICODE
There were many encoding schemes, for character sets of different languages. But they were
not able to communicate with each other, as each of them represented characters in their own
ways. Hence, text created using one encoding scheme was not recognised by another machine
using different encoding scheme.
Therefore, a standard called UNICODE has been developed to incorporate all the characters
of every written language of the world. UNICODE provides a unique number for every
character, irrespective of device (server, desktop, mobile), operating system (Linux,
Windows, iOS) or software application (different browsers, text editors, etc.). Commonly
used UNICODE encodings are UTF-8, UTF-16 and UTF-32. It is a superset of ASCII, and
the values 0 128 have the same character as in ASCII. Unicode characters for Devanagari
script
Write base values of binary, octal and hexadecimal number system.
1. Write full form of ASCII and ISCII.
2. Write the following conversions.
(i) (514)8 = (?)10 (iv) (4D9)16 = (?)10
(ii) (220)8 = (?)2 (v) (11001010)2 = (?)10
(iii) (76F)16 = (?)10 (vi) (1010111)2 = (?)10
3. Do the following conversions from decimal number to other number systems.
(i) (54)10 = (?)2 (iv) (889)10 = (?)8
(ii) (120)10 = (?)2 (v) (789)10 = (?)16
(iii) (76)10 = (?)8 (vi) (108)10 = (?)16
4. Express the following octal numbers into their equivalent decimal numbers.
(i) 145 (ii) 6760 (iii) 455 (iv) 10.75
5. Express the following decimal numbers into hexadecimal numbers.
(i) 548 (ii) 4052 (iii) 58 (iv) 100.25
6. Express the following hexadecimal numbers into equivalent decimal numbers.
(i) 4A2 (ii) 9E1A (iii) 6BD (iv) 6C.34
7. Convert the following binary numbers into octal and hexadecimal numbers.
(i) 1110001000 (ii) 110110101 (iii) 1010100 (iv) 1010.1001
8. Convert the following binary numbers into octal and hexadecimal numbers.
(i) 1110001000 (ii) 110110101 (iii) 1010100 (iv) 1010.1001
9. Write binary equivalent of the following octal numbers.
(i) 2306 (ii) 5610 (iii) 742 (iv) 65.203
10.Write binary representation of the following hexadecimal numbers.
(i) 4026 (ii) BCA1 (iii) 98E (iv) 132.45
11.How does computer understand the following text?
(hint: 7 bit ASCII code).
(i) HOTS (ii) Main (iii) CaSe
12.The hexadecimal number system uses 16 literals (0 9, A F). Write down its base
value.
13.Let X be a number system having B symbols only. Write down the base value of this
number system.
14.
values.
circuits
number systems.
UNICODE (UTF8, UTF32)
BOOLEAN LOGIC
Boolean logic refers to Boolean Algebra which values of variables are the truth values
True or False. These values have two states either on or off denoted by 0 or 1.
George Boole invented the first way of manipulating symbolic logic, which later
became known as Boolean Algebra. Because of its vast applications in switching
theory, developing basic electronic circuits, and designing digital computers, Boolean
algebra has become a vital tool in computer science.
1. NOT OPERATION:
It handles only a single variable. The operation performed by NOT is known as
complementation.
0 1
1 0
2. OR OPERATION:
It is also a binary operator that operates on two variables. The result of the OR operator
is also known as logical addition. The symbol is used for OR is plus (+).
result.
X Y X+Y
0 0 0
0 1 1
1 0 1
1 1 1
3. AND OPERATION:
It is a binary operator that operates on two variables and the result of the AND operator
is known as logical multiplication. To denote AND operator dot(.) symbol is used.
AND means that A & B. When both inputs are true then it produce true result,
otherwise false.
X Y X.Y
0 0 0
0 1 0
1 0 0
1 1 1
4. NAND OPERATION:
It stands for NOT AND that produce reverse result of AND gate.
X Y
0 0 1
0 1 1
1 0 1
1 1 0
5. NOR OPERATION:
It stands for NOT OR. It produces reverse output than the OR gate.
X Y
0 0 1
0 1 0
1 0 0
1 1 0
6. XOR OPERATION:
It produces high output if the input of 1s is odd, otherwise false.
X Y X Y
0 0 0
0 1 1
1 0 1
1 1 0
7. EX-NOR OPERATION:
X Y (X
0 0 1
0 1 0
1 0 0
1 1 1
ic Laws
De Morgan's Law:
then negated, the result is equal to the AND of the complements of the individual input
variables.
To prove this theorem we can use the truth table as given below:
A B A+B
0 0 0 1 1 1 1
0 1 1 0 1 0 0
1 0 1 0 0 1 0
1 1 1 0 0 0 0
Second De Morgan's Law states that when two or more input variables are AND'ed and
negated, then the obtained result will be equal to the OR of the complements of the individual
variables.
0 0 0 1 1 1 1
0 1 0 1 1 0 1
1 0 0 1 0 1 1
1 1 1 0 0 0 0
LEVEL-1
2.
3. Draw the equivalent logic circuit for the following Boolean Expression:
A.(B+C )
4. Name the law shown below and verify it using a truth table:
A+B.C=(A+B).(A+C)
5. Which are the universal gates ? Why are they called universal gates?
6.
Fill in the blanks and name the law :
9.
10.X.(X+Y)=X represents ____ law of Boolean relation.
Worksheet- LEVEL-2
1. Verify using truth table that X +XY =X for each X, Y in (0,1)
2. Design a logic
3. What is a truth table? What is its significance ?
4. Which are the universal gates ? Why are they called universal gates?
5. Name the following law and verify them using a truth table:
a.
b. x + y = y + x
c. x + (y + z ) = (x + y ) + z
6. Draw logical circuits for the following:
1. Y = ab + bc + ca
2.
3.
7. Which gate returns true if both inputs are similar otherwise false.
8. Which of the following gate is also known as an inverter.
9. Which of the following gate returns a true result if both inputs are true otherwise false.
10.Write logic expression for the following logic diagram:
Worksheet- LEVEL-3
2. x * y = y * x is the __________
Inputs Output
A B Y
0 0 1
0 1 0
1 0 0
1 1 0
1. How many two input AND gates and 2 input OR gates are required to realize Y=
BD+CE+AB
2. The output of an EX-NOR gate is 1. Which input combinations correct?
(i) A=1, B=0 (ii) A=0, B=1
3. Determine the values of A, B, C, and D that make the sum term equal to zero.
4. Surveying the rules for Boolean multiplication, the 0 and 1 values seem to resemble the
truth table of a very common logic gate. Which type of gate is this, and what does this
suggest about the relationship between Boolean multiplication and logic circuits?
5. There are three fundamental operations in Boolean algebra: addition, multiplication,
and inversion. Each of these operations has an equivalent logic gate function and an
equivalent relay circuit configuration. Draw the corresponding gate and ladder logic
diagrams for each:
6. A student makes a mistake somewhere in the process of simplifying the following
Boolean expression: Determine where the mistake was made, and what the proper
sequence of steps should be to simplify the original expression.
AB + A(B + C)
AB + AB + C
AB + C
7. A riddle based on Boolean logic
You are walking and arrive at a dead end with 2 doors. You must get past this, but you
are told that only one door is correct, leading you on your path and the other door is not
correct and leads to something perilous. In front of each door is a guard. One guard
always tells the truth and the other always lies. You may ask one of the guards one
question, and then you must pick your door and go through it. What question do you
ask, which door do you pick based on the answer, and why?