Week - 01, 02, 03 Bits-n-Pieces Chapter 1.ppt

TALHARIAZPERSOTA 16 views 37 slides May 19, 2024
Slide 1
Slide 1 of 37
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37

About This Presentation

Information system lectures


Slide Content

Chapter 0 1
Numbers & Logic
Bits & Pieces

Chapter 0 2
Base 10 example
•Decimal Number 9 70 1
•Place 4 3 2 1
•Place -1 3 2 1 0
•10
(place -1)
10
3
10
2
10
1
10
0
•===============================
• = 9*1000 + 7*100 + 0*10 + 1*1
• = 9701

Chapter 0 3
Numeric Values
–The numeric value of a set of digits is
determined as:
•The sum of the products of each digit and its
corresponding place value,
•where the place value is the numeric-base raised to
the place -1.

Chapter 0 4
Base 2 example
•Binary Number 0 1 0 1
•2
(place -1)
2
3
2
2
2
1
2
0
•===============================
• = 0*8 + 1*4 + 0*2 + 1*1
• = 5

Chapter 0 5
A general example
Base n
•Binary Number 0 1 0 1
•n
(place -1)
n
3
n
2
n
1
n
0
•===============================
•0*(n* n* n) + 1*(n*n) + 0* n+ 1*1

Chapter 0 6
Commonly Used Systems
•Binary Base 2
•Octal Base 8
•Decimal Base 10
•Hexadecimal Base 16

Chapter 0 7
Legal Digits
•What are the legal digits?
•Start at zero and stop at the base -1
•Binary 0, 1
•Octal 0, 1, 2, 3, 4, 5, 6, 7
•Decimal 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
•Hex 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

Chapter 0 8
What is the decimal value of?
•10101 base 2
•10101 base 8
•10101 base 10
•10101 base 16

Chapter 0 9
•0000 00 00 0
•0001 01 01 1
•0010 02 02 2
•0011 03 03 3
•0100 04 04 4
•0101 05 05 5
•0110 06 06 6
•0111 07 07 7
•1000 10 08 8
•1001 11 09 9
•1010 12 10 A
•1011 13 11 B
•1100 14 12 C
•1101 15 13 D
•1110 16 14 E
•1111 17 15 F
•Counting in Binary,
Octal, Decimal and
Hexadecimal
•A single Hex digit
can be used to
represent the value of
four binary digits

Chapter 0 10
Hex = Binary Shorthand
•Hexadecimals are often used as a shorthand
for large binary values.
•This shorthand is useful for specifying
memory locations, e.g.
•Decimal -16,274,482
•Binary -111110000101010000110010
•Hex -F85432

Chapter 0 11
Binary to Hex
•Each Hexadecimal digit represents four
binary digits
•1111 1000 0101 0100 0011 0010
•F 8 5 4 3 2

Chapter 0 12
Binary to Octal
•Each Octal digit represents three binary
digits
•111 110 000 101 010 000 110 010
•7 6 0 5 2 0 6 2

Chapter 0 13
ASCII & EBCDIC
•American Standard Code for Information
Interchange
–ASCII @ Wikipedia
•Binary Coded Decimals
–Binary Coded Decimals
•Extended Binary Coded Decimals
–EBCDIC @ Wikipedia
•Unicode
–Unicode @ Wikipeda

Chapter 0 14

Binary Coded Decimals
•BCD takes advantage of the fact that any
one decimal numeral can be represented
by a four-bit pattern. The most obvious
way of encoding digits isNatural
BCD(NBCD), where each decimal digit is
represented by its corresponding four-bit
binary value, as shown in the following
table. This is also called "8421" encoding.
Chapter 0 15

Chapter 0 16
Boolean Logic
•A two valued logic often used in computers
and information systems.
•The only legal values in Boolean Logic are
–TRUE
–FALSE

Chapter 0 17
Logical Values
•Logical values can only be True or False
•Similar to numeric values, logical values
can be combined into logical expressions
using logical operators.
•The logical operators are:
not and or < <= = >= >

Chapter 0 18
Logical Expressions
•a logical-expression is any expression that
evaluates to False or True
•False
•True
•notlogical-expression
•logical-expression and logical-expression
•logical-expressionorlogical-expression

Chapter 0 19
Logical Expressions
are not unlike
Numerical Expressions
•A numerical-expressionis any expression that
evaluates to a legal numerical value.
•Examples of numerical expressions:
–3
–-4
–3 + 8 / 2
–(3 + 8) / 2

Chapter 0 20
Numerical Operators
•Unary operators have only one argument
–the positive and negative signs are the unary
numerical operators.
–+-
•Binary operators require two arguments
–addition, subtraction, multiplication, division,
and exponentiation are the binary operators
–+ -* / ^

Chapter 0 21
You’ve probably already used
logical expressions
•The relational operators > >= = < <=
evaluate to logical results.
•Example
–the expression 3 + 5 <= 8 -4 evaluates to a
value of False, so it is a logical expression.
–Note that here we have combined numerical
expressions with relational operators to form a
logical expression.

Chapter 0 22
Logical Operators
•Unary operators have only one argument
–not is the only unary logical operator.
–not
•Binary operators require two arguments
–conjunction and disjunction are the binary
operators
–and or

Chapter 0 23
Truth Tables
A NOTA
F T
T F
A B A ANDB
F F F
F T F
T F F
T T T
A B A ORB
F F F
F T T
T F T
T T T

Chapter 0 24
Operator Precedence
•Higher precedence evaluate first,
•Equal precedence evaluate left to right
•Parenthesis can be used to modify the order
of precedence, expressions inside
parenthesis are evaluated first.

Chapter 0 25
Operator Precedence
-(unary)
* / mod numerical operators
+ -
< = >= > <= relational operators
not
and logical operators
or

Chapter 0 26
Evaluation of Logical
Expressions
•A = True
•B = False
•Given the above evaluate the following:
•A or B => True
•A and B => False
•3 > 7 or A => TRUE
•(3 < 7) and not A => False

Chapter 0 27
Complex Logical Expression
•A = True B = False C = True D =False
•A or not B and not (3 + 7 <= 10 / 2) or C and D

Chapter 0 28
Complex Logical Expression
•A = True B = False C = True D =False
•A or not B and not (3 + 7 <= 10 / 2) or C and D
•T or not F and not (3 + 7 <= 10 / 2) or T and F

Chapter 0 29
Complex Logical Expression
•A = True B = False C = True D =False
•A or not B and not (3 + 7 <= 10 / 2) or C and D
•T or not F and not (3 + 7 <= 10 / 2) or T and F
•T or not F and not ( 10 <= 5 ) or T and F
•T or not F and not ( F ) or T and F

Chapter 0 30
Complex Logical Expression
•A = True B = False C = True D =False
•A or not B and not (3 + 7 <= 10 / 2) or C and D
•T or not F and not ( F ) or T and F
•T or T and T or T and F

Chapter 0 31
Complex Logical Expression
•A = True B = False C = True D =False
•A or not B and not (3 + 7 <= 10 / 2) or C and D
•T or T and T or T and F
•T or T or F

Chapter 0 32
Complex Logical Expression
•A = True B = False C = True D =False
•A or not B and not (3 + 7 <= 10 / 2) or C and D
•T or T or F
• T or F
• T

Chapter 0 33
Normal Forms
•Conjunctive Normal Form
–A and B and C and D and E
–any false value makes the expression false
•Disjunctive Normal Form
–A or B or C or D or E
–any true value makes the expression true

Chapter 0 34
Computer Time
•millisecond 10
-3
= 1/1,000
•microsecond 10
-6
= 1/1,000,000
•nanosecond 10
-9
= 1/1,000,000,000
•picosecond 10
-12
= 1/1,000,000,000,000
•femtosecond10
-15
= 1/1,000,000,000,000,000
•Conversion of Time Units

Chapter 0 35
Computer Units
•Thousand 10
3
= 1,000
•Kilobyte2
10
= 1,024
•Million10
6
= 1,000,000
•Megabyte2
20
= 1,048,576
•Billion10
9
= 1,000,000,000
•Gigabyte2
30
= 1,073,741,824
•Trillion10
12
= 1,000,000,000,000
•Terabyte2
40
= 1,099,511,627,776

Chapter 0 36
Bigger Units
•Trillion10
12
= 1,000,000,000,000
•Terabyte2
40
= 1,099,511,627,776
•Quadrillion10
15
= 1,000,000,000,000,000
•Petabyte 2
50
= 1,125,899,906,842,624
•Quintillion 10
18
= 1,000,000,000,000,000,000
•Exabyte2
60
= 1,152,921,504,606,846,976
•Sextillion 10
21
= 1,000,000,000,000,000,000,000
•Zettabyte 2
70
= 1,180,591,620,717,411,303,424
•Septillion 10
24
= 1,000,000,000,000,000,000,000,000
•Yottabyte 2
80
= 1,208,925,819,614,629,174,706,176
•Byte Converter –File Size Calculator
•Million, Billion, Trillion

Quiz # 01
•Convert the following Number
•(1100110)
2= ()
16
•(A7)
16= ()
10
•(88)
10= ()
2
•(55)
8= ()
2
•(62)
8= ()
10
Chapter 0 37