Plus One State Numbers System and Boolean Algebra08!04!2023-5
Plus One State Numbers System and Boolean Algebra08!04!2023-5
BOOLEAN ALGEBRA
NUMBER SYSTEM
A number system is a systematic way to represent
numbers. The number of symbols used in a number system
is called base or radix of a number system.
-
NUMBER SYSTEM CLASSIFICATION
(23470
-
Binary Number System -
A number system which uses only two symbols 0 and 1 to form a
-
number is called binary number system. Bi means two. Base of this
number system is 2. So it is also called base-2 number system. We
-
use the subscript 2 to indicate that the number is in binary.
(010)2
-
-
OCTAL Number System -
A number system which uses eight symbols 0, 1, 2, 3, 4, 5, 6 and 7
-
GGD f
-
Hexadecimal Number System -
A number system which uses 16 symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
-
- O
-
-
#F2),
-
( . 615)0
,
= (?
2 2
Lo
.
10110
↑
101
-
-
I
- 20 .
625X
!
2,
Epo
000
- - 1
,
Number conversions
=
1. Decimal to Binary(2)
-
2. Decimal to Octal Cr
-
25,0 = (1
72 z
↑
.
Good bo
!
Decimal fraction to Binary
(5) ,0
= (?
)
(11000D 25 x
0
2
.
-
-
↓
-
0 .
08X
Decimal to Octal
- es
(350
-
?.. 83
-
=
C
(3z
=
-
-
Decimal to Hexadecimal
it 16
Do =
(2 I 164-150)
0-1
[Fis
=
Binary to decimal
(1112 = C ? Do
2
= 1x22 + Wet I
= i+ 2+ 1
=
Octal to Decimal
(2 +g = (1)
,
82g/ 0
g
↑ 2)
1x8+ 2x8' +
Tx0
=
= 62 + 16 + 1 =
2)
10
Hexadecimal to Decimal
256x18
(A2D, = ( 2.)
,0
i
=
Ax(6"+ 2x16' + 1x
(2593)
=
2560 + 32 +
n =
= 6
=
Octal to Binary
421
-
521
-
008 10
(26) = (?
)
O 5
10016 110
726
2018 711/
-
↓
3011 (11010110)
-
< 100
Binary to Octal
(011( = C? )
,
L 11 I
(67)
-
Hexadecimal to Binary 84 21
8421 8321 Et En
O 08 5
--
0101 A40)
1010
1021
0110 BLID
100016
70111 C((2)
1100
20018
↑
-
Binary Addition
Rules are
0+0=0
1+0=1
0+1=1
1+1=0 carry 1
(53177 =
(32
5317
↓ 101
On I
(10101100111)
2 oo1
111
-
GOOD
= r 521
010
/ (7) 101
275 --
Binary Subtraction Rules
0-0=0
1-0=0
0-1=1 borrow 1
1-1=0
DATA REPRESENTATION
1. Representation of Numbers
2. Representation of Characters
3. Representation of Audio,Video and Image
1. REPRESENTATION OF NUMBERS
I. Representation of Integers
Ii. Representation of Floating point Numbers
-
I. Representation of integers
10111 23
Binagf --
24-1
↑
T but
0010111-
G-1
=
o - 1
-
-
Represent -105 in sign and magnitude form
1’s complement representation
In this method, first find binary equivalent of absolute value of
integer. If number of digits in binary equivalent is less than 8,
provide zero(s) at the left to make it 8-bit form. 1’s complement
of a binary number is obtained by replacing every 0 with 1 and
every 1 with 0 .
-
237
-25 in 1’s Complement form and 2's from
Eg: Represent -65
=
Bina = 1011/
8bit =
000 !
is =
(11101000)
2 =
11101000 Is
(11 0100D
T
+ 0 1 00l
-2
-
2’ s complement representation
In this method, first find binary equivalent of absolute value of
integer and write it in 8- bit form. If the number is negative it is
represented as 2’s complement of 8-bit form binary. If the
number is positive 8-bit form binary itself is the representation.
2’s complement of a binary number is calculated by adding 1 to
its 1’s complement.
Represent -38 in 2’s complement form.
Subtraction Using 1’s Complement
mantissa and the power 2 is the exponent. (In normalised floating point
notation mantissa is between 0.1 and 1). Similarly -0.0035 can be written
as -0.35x10-2, where -0.35 is mantissa and -2 is exponent
25 45.
0 . 2545XLOQ exponent
-
Mantisa
Character Representation
ASCII ~ Q
The code called ASCII (pronounced “AS-key”), which stands for
American Standard Code for Information Interchange, uses 7 bits
- - -
to represent each character in computer memory. The ASCII
-
fa
E Boolean Variable Actors -
A variable which holds true/false value known as Boolean variable .(A,B,C etc)
-
-
Boolean Expression
Meaningfull combination of boolean operators(AND,OR,NOT) , Boolean
-
Variable/operand (X,Y,Z etc) and Boolean constant (0 or 1)
-
-
Boolean Operators and Logical Gates
-
=>>
1. AND
2. OR -
3. NOT -
LOGICAL GATE
-
>
A truth table is a representation of a boolean function or expression containing all
possible combinations of input values and their results in a tabular format .
S
1. AND OPERATOR and AND Gate
AND operator is a binary operator that operates on two variables and the
-
Y=A.B
Y AB=
diesrom AB
circuit >
- .
-
Truth Table -
O-Fale
-
--
1 = +au
= AB
.
-
>
-
T - -
>
>
-
7
> ->
>
-
>
-
X
2. OR Operator and OR Gate 23 -
The OR operator is a binary operator that operates on two variables and the
- -
operation performed by OR operator is known as logical addition. The symbol
-
used for logical addition is plus (+) operator.
-
Logical Expression
D
O
Y=A+B
Logical Gate -
-
-
=>
(
Truth Table
S
false : O
T= 1
AB
=
- >
-
>
-
>
-
- -
- -
I
NOT Operator and NOT Gate -
The NOT operator is a unary operator that operates on one variable and the
--
Logical Expression
0
Y=A’ =
Logical Gate
>
-
T
Truth Table of NOT
S
A
=
=>
=>
1
UNIVERSAL GATES
=
1. NAND
2. NOR
NAND GATE
NAND Gate is an AND Gate with its output inverted by NOT gate.
.B
A
- ---
O .
--
-
O
↑
-- 7
0--7
D - - -
DOE
Or
↑
NOR Gate
NOR Gate is an OR Gate with its output inverted by NOT gate .
A+B >IB
-
T > -
1 -
- -
-
1
- -
= -
DOE
CIRCUIT DESIGNING
(A.B) + B
- -
z
E
(X+Y’) . U’
-
T
-a
#
(V’.O) + (V.O’)
---
D: +
(op
-
(A’.B’) + (K’+P)
Find dual of
1. A+0=A
2. AB+C+DG=1
3. A0+B.1=C
De Morgan’s Theorems
S
(A.B)’ = A’+B’
-
-
mon
(A+B)’ = A’ . B’ -
-
=
(ii) "the complement of sum of Boolean variables is equal to product of their
-
individual complements" and
Proof of First Law
(X+Y)’ = X’.Y’
-
=>
-
Proof of second Law
Implementation of basic gates using NAND and NOR
·
1 - 5 1) 23 ... 55
~
We
= ② ⑦
aGa + !
T
St
op
-
F
Data types and Operators
Fundamental Data types
man
-
-
~ - -
X - -
- - -
-
-
- - -
Variable 1000-
-
Variables are the names given to memory locations .
-N
D 25 -
- -
-
10001001 love 1003
A variable has three parts ; Wit
-
1. Variable Name : It is a symbolic name (identifier) given to the memory
- -
location through which the content of the location is referred to .
-
- -
2. Memory address : Every cell (or byte) in RAM will be assigned a unique
-
address to refer it. The address is also called the L-value of a variable.
- -
-
3. Content : The valuem stored in the location is called content of the
-
AFB-I
Operators operands
+
> Opea
-
-
operands.
Based on number of operands required for the operation, operators are
-
classified into three; unary, binary and ternary.
---
I
Unary Operator -
A unary operator operates on a single operand .
Eg: ++increment , - - decrement -
--
Binary Operator -
Binary operators operate on two operands .
-
-
Ternary Operator -
Ternary operator operates on three operands.
-
Eg: Conditional Operator (?:)
-
Based on the nature of the operation Operators can be classified
into
1. Arithmetic Operators -
-
2. Relational Operators
3. Logical Operators - -
4. Input/Output Operators
5. Assignment Operators -
Arithmetic Operators +, , /
-
An
E
- - -
-
- -
-
-
-
-
= -
-
-
2
Relational Operators
2
~ -Listen O
f
tor-1
-Less thamoresual to
= 0
< =
-
1235
-8885
-
-
than = Equal to
I-greater
Not Emalto
or equal to ! >
greater
,
furn
-
= -
Logical Operators
I
-
>
-
-
TT
-
-
- -
-
-FF
-
-
7 -
F
-
-
Input/Output Operators
Input Operator
get from or Extraction (>>)
--
Output Operator
Arithmetic expressions
-
Floating Point Expression
↑
Relational Expression
&
Logical expression
FFFFF FuF
-----
- -
Types of Statements in C++
---
1. Declaration Statement
It’s Syntax is :
-
int a, b c
,
,
float by
2. Assignment Statement
W a
2-
Variable = Value
Variable 1= Variable 2
ab
C
Variable = Expression a= b + (x7
3. Input Statement -
cinjadaty
-
4. Output Statement -
cant c dath
-
=
Structure of C++ Program
#include <headerfile>
using namespace identifier;
int main()
{
statements;
:
:
:
return 0;
}
Preprocessor Directive -
-
·
Header files -
Header files contain the information about functions, objects and predefined
derived data types and are available along- with compiler.
-
Concept of namespace
- >
Different identifiers are associated to a particular namespace. It is actually a
-
group name in which each item is unique in its name.
The main() function
-
Eg :
float val=0.12, b=5.234;
char k='A';
Type Modifiers
Important modifiers are signed, unsigned, long and short
-
-
Arithmetic assignment operators
↑
first
&
int > Inta
Type conversion
,
-
&
1. Implicit Type Conversion - fou
Eg:
5 / 2 * 3 + 2.5 - --
②
The evaluation steps are as follows: -
Step 1:--
5 / 2 -> 2 (Integer division)
-
Step 2: 2 * 3 -> 6 (Integer multiplication)
-
Step 3: 6 + 2.5 -> 8.5 (Floating point addition, 6 is converted into 6.0)
-
Explicit type conversion (Type casting) 1
-
Eg: Intby ,
float
by
= Giraff G + (10)b
wate a cot program to find sun o
two numbers ? ---
Sath
costreams
# include
using
namespace
Stay
int maine
E
int S, 4,b
;
Cont < "Entor
two numbers
(ing) ab
:
S
&
Saty
cont "Sun
is
"L;
retrono
,