0% found this document useful (0 votes)
13 views181 pages

Paudel Exam 2

Uploaded by

prokchorbaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views181 pages

Paudel Exam 2

Uploaded by

prokchorbaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 181

Applied Informatics (IAI VO)

Exam Details
Open Book

Allowed

• Course materials (pdf files uploaded in Teams)


• Hand written notes

Not allowed

• Search in Internet
• Using tools (e.g., ChatGPT)

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Hand Written Exam

Hard copy of questions will be provided.

Answers need to be wrriten on the provided paper. Handwriting should be clear enough to understand.

Introduction(Historical notes) will not be the part of examination.

Students will have 45 minutes to answer the questions.

Date: 20.11.2024; 14:00 – 15:15

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Introduction: Applied
Informatics (IAI VO)
Sarita Paudel
WS 2024/25
U2 Number System
.
Exercise

Decimal system

base = 10
digits = 0,1,2,3,4,5,6,7,8,9

𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟏𝟏 = ??
Index 2 1 0

Position 2 6 310 Base


Digits Radix

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise (Solution)

Decimal system

base = 10
digits = 0,1,2,3,4,5,6,7,8,9,10

𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟏𝟏
Index 2 1 0

Position 2 6 310 Base 356110 = 1 + 60 + 500 + 3000


Digits Radix 356110 = 1 × 1 + 10 × 6 + 100 × 5 + 1000 × 3
356110 = 100 × 1 + 101 × 6 + 102 × 5 + 103 × 3

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise

Octal system

base = 8
digits = 0,1,2,3,4,5,6,7

𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟖𝟖 = ??
Index 2 1 0

Position 2 6 310 Base


Digits Radix

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise (Solution)

Decimal system

base = 8
digits = 0,1,2,3,4,5,6,7,8,9,10

𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟖𝟖
Index 2 1 0

Position 2 6 310 Base 35618 = 1 + 48 + 320 + 1536


Digits Radix 35618 = 1 × 1 + 8 × 6 + 64 × 5 + 512 × 3
35618 = 80 × 1 + 81 × 6 + 82 × 5 + 83 × 3

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise

What decimal value do the following numbers have?

a) 11010111012

b) 76388

c) 𝐹𝐹𝐹𝐹16

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercse (Solution)

a) 861  512+256+64+16+8+4+12^9 + 2^8 +2^6 +2^4 +2^3 +2^2 +2^0

b) Error! (highest digit in octal is 7)

c) 3956  3840+112+4 15x256+7x16+4x1  15x16^2 + 7x16^1 +4x16^0

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Exercise

a) Which of the numbers is bigger?


3.45 × 105
9.15 × 104

b) Calculate the following: 1.75 × 103 − 7.5 × 102

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise (Solution)

a) 3.45 x 10 to the power 5 is greater (3450 > 915)

b) 1750 - 750 = 1000

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Example - addition

Base (b = 10)

55

+37

92

1) 5+7 = 12; 12 > b;

12/10 => quotient = 1, remainder = 2

2) 1+5+3 = 9; 9<b

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Example - addition

Base (b = 10) Base (b = 8)

1 11

55 55

+37 +37

92 114

1) 5+7 = 12; 12 > b; 1) 5+7 = 12; 12 > b;

12/10 => quotient = 1, remainder = 2 12/8 => quotient = 1, remainder = 4

2) 1+5+3 = 9; 9<b 2) 1+5+3 = 9;9>b;

9/8 => quotient = 1, remainder = 1


WS 2024/25 - Introduction: Applied Informatics (IAI VO)
Example - Subtraction

Base (b = 10)

-1

52

-35

17

1) 2-5 = -3; -3 < 0; 10-3 =7

2) -1+5-3 = 1; 1>0;

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Example - Subtraction

Base (b = 10) Base (b = 8)

-1 -1

52 52

-35 -35

17 15

1) 2-5 = -3; -3 < 0; 10-3 =7 1) 2-5 = -3; -3 < 0; 8-3 = 5

2) -1+5-3 = 1; 1>0; 2) -1+5-3 = 1;1>0;

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Example – convert from base 10

Convert 10 10

To base (b=2)

Divide by 2 Quotient Remainder

10/2 5 0

5/2 2 1

2/2 1 0

1/2 0 1

10 10 = 1010 2

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Example – convert from base 10
Convert 10 10

To base (b=2) To base (b=8)

Divide by 8 Quotient Remainder


Divide by 2 Quotient Remainder
10/8 1 2
10/2 5 0
1/8 0 1
5/2 2 1

2/2 1 0

1/2 0 1
10 10 = 12 8

10 10 = 1010 2

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise

Convert the following numbers in decimal system to

a) 55  base 2

b) 475  base 12

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Solution
To base (b = 12)

To base (b = 2)

Divide by 2 Quotient Remainder


Divide by 12 Quotient Remainder
55/2 27 1
475/12 39 7
27/2 13 1
39/12 3 3
13/2 6 1
3/12 0 3
6/2 3 0

3/2 1 1

1/2 0 1

475 10 = 337 12

55 10 = 110111 2

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise

Calculate the following:

a) 4425 + 3135

b) 627 − 457

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Solution
Addition base (b = 5) Subtraction base (b = 7)

111 -1

442 62

+313 -45

1310 14

1) 2+3 = 5; 5 == 5;

5/5 => quotient = 1, remainder = 0 1) 2-5 = -3; -3 < 0; 7-3 = 4

2) 1+4+1 = 6; 6>5;

6/5 =>quotient = 1, remainder = 1 2) -1+6-4 = 1;1>0;

3) 1+4+3 = 8; 8>5;

8/5=> quotient = 1, remainder = 3


WS 2024/25 - Introduction: Applied Informatics (IAI VO)
More Exercises

a) Convert 55510 into base 16.

b) Calculate 3224 − 1234 .

c) Convert 1011110100112 into octal and hexadecimal system.

d) Convert 𝐴𝐴𝐴𝐴11 into base 10.

e) Convert the following numbers into normalised notation:


784 000 000 and 0.00000000784

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Solution: Convert 55510 into base 16.

To base (b = 16)

Divide by 12 Quotient Remainder

555/16 34 B (11)

34/16 2 2

2/16 0 2

55510 = 22𝐵𝐵 16

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Solution: Calculate 3224 − 1234

Subtraction base (b = 4)

-1-1

322

-123

133

1) 2-3 = -1; -1 < 0; -1+4 = 3

2) -1+2-2 = -1<0; -1+4=3

3) -1+3-1 = 1>0

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Solution: Convert 1011110100112 into octal system

octal dual
101 111 010 011 0 000
1 001
101 = 5 2 010
3 011
111 = 7
4 100
010 = 2
5 101
011 = 3 6 110
7 111

101111010011 2 = 5723 8

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


hex dual
Solution: Convert 𝟑𝟑𝟏𝟏𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟏𝟏𝟑𝟑𝟏𝟏𝟏𝟏𝟑𝟑𝟑𝟑𝟐𝟐 into hexadecimal 0 0000
system 1 0001
2 0010
3 0011
1011 1101 0011
4 0100
5 0101
1011 = B 6 0110
1101 = D 7 0111
8 1000
0011 = 3
9 1001
A 1010
101111010011 2 = 𝐵𝐵𝐵𝐵𝐴 16 B 1011
C 1100
D 1101
E 1110
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
F 1111
Solution: Convert 𝐴𝐴𝐴𝐴11 into base 10

𝐴𝐴 6 3 11

112 111 110

121 11 1

𝐴𝐴𝐴𝐴 11 = 10 x 121 + 6 x 11+ 3 x 1


= 1210 + 66 + 3
= 1279

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Solutions

a) 22𝐵𝐵16

b) 1334

c) 57238 and 𝐵𝐵𝐵𝐵𝐴16

d) 1279

e) 7.84 × 108 and 7.84 × 10−9

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise
Convert 148

 base 10

 base 2

 base 12

 base 16

Convert 𝐴𝐴𝐴𝐴11

 base 10

 base 2

 base 12

 base 16

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


b=2 b=8 b=10 b=11 b=12 b=16
0 0 0 0 0 0
Solution: Number Systems 1 1 1 1 1 1
10 2 2 2 2 2
11 3 3 3 3 3
148  1210  11002 100 4 4 4 4 4
Division 101 5 5 5 5 5
 1012
rule
110 6 6 6 6 6
Multiplication  𝐶𝐶16
111 7 7 7 7 7
rule
1000 10 8 8 8 8
1001 11 9 9 9 9
148  0011002 = 11002 (bits rule) 1010 12 10 A A A
1011 13 11 10 B B
1100 14 12 11 10 C
𝐴𝐴𝐴𝐴11  127910  10011111112
1101 15 13 12 11 D
 8𝐴𝐴𝐹12 1110 16 14 13 12 E
 𝐹𝐹𝐹𝐹𝐹16 1111 17 15 14 13 F
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
10000 20 16 15 14 10
10001 21 17 16 15 11
U3 Numbers
Representation
.
Exercise

Calculate -28+12 as an 8-bit binary addition using one’s complement.


Convert the result back to the decimal system.

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Exercise (Solution)

Question  Calculate -28+12 as an 8-bit binary addition using one’s complement. Convert the result
back to the decimal system.

28 00011100 (using division rule)


-28 11100011 (using one’s complement)
--------------------------
12 00001100 (using division rule)
----------------------------------
11100011
+ 00001100
---------------------------
sum = 11101111 (the carry is 0, nothing to add back in)(-ve number, use one’s complement)
16 00010000 (convert binary to decimal number system using multiplication rule)

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Exercise

Calculate 31 + (-8) as an 8-bit binary addition using two’s complement.


Convert the result back to the decimal system.

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Exercise (Solution)

Question  Calculate 31 + (-8) as an 8-bit binary addition using two’s complement. Convert the
result back to the decimal system.

31 00011111 (convert to binary using division rule)


8 00001000 (convert to binary using division rule)
-8 11110111+1=11111000 (represent -8 using two’s complement (one’s complement + 1))
-----------------------------------
00011111
+ 11111000
-----------------------------------
23 00010111 (carry 1, discard) (convert to decimal number system using multiplication rule)

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Exercises

1. Convert 1.710 to a 8-bit floating point format.

2. If you are storing a number in an 8-bit format using the signed


magnitude approach, how many different numbers can you store?

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Exercise (Solution)

Question  Convert 1.710 to a 8-bit floating point format.

1. 110 = 12
.710
0.7 × 2 = 1.4 → 1
2. 0.710 = 10112 0.4 × 2 = 0.8 → 0
0.8 × 2 = 1.6 → 1
3. 1.710 = 1.10112 0.6 × 2 = 1.2 → 1
10112
4. 1.1011
. 2×2
0

5. m = 1011; n = 0; calculate bias using alternate method; maximum number can be represented by 8 bits is 7; 7%2 = 3;
consider float number, bias (k) = 3; n+k = 0+3 = 011

6. Sign bit = 0

7. Number in 8 bit = 0 011 1011

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Exercise

If you are storing a number in an 8-bit format using the signed magnitude
approach, how many different numbers can you store?

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Exercise (Solution)

Question  If you are storing a number in an 8-bit format using the signed
magnitude approach, how many different numbers can you store?

1. You have 7 bits available with which you can store 27=128 number
combinations.

2. Each of these numbers can be positive or negative (first bit being either 1
or 0), giving you in fact 128*2=256 combinations.

3. However, two of these are representations of 0 (00000000 and


10000000).

4. If we do not count +0 and -0 as different numbers, we end up with 255


different numbers.

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


U4 Communication and
Digitization
.
Exercise

Consider given analog signal. Sampling rate of the anolog signal is 2 Hz (see red lines in the figure). Compute 4 bits
digitization of the signal and show digital representation of the signal.

Analog signal
3
Sampling
2
Amplitude

Digital
signal
1

0 1 2 3
Time(s)
WS 2023/24 - Introduction: Applied Informatics (IAI VO)
Exercise (Solution)

Computer stores 4 bits numbers together as our digital wavewform:

011110101011100011001000

More precise: Need to generate more data (i.e both sampling rate and bit depth are high)

Analog signal
3 Sampling
2.5 4-bit
2 digitization
Amplitude

1.5
1
0.5
0 1 Time(s) 2 3
0111 1010 1011 1000
WS 2023/24 - Introduction: Applied Informatics (IAI VO)
Exercise

You want to digitize a 15-seconds long piece of music with a sample rate of 44kHz and bit
depth of 16bit. How many bits will you produce as a result?

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Exercise (Solution)

Question  You want to digitize a 15-seconds long piece of music with a


sample rate of 44kHz and bit depth of 16bit. How many bits will you produce
as a result?

Samples per second: 44 000


Bits per sample: 16 bits
Length: 15 s
44 000 × 16 × 15 = 10 560 000

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Introduction: Applied
Informatics (IAI VO)
Sarita Paudel
WS 2024/25
U1 Introduction
.
1.1 Introduction to informatics

1.2 Historical Notes

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


1.1 Introduction to informatics

You will learn

• Why is Informatics important?

• Areas of Informatics

• What is applied Informatics?

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Informatics

• A very young scientific discipline and academic field

• The interpretation of the term "Informatics" has not yet been generally accepted and has
different definitions depending on where it is used

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Computer Science

The study of computation, information, and automation

Theoretical disciplines (e.g., algorithms, theory of computation and information theory) to applied
disciplines (e.g., design and implementation of hardware & software).

Closely related to computer programming

Algorithms and data structure are the centrals

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Informatics vs Computer Science

• An overlap between Informatics and Computer Science (CS) but not exactly the same thing

• In U.S.  CS in an interdisciplinary and applied nature academic discipline

• In Europe  CS means "Informatics".

• In the U.S.  Informatics is linked with applied computing, or computing in the context of another domain

• In Europe  Informatics is close to "Applied Informatics"

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Informatics (Defining the Term)

• 1957, Karl Steinbuch (DE) coined the term: Informatik

• 1962, Philippe Dreyfus (FR) coined the term: Informatique

• Those terms (including the English version Informatics) combine two words:

information and automation

• We can interpret Informatics as the science of automatic processing of information

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


What is Informatics about?

• A discipline that solves problems through the application of computing or computation (so we
need "computers") in the context of the domain of the problem.

• The central notion is transformation of information which takes place not only through
computation but also via communication by organisms and artifacts (so it is not only about
"computers"!).

• Transformations of information enable its use for decision-making.

• Summary  Informatics is an interdisciplinary approach to domain problems, and as such is


limited neither to a single discipline nor a single domain.

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Why so important?

• Informatics is different from other sciences because it is built upon the concept of a universal
computing devices (a.k.a., computers or computing systems).

• Computers can do

• very different things, depending on how they are programmed, and


• so fast that methods that are prohibitively expensive or inapplicable suddenly become doable

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Areas of Informatics*

Informatics has evolved in major areas:


Theoretical Informatics: Fundamental knowledge for deciding problems,
1. Theoretical Informatics classification of their complexity and modeling of automata and formal
languages.
2. Development and Programming

3. Artificial Intelligence

4. Information systems Practical/Applied Informatics: Ranges from algorithms, data structures,


programming languages, to operating systems, databases and the
5. Social informatics software-side fundamentals of the application domains.

6. Bioinformatics

7. Business informatics
Technical informatics: Deals with hardware, computing and
communication systems.
8. Computing equipment

*This list might be incomplete


WS 2024/25 - Introduction: Applied Informatics (IAI VO)
Applied Informatics

• The EU Applied Informatics (US Informatics) examines the properties, laws, methods and
means of formation, transformation and dissemination of information in nature and society,
including by means of technical systems.

• It combines aspects of software engineering, human-computer interaction, and the study of


organizations and information technology (it is about computers and people).

• Computing and computational thinking are no longer owned solely by computer science but
have embedded in all aspects of science, research, industry, government, and social interaction.

• Consequently, besides informatics specializations like theoretical computer science or technical


informatics there are also social informatics, bioinformatics, business informatics, and physical
informatics to name a few.

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


References

• Nell Dale and John Lewis, "Compute Science Illuminated." Chapter 1

• Communications of the ACM. Why an Informatics Degree?


https://dl.acm.org/doi/10.1145/1646353.1646364

• Andrzej Yatsko and Walery Susłow, "Insight into Theoretical and Applied Informatics." Chapters
1.1 and 1.2

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Introduction: Applied
Informatics (IAI VO)
Sarita Paudel
WS 2024/25
U2 Number System

EL on 23.10.2024
2.1 Number system

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Positional notation (recall)

Value of a number is included by both the symbols and the positions of the symbols.

Interpret the symbols having different values as they are in different positions. This notation is
called positional notation.

1 0 1 1 .1 0 𝑏𝑏

1 0 0 1 .0 1 𝑏𝑏
𝑏𝑏3 𝑏𝑏2 𝑏𝑏1 𝑏𝑏0 . 𝑏𝑏 −1 𝑏𝑏 −2

Increasing weight Decreasing weight

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise: Convert the given number to the number system of
Base 10 (decimal system) using positional notation

Decimal system

base = 10
digits = 0,1,2,3,4,5,6,7,8,9

Index 2 1 0
2 6 310 Base 𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟏𝟏 = ??
Position
Digits Radix

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise: Convert the given number to the number
system of Base 8 using positional notation
Octal system

base = 8
digits = 0,1,2,3,4,5,6,7

𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟑𝟖𝟖 = ??
Index 2 1 0

Position 2 6 310 Base


Digits Radix

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Converting to base 10 (recall) Index 2 1 0

Position 2 6 310 Base


Digits Radix
𝑛𝑛

𝑉𝑉 𝑋𝑋𝐵𝐵 = � 𝑥𝑥𝑖𝑖 𝐵𝐵𝑖𝑖


𝑖𝑖=0

𝑋𝑋𝐵𝐵 … number represented in a positional system with base 𝐵𝐵


𝑉𝑉() … decimal value of the number
𝑥𝑥𝑖𝑖 … digit value at index 𝑖𝑖; note that 𝑖𝑖 = position − 1
𝐵𝐵 … base (radix)

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise

Can the given numbers be converted to decimal numbers? If they can then what decimal value do
the following numbers have?

a) 11010111012

b) 76388

c) 𝐹𝐹𝐹𝐹16

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exponential notation (recall)

Some numbers are difficult to write, because they are very large or very small.

𝑚𝑚 × 𝐵𝐵𝑛𝑛
𝑚𝑚 … mantissa; 1 ≤ 𝑚𝑚 < 𝐵𝐵
𝐵𝐵 … base
𝑛𝑛 … exponent;

Most common form is the normalised notation (standard form) with 𝐵𝐵 = 10.

𝑚𝑚 × 10𝑛𝑛

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise

a) Which of the numbers is bigger?


3.45 × 105
9.15 × 104

b) Calculate the following: 1.75 × 103 − 7.5 × 102

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


2.2 Calculation and Conversion

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Example - addition

Base (b = 10)

55

+37
Exercise: Assume these
92
numbers are in Base 8 and do
1) 5+7 = 12; 12 > b; addition.
12/10 => quotient = 1, remainder = 2

2) 1+5+3 = 9; 9<b

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Example - Subtraction

Base (b = 10)

-1

52
Exercise: Assume these
-35 numbers are in Base 8 and
17 do subtraction.

1) 2-5 = -3; -3 < 0; 10-3 =7

2) -1+5-3 = 1; 1>0;

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Example – convert from base 10

Convert 10 10

To base (b=2)

Divide by 2 Quotient Remainder Exercise: convert the number


10/2 5 0
to Base 8
5/2 2 1

2/2 1 0

1/2 0 1

10 10 = 1010 2

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise

Convert the following numbers in decimal system to

a) 55  base 2

b) 475  base 12

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise

Calculate the following:

a) 4425 + 3135

b) 627 − 457

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


More Exercises

a) Convert 55510 into base 16.

b) Calculate 3224 − 1234 .

c) Convert 1011110100112 into octal and hexadecimal system.

d) Convert 𝐴𝐴𝐴𝐴11 into base 10.

e) Convert the following numbers into normalised notation:


784 000 000 and 0.00000000784

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercise: Convert the following number in different number system

Convert 148

 base 10

 base 2

 base 12

 base 16

Exercise: Convert the following number in different number system


Convert 𝐴𝐴𝐴𝐴11

 base 10

 base 2

 base 12

 base 16
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
Introduction: Applied
Informatics (IAI VO)
Sarita Paudel
WS 2024/25
U2 Number System
.
2.1 Number Systems

2.2 Calculation and Conversion

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


2.1 Number system

You will learn

• Analog vs digital

• Representation of numbers in different number systems

• Additive and positional notation in number systems

• Converting to decimal number system

• Representing numbers using exponential notation

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Digitization

• Digitization: The conversion from analog information into a digital format (is the transition from
analog to digital).

• Examples

• converting a physical document into a pdf by scanning or photographing the document.


• converting a video into a MPEG
• converting an audio to MP3

Analog Digital format

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Analog and digital format
• Analog format  has a continuous variable e.g., temperature is something to measure as fluid
expands or contrasts depending on temperature (a continuious variable or analogous
measurement).

• Analogous data  data that can be stored in an analogy to show how they occured in nature.
E.g., signal of music, sound, light etc. Therefore, analog data is a continuous representation,
analogous to the actual information it represents.

• How computer deals with such type of data?


• Digital format  computers can store discrete values; it can store certain points in the
temperature. Computers store information in binary (digital format). Basic unit of binary is a bit
(just 1 or 0). Next largest unit of binary is a byte (consists of 8 bits). Usually, when we refer to
file sizes, we refer to number of bytes.

• Digital data  a discrete representation, breaking the information up into separate elements.
Thus, digital information has a fixed number of states.
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
Practical Examples

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Scenarios

Digitize analog information in the form of word Digitization of an analog signal


• Scenario: we have some analogue phrases, sentences • Scenario: we have waveform/timesignal, and want to
out of some letters and want to digitize this analogue digitize the analog signal
information
3 steps
• we use some sort of encoding called UTF-8 (8
bits - Unicode Transformation Format) which is • Sampling
based on ASCII (American Standard Code for • Quantization
Information Interchange)
• Encoding

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Binary Values

• Computers represent, store, process and communicate all information in digital form, so using
binary values.

• Binary values are the simplest form to represent information and the closest to how the
hardware (made of gates, signals, high/low voltage, etc.) work.

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Why Computers are binary?

• Modern computers are based on storing information using physical means that can be in one of
two mutually exclusive logical states commonly represented as 0 and 1.

• Low- or High- voltage signals (PCM Pulse-code Modulation)


• "Bumpy" (pit) or flat (land) surface (CD)

• Devices that store and manage binary data are more reliable and less expensive (they need to
represent one state only, the other is usually "absence") because digital signals do not fluctuate
continuously but "jump" sharply between two extremes (pulse-code modulation, PCM).

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Binary Digits - Bits

• No matter how they are physically realized, we call the physical (storage) units in computers
Binary digits, or bits.

• Since each bit can be either 0 or 1, it can represent only two states:

• on/off
• true/false
• yes/no.

• When we need to represent more complex information or systems (e.g., traffic light with three
lights), a single bit is not sufficient: we need multiple bits.

• 2 bits can represent 4 things; 3 bits can represent 8 things; 4 bits can represent 16 things; 5 bits
can represent 32 things; and so on.

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Questions

• What's the underlying rule that links how much information we can represent with n bits?

• How many bits do you need to represent 25 unique things?

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Orders of Magnitude

• n bits can be in one of 2^n (or 2n) distinct states

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Bytes and Words

• In practice, the number of bits used to store data is defined by the device we are using. In particular, we
may need to allocate more bits than necessary.

• The reason is that computers do not handle single bits, rather uses words.

• Words are groups of bits of a given size defined by the computer architecture, and their size is usually a
power of two (8-bits, 16-bits, 32-bits, 64-bits).

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Practical Example
Addressing memory content

• The memory is divided into memory cells of uniform size (e.g., byte)

• Each memory cell is given a unique number, called the address

• The content of each memory cell can be read via this address
address

Memory*
n

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Memory

Address cells for several bits

Bits for address Count of addressable cells


8 28 = 256
16 216 = 65,536
32 232 = 4,294,967,296
64 264 = 18,446,744,073,709.551,616

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Computers need to compute!

• Computers are made of gates (logical operators like AND, OR etc.).

• To have computers do arithmetic operations we need a way to express numerical values


(among other types of data).

• So, we need a way to represent numbers

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Number system
Sumerian Egyptian Roman
Number systems were developed independently in
one
different parts of the word.

E.g., in Sumer, Egypt, Rome ten

Sumerian, Egyptian, Roman systems are examples of hundred


how the units or hundreds are ordered and grouped
together so that their sum is represented by a new thousand
symbol.
ten thousand

hundred thousand

million, infinity
Decimal number system (widely used number system)

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Additive Notation

Number systems are based on additive principle.

In an additive notation, each numeral (symbol) represents a certain number (value). The overall
value is calculated by adding the values of all present numerals.

𝑛𝑛

𝑉𝑉 𝑋𝑋 = � 𝑣𝑣(𝑥𝑥𝑖𝑖 )
𝑖𝑖=1

For instance : 500 + 50+10 +1 = 561

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Number systems and bases

A number system defines a set of symbols used to represent a quantity.

Lets suppose a quantity is represented by a number in one number system. We can represent the
same quantitiy in other number system (with another number).

Base of a number system is also called as radix. In a base (b) number system, we have b distinct
digits and digit starts from 0, incremental by 1 every time and ends at (b-1)

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Positional notation
1) The code used to represent a number system is called a base. The base number represents
how many symbols are used to represent a code.
base 2 – use 2 symbols (0 and 1),
base 10 – use 10 symbols (0,1,2,3,4,5,6,7,8 and 9)

2) If we run out of symbols, then we combine the symbols to represent large numbers. In numbers,
different symbols have different values.

base 2 – 0, 1, 10, 11 ,…….

base 10 – 0,1,…..9, 10, 11, 12, 13,…….

3) To represent numbers, we have to know which base we are using so that we can interpret the
numbers correctly.

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Positional notation Index 2 1 0

Position 2 6 310 Base


Digits Radix
• base 𝑏𝑏 ∈ ℕ;

• digits 𝑥𝑥 ∈ 0, … , 𝑏𝑏 − 1
digits are represented by single symbol

Common positional systems

Name Base Digits


decimal 10 0,1,2,3,4,5,6,7,8,9
dual or binary 2 0,1
octal 8 0,1,2,3,4,5,6,7
hexadecimal 16 0,1,2,3,4,5,6,7,8,9, 𝐴𝐴, 𝐵𝐵, 𝐶𝐶, 𝐷𝐷, 𝐸𝐸, 𝐹𝐹

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Example

Base 2 – binary system

0 1 10 11 100 101

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Base 10 – decimal system

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Positional notation

Value of a number is included by both the symbols and the positions of the symbols.

Interpret the symbols having different values as they are in different positions. This notation is
called positional notation.

1 0 1 1 .1 0 𝑏𝑏

1 0 0 1 .0 1 𝑏𝑏
𝑏𝑏3 𝑏𝑏2 𝑏𝑏1 𝑏𝑏0 . 𝑏𝑏 −1 𝑏𝑏 −2

Increasing weight Decreasing weight

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Decimal system

To the left of decimal increasingly greater weights and to the right decreasingly smaller weights

1 3 5 4 . 6 10

103 102 101 100 10−1

1000 100 10 1 1/10

Increasing weight Decreasing weight

Value of the number = multiply symbol by the weight of its position

1 x 1000 + 3 x 100 + 5 x 10 + 4 x 1 + 6 x 1/10

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Converting to base 10 Index 2 1 0

Position 2 6 310 Base


Digits Radix
𝑛𝑛

𝑉𝑉 𝑋𝑋𝐵𝐵 = � 𝑥𝑥𝑖𝑖 𝐵𝐵𝑖𝑖


𝑖𝑖=0

𝑋𝑋𝐵𝐵 … number represented in a positional system with base 𝐵𝐵


𝑉𝑉() … decimal value of the number
𝑥𝑥𝑖𝑖 … digit value at index 𝑖𝑖; note that 𝑖𝑖 = position − 1
𝐵𝐵 … base (radix)

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Example - converting to base 10

When we use binary numbers then each position is assigned a weight that is a power of 2 (base = 2).

radix
1 1 0 1 . 1 2
23 22 21 20 2 −1

8 4 2 1 1/2

When numbers are represented in bases the decimal point is called the radix point.

8+ 4+ 0+ 1 + ½ = 13.5

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exponential notation

Some numbers are difficult to write, because they are very large or very small.

𝑚𝑚 × 𝐵𝐵𝑛𝑛
𝑚𝑚 … mantissa; 1 ≤ 𝑚𝑚 < 𝐵𝐵
𝐵𝐵 … base
𝑛𝑛 … exponent;

Most common form is the normalised notation (standard form) with 𝐵𝐵 = 10.

𝑚𝑚 × 10𝑛𝑛

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Number Systems (Summary)

Additive notation  𝑉𝑉 𝑋𝑋 = ∑𝑛𝑛𝑖𝑖=1 𝑣𝑣(𝑥𝑥𝑖𝑖 )

Number systems and bases

• base 𝑏𝑏∈ℕ;
• digits 𝑥𝑥∈{0, …, 𝑏𝑏−1}

Positional notation

• Index, Position, Base/Radix, increasing weight (to the left) or decreasing weight (to the right)

Converting to decimal number system (base 10)

Normalised exponential notation  𝑚𝑚 × 10𝑛𝑛

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


2.2 Calculation and Conversion

You will learn ...

…why using the positional notation makes addition and subtraction easier

…how addition and subtraction algorithms work in non-decimal systems

…how to convert a decimal number into any other base

…how to convert between dual, octal, and hexadecimal systems

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Addition in positional system

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Example - addition

Base (b = 10)

55

+37

92

1) 5+7 = 12; 12 > b;

12/10 => quotient = 1, remainder = 2

2) 1+5+3 = 9; 9<b

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Subtraction in positional system

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Example - Subtraction

Base (b = 10)

-1

52

-35

17

1) 2-5 = -3; -3 < 0; 10-3 =7

2) -1+5-3 = 1; 1>0;

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Converting from decimal system

no

no

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Example – convert from base 10

Convert 10 10

To base (b=2)

Divide by 2 Quotient Remainder

10/2 5 0

5/2 2 1

2/2 1 0

1/2 0 1

10 10 = 1010 2

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


hex dual

Dual, octal and hexadecimal systems 0 0000


1 0001
2 0010
dual ↔ octal octal dual dual ↔ hex 3 0011
0 000
Every four dual digits 4 0100
Every three dual digits 1 001
(right to left) correspond 5 0101
(right to left) correspond to 2 010 to one hexadecimal digit. 6 0110
one octal digit. 3 011
7 0111
4 100
8 1000
5 101
9 1001
6 110
A 1010
7 111
B 1011
C 1100
D 1101
E 1110
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
F 1111
Decimal number system (Recall)

Decimal to any system Any system to decimal system

(division rule) (multiplication rule)

Dual Dual

Decimal
Decimal

Octal Hexadecimal Octal Hexadecimal

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Dual, octal and hexadecimal number systems (Recall)

Dual and octal (3 bits rule)

Dual and hexadecimal (4 bits rule)

Dual

Octal Hexadecimal

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Any to any number system (Recall)

First convert to decimal then to any other system

Decimal

any system(e.g, Octal) any system (e.g., Hexadecimal)

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Number Conversion (Recall)

Any number system to decimal system (use multiplication rule - using positional notation)

Decimal to any number system (use division rule)

Octal and binary number system (use 3 bits rule)

Hexadecimal and binary number system (use 4 bits rule)

Any to any number system (use multiplication rule to convert to decimal then use division rule to
convert to any other system)

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Summary

• Computer hardware is designed using numbers in base 2: a low-voltage signal is equated with 0
and a high-voltage signal is equated with 1. Thus, computers work with binary values stored as
bits (0,1).

• Numbers are written using positional notation, in which the digits are arranged in succession,
the position of each digit has a place value, and the number is equal to the sum of the products
of each digit by its place value.

• The place values are powers of the base of the number system. Thus, in the decimal number
system, the place values are powers of 10; in the binary number system, the place values are
powers of 2.

• Base 2, base 8, and base 16 are all related because the bases are powers of 2. This
relationship provides a quick way to convert between numbers in these bases.

• Arithmetic can be performed on numbers in any base represented in positional notation.

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


References

• Nell Dale and John Lewis, "Compute Science Illuminated." Chapters 2 and 3.

• Communications of the ACM. Why an Informatics Degree?


https://dl.acm.org/doi/10.1145/1646353.1646364

• Andrzej Yatsko and Walery Susłow, "Insight into Theoretical and Applied Informatics." Chapter
1.3

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Introduction: Applied
Informatics (IAI VO)
Sarita Paudel
WS 2023/24
U3 Numbers
Representation
.
3.1: Representing Integers

You will learn

• How to represent unsigned integers

• Arithmetic operation (addition, subtraction) in unsigned integers

• Arithmetic operation (addition, subtraction) in signed integers.

• What is one’s complement and why we need it

• What is two’s complement and why we need it

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Digital system

Basic unit of information is the binary digit (or bit); data representation and operations within the
computer is in binary

Data types -> Numbers (e.g., signed integers, unsigned integers, floating point, etc), text (e.g.,
characters, strings), images (pixels, colors, shapes) etc.

The storable value of the integer depends on the available number of digits where signed and
unsigned integers are used.

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Unsigned Integer

Does not have any sign (negative or positive) in the front of an integer.

A collection of n bits represents 2𝑛𝑛 numbers (0 through 2𝑛𝑛 − 1). Example: 3 bits can store values
from 0 to 7 and 4 bits can store values from 0 to 15

Weighted positional notation like in decimal system

3 bits Int 4 bits Int 4 bits Int


3 2 1 0
22 21 20 2 2 2 2 3 2 1 0
2 2 2 2
000 0 0000 0 1000 8
001 1 0001 1 1001 9
010 2 0010 2 1010 10
011 3 0011 3 1011 11
100 4 0100 4 1100 12
101 5 0101 5 1101 13
110 6 0110 6 1110 14
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
111 7 0111 7 1111 15
Unsigned Binary Arithmetic

Base 2 addition – like base 10 (add from right to left and propagate carry)

carry carry
1 1 11
10010 18 10010 10001
18 17
+01001 +9 +01011 +01011
+ 11 + 11
11011 27 11101 11100
29 28

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Signed Integers

With n bits, we can represent 2𝑛𝑛 distinct values (numbers)

Most significant bit (MSB) is used to present if the integer is positive or negative

Signed-magnitude

• sets MSB (sign bit) to zero to show positive integer

• sets MSB (sign bit) to one to show negative integer

• other bits represent the integer.

00101 = +5 10101 = - 5

sign bit sign bit


WS 2024/25 - Introduction: Applied Informatics (IAI VO)
Signed Integers

If saving memory is limited to n bits then all numbers are saved using the n bits, by converting to
signed integers. Example: 3 bits, 4 bits, ……

Assign half to positive integers (0 through 2𝑛𝑛−1 ) and half to negative integers (- 2𝑛𝑛−1 through -0); In
arithmetic -0, +0 and 0 are identical
3 bits Num Signed Int 4 bits Num Signed Int 4 bits Num Signed Int

000 0 0 0000 0 0 1000 8 -0


001 1 1 0001 1 1 1001 9 -1
010 2 2 0010 2 2 1010 10 -2
011 3 3 0011 3 3 1011 11 -3
100 4 -0 0100 4 4 1100 12 -4
101 5 -1 0101 5 5 1101 13 -5
110 6 -2 0110 6 6 1110 14 -6
111 7 -3
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
0111 7 7 1111 15 -7
Signed integers

signed magnitude

One‘s complement

two‘s complement

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


signed magnitude
Signed Integers (Signed magnitude - recall)
one‘s complement

two‘s complement

8 bits representation
4 bits representation

00000101 5 0101 5
00000101 +5 0 101 +5
10000101 -5 1 101 -5

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


signed magnitude
Signed integers (signed magnitude) one‘s complement
1 1 1 1 -7 two‘s complement
Sign bit 1 1 1 0 -6
1 1 0 1 -5
1 1 0 0 -4
1 0 1 1 -3
1 0 1 0 -2

Arithmetic operations 1 0 0 1 -1
1 0 0 0 -0
1 1 1 0 0 0 0 0
0101 5
0 0 0 1 1
+ 1101 -5 0 0 1 0 2

1 0010 2 0 0 1 1 3
0 1 0 0 4
0 1 0 1 5
0 1 1 0 6
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
0 1 1 1 7
signed magnitude

one‘s complement
One‘s complement
two‘s complement

In a binary number system, one‘s complement is the value obtained by inverting all the bits in the
binary representation of the number.

10101110 One‘s complement


01010001

The sign bit is also inverted while doing one‘s complement of signed integers.

One‘s complement
0 101 +5
1 010

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


signed magnitude

one‘s complement
Signed integers
two‘s complement

Consider a binary number 𝑥𝑥. A one’s 0 0 0 0 1 0 1 1 11


complement 𝑥𝑥𝑥 is a binary number, so
that when 𝑥𝑥𝑥 is added to 𝑥𝑥, the result will
consist only of 1s. 1 1 1 1 0 1 0 0 one‘s complement

Just flip all the bits!


1 1 1 1 1 1 1 1

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


signed magnitude

one‘s complement
Signed integers
two‘s complement

use binary number with n positions to represent integers with n-1 digits

positive integers are represented as binary numbers (i.e. in the normal manner)

let negative integers be represented by their one‘s complement.

leading 0 => positive integer

leading 1 => negative integer

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


One‘s complement
Signed integers 1 1 1 1 -7 1 0 0 0 -7
1 1 1 0 -6 1 0 0 1 -6
Sign
bit 1 1 0 1 -5 1 0 1 0 -5
1 1 0 0 -4 1 0 1 1 -4
Signed 1 0 1 1 -3 1 1 0 0 -3
integers 1 1 0 1 -2
1 0 1 0 -2
1 0 0 1 -1 1 1 1 0 -1
1 0 0 0 -0 1 1 1 1 -0
0 0 0 0 0 0 0 0 0 0
0 0 0 1 1 0 0 0 1 1
0 0 1 0 2 0 0 1 0 2
0 0 1 1 3 0 0 1 1 3
0 1 0 0 4 0 1 0 0 4
0 1 0 1 5 0 1 0 1 5
0 1 1 0 6 0 1 1 0 6
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
0 1 1 1 7 0 1 1 1 7
signed magnitude

one‘s complement
Example (One‘s complement) 1 0 0 0 -7
two zero representations 1 0 0 1 -6 two‘s complement
11111111 -0 1 0 1 0 -5
00000000 +0 1 0 1 1 -4
0011 3 1 1 0 0 -3
0101 5
+ 1100 1 1 0 1 -2
-3
+ 1010 -5 1 1 1 0 -1
1111 -0 1 1 1 1 -0
1111 -0
-0+1 = 0 0 0 0 0 0
-0+1 = 0 0 0 0 1 1
1001 -6 0 0 1 0 2
0110 6
+ 1110 0 0 1 1 3
-1
+ 1100 -3 0 1 0 0 4
10111 7
0 1 0 1 5
10010 2
+1 0 1 1 0 6
2+1 = 3 1000
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
-7 0 1 1 1 7
Exercise

Calculate -28+12 as an 8-bit binary addition using one’s complement.


Convert the result back to the decimal system.

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Example (one‘s complement)

-6 00110 6
11001 -6
+ -2 11001 -6 +11101 -2
-8
110110
00010 2
+1
11101 -2
10111 -8

01000 8
10111 -8

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Two‘s complement

Invert all bits (one‘s complement) then add 1 to the least significant bit (LSB) of the result.

Two‘s complement
0101 1010
+1
1011

Usages:
1. representation of signed binary numbers
2. arithmetic operations for binary numbers (e.g., additions, subtractions)

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


signed magnitude

one‘s complement
Signed integers (Two‘s complement)
two‘s complement

Consider a binary number 𝑥𝑥. A 0 0 0 0 1 0 1 1 11


two’s complement 𝑥𝑥𝑥 is a binary
number, so that when 𝑥𝑥𝑥 is added
to 𝑥𝑥, the result will consist only of
0s.
1 1 1 1 0 1 0 0 one‘s complement

1 1 1 1 0 1 0 1 two‘s complement

Just flip all the bits and


add 1!
1 0 0 0 0 0 0 0 0

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


signed magnitude

one‘s complement
Signed integers
two‘s complement

use binary number with n positions to represent integers with n-1 digits

positive integers are represented as binary numbers (i.e. in the normal manner)

let negative integers be represented by their two‘s complement.

leading 0 => positive integer

leading 1 => negative integer

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


One‘s complement Two‘s complement
Signed integers 1 1 1 1 -7 1 0 0 0 -7 1 0 0 0 -8
1 1 1 0 -6 1 0 0 1 -6 1 0 0 1 -7
Sign bit
1 1 0 1 -5 1 0 1 0 -5 1 0 1 0 -6
1 1 0 0 -4 1 0 1 1 -4 1 0 1 1 -5
Signed 1 0 1 1 -3 1 1 0 0 -3 1 1 0 0 -4
integers 1 1 0 1 -2 1 1 0 1 -3
1 0 1 0 -2
1 0 0 1 -1 1 1 1 0 -1 1 1 1 0 -2
1 0 0 0 -0 1 1 1 1 -0 1 1 1 1 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 1 0 0 0 1 1 0 0 0 1 1
0 0 1 0 2 0 0 1 0 2 0 0 1 0 2
0 0 1 1 3 0 0 1 1 3 0 0 1 1 3
0 1 0 0 4 0 1 0 0 4 0 1 0 0 4
0 1 0 1 5 0 1 0 1 5 0 1 0 1 5
0 1 1 0 6 0 1 1 0 6 0 1 1 0 6
0 1 1 1 7 0 1 1 1 7 0 1 1 1 7
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
signed magnitude

one‘s complement
Signed integers 1 0 0 0 -8
1 0 0 1 -7 two‘s complement
1 0 1 0 -6
1 0 1 1 -5
1 1 0 0 -4
0011 3 1 1 0 1 -3
0101 5
+ 1101 -3 1 1 1 0 -2
+ 1011 -5 1 1 1 1 -1
10000 0 0 0 0 0 0
10000 0
0 0 0 1 1
1010 -6

0 0 1 0 2 + 1110 -2
1010 -6 0 0 1 1 3 11000 -8
0110 6
+ 1111 0 1 0 0 4
-1
+ 1101 -3 0 1 0 1 5
11001 -7
10011 3 0 1 1 0 6
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
0 1 1 1 7
Exercise

Calculate 31 + (-8) as an 8-bit binary addition using two’s complement.


Convert the result back to the decimal system.

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


3.2: Representing non-integers

You will learn

• Formula and algorithm to represent floating-point numbers

• IEEE for representing floating point numbers

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exponential notation (recall)

Some numbers are difficult to write, because they are very large or very small.

𝑚𝑚 × 𝐵𝐵𝑛𝑛
𝑚𝑚 … mantissa; 1 ≤ 𝑚𝑚 < 𝐵𝐵
𝐵𝐵 … base
𝑛𝑛 … exponent;

Most common form is the normalised notation (standard form) with 𝑏𝑏 = 10.

𝑚𝑚 × 10𝑛𝑛

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Floating-point numbers
8 bit
(formula and algorithm)
𝒔𝒔 𝒏𝒏 + 𝒌𝒌 𝒎𝒎
1 bit 3 bit 4 bit

𝑠𝑠 𝑛𝑛+𝑘𝑘 1. convert the number to base 2, converting integral


(−1) × 𝑚𝑚 × 2 and fractional part separately
2. append × 20
𝒔𝒔 … sign bit 3. normalise the mantissa to start with a 1, adjusting the
𝒎𝒎 … mantissa, normalised exponent
𝑛𝑛 … exponent 4. omit the leading one of the mantissa and fill with 0s
𝑘𝑘 … bias 5. add bias to the exponent
6. set sign bit

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Floating-point numbers
8 bit
(-2.625)
𝒔𝒔 𝒏𝒏 + 𝒌𝒌 𝒎𝒎
1 bit 3 bit 4 bit

1. convert number to base 2, converting integral and fractional part seperately

210 .62510
2 ÷ 2 = 1 𝑅𝑅 0 → 0 0.625 × 2 = 1.25 → 1
1 ÷ 2 = 0 𝑅𝑅 1 → 1 0.25 × 2 = 0.5 → 0
102 0.5 × 2 = 1.0 → 1
1012
Note: keep numbers bottom to top
Note: keep numbers top to buttom

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


𝟏𝟏𝟏𝟏. 𝟏𝟏𝟏𝟏𝟏𝟏𝟐𝟐
Floating-point numbers
8 bit
(-2.625)
𝒔𝒔 𝒏𝒏 + 𝒌𝒌 𝒎𝒎
1 bit 3 bit 4 bit

2. append × 𝟐𝟐𝟏𝟏

𝟏𝟏𝟏𝟏. 𝟏𝟏𝟏𝟏𝟏𝟏𝟐𝟐 × 𝟐𝟐𝟏𝟏

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Floating-point numbers
8 bit
(-2.625)
𝒔𝒔 𝒏𝒏 + 𝒌𝒌 𝒎𝒎
1 bit 3 bit 4 bit

3. normalise the mantissa to start with a 1, adjusting the exponent

Adjust the exponent so that the


𝟏𝟏𝟏𝟏. 𝟏𝟏𝟏𝟏𝟏𝟏𝟐𝟐 × 𝟐𝟐𝟏𝟏 = 𝟏𝟏. 𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟐𝟐 × 𝟐𝟐𝟏𝟏
mantissa starts with „1.“ .

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Floating-point numbers
8 bit
(-2.625)
𝒔𝒔 𝒏𝒏 + 𝒌𝒌 𝒎𝒎
1 bit 3 bit 4 bit

4. crop/fill the mantissa (omit the leading one of the mantissa and fill with 0s)

𝟏𝟏. 𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟐𝟐 × 𝟐𝟐𝟏𝟏


𝟏𝟏. 𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏

𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Floating-point numbers
8 bit
(-2.625)
𝒔𝒔 𝒏𝒏 + 𝒌𝒌 𝒎𝒎
1 bit 3 bit 4 bit

5. add bias to the exponent

𝟏𝟏. 𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟐𝟐 × 𝟐𝟐𝟏𝟏


How to express negative as well exponent = 𝟏𝟏 bias = 3
as positive exponents?
𝟏𝟏 + 𝟑𝟑 = 𝟒𝟒 = 𝟏𝟏𝟏𝟏𝟏𝟏𝟐𝟐
bias = half of the highest value
available for the exponent
Bias calculation:
The highest value = 23 -1= 7
Half of the highest value = 7 % 2  3 (consider floor
WS 2024/25 - Introduction: Applied Informatics (IAI VO)
value)
Floating-point numbers
8 bit
(-2.625)
𝒔𝒔 𝒏𝒏 + 𝒌𝒌 𝒎𝒎
1 bit 3 bit 4 bit

6. set sign bit

0  positive
1  negative −𝟐𝟐. 𝟔𝟔𝟐𝟐𝟔𝟔

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Floating-point numbers
8 bit
(-2.625)
𝒔𝒔 𝒏𝒏 + 𝒌𝒌 𝒎𝒎
1 bit 3 bit 4 bit

−𝟐𝟐. 𝟔𝟔𝟐𝟐𝟔𝟔
8 bit

𝟏𝟏
𝒔𝒔 𝟏𝟏𝟏𝟏𝟏𝟏
𝒌𝒌 − 𝒏𝒏 𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏
𝒎𝒎
1 bit 3 bit 4 bit

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Floating-point numbers

−𝟐𝟐. 𝟔𝟔𝟐𝟐𝟔𝟔
8 bit

𝟏𝟏
𝒔𝒔 𝟏𝟏𝟏𝟏𝟏𝟏
𝒌𝒌 − 𝒏𝒏 𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏
𝒎𝒎
1 bit 3 bit 4 bit

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Floating point numbers (IEEE floating point formats)

8 bit 𝟏𝟏 𝟑𝟑 𝟒𝟒

32 bit 𝟏𝟏 8 𝟐𝟐𝟑𝟑

64 bit 𝟏𝟏 𝟏𝟏𝟏𝟏 𝟔𝟔𝟐𝟐

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Exercises

1. Convert 1.710 to a 8-bit floating point format.

2. If you are storing a number in an 8-bit format using the signed


magnitude approach, how many different numbers can you store?

WS 2024/25 - Introduction: Applied Informatics (IAI VO)


Introduction: Applied
Informatics (IAI VO)
Sarita Paudel
WS 2024/25
U4 Communication and
Digitization
EL on 14.11.2024
You will learn

• how does a communication model work

• what are digitalization and digital transformation

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Shannon-Weaver model of communication

A linear model of communication that provides a framework for analyzing how messages are sent
and received.

6 key concepts (sender, encoder, channel, noise, decoder and receiver)

source destination
Information

signal

transmitter receiver
channel
(encoder) (decoder)

noise

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Shannon-Weaver model of communication – key concepts

Source (sender): Information source to send message to the receiver through channel. E.g., a person reading a newscast.

Encoder (transmitter): A device that converts signals into binary to be sent to the receiver. E.g., a telephone that converts voice into binary
(1s and 0s)

Channel: Infrastructure that gets information from sender to receiver through endoder and decoder. E.g., An email is sent using world
wide web (internet).

Noise: Noise interrupts a message on the way from sender to receiver. Internal noise (error) happens due to sender or receiver while
encoding or decoding messages. External noise happens in channel during transmission.

Decoder: Opposite to encoding. A device in the model decodes a message from binary digits or waves back to the format that the receiver
understands. E.g., computers that turn binary packets of 1s and 0s into pixels on a screen that make words.

Receiver (destination): End-point of the communication process. Final step where the messege is received. E.g., a person on other end of
telephone, a person reading an email you sent to them etc.

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Digitization (Recall)

Digitize analog information in the form of word

Scenario: we have some analogue phrases, sentences out of some letters and want to digitize this analogue information

• we use some sort of encoding called UTF-8 (8 bits - Unicode Transformation Format) which is based on ASCII (American
Standard Code for Information Interchange)

Digitization of an analog signal

Scenario: we have waveform/timesignal, and want to digitize the analog signal

3 steps

• Sampling : taking samples from the analog waveform. Sampling rate is the number of samples taken per second and measured
in Hertz (Hz). For instance if I take 2 samples per second then sampling rate is 2 Hz.

• Quantization: data are measured based on levels. Levels depend on bit depth. The number of lines between minimum and
maximum value of amplitude depends on the bit depth. For n bits depth, number of levels are 𝟐𝟐𝒏𝒏. Collect the values at the
levels of each sampling point in the waveform.

• Encoding: store the information (data) as a sequence of n bits code

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Exercise

Consider given analog signal. Sampling rate of the anolog signal is 2 Hz (see red lines in the figure). Compute 4 bits
digitization of the signal and show digital representation of the signal.

Analog signal
3
Sampling
2
Amplitude

Digital
signal
1

0 1 2 3
Time(s)
WS 2023/24 - Introduction: Applied Informatics (IAI VO)
Digitalization

Digitalization is about processes and roles where we use digital information to simplify specific
operation of a process.

Communication: Using whatsapp, facebook messenger, viber etc. to make communication easier.
We simplify processes or operations using those tools or technologies.

Banking: we can send money using online banking webpage; we do not have to go to bank any
more.

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Digital transformation

Requires digitization and several digitalization processes

Driven by digital infrastructures e.g., networks and devices with their availability by digital
applications like mobile apps, web apps to exploid new business model which allows automated
communication between apps or tools from different manufactures (e.g., manufacture A with
manufacture B) using standard communication channel to get to you a better customer experience.

Digital transformation is a change of business models, a change of strategy, a change of society, a


change of processes.

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Difference of digitization, digitalization and digital
transformation
Digitization of information  technology basis which is third revolution

Digitalization of processes and roles  about business process on the road of fourth revolution

Digital transformation is changes in business models, strategy processses  fourth revolution


starts with digital transformation

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Summary - Communication and digitization

Shannon-Weaver is a linear model for communication

Digitization is a process of converting an analog Information (e.g., words, signals) to a digital form

Analog information in the form of words can be digitized using ASCII, Unicode and/or UTF-8

An analog signal can be digitized in three steps; sampling, quantization and encoding

Total number of data points (n-bit representation) to be measured depends on sampling rate and a
bit depth.

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Exercise

You want to digitize a 15-seconds long piece of music with a sample rate of 44kHz and bit
depth of 16bit. How many bits will you produce as a result?

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Introduction: Applied
Informatics (IAI VO)
Sarita Paudel
WS 2024/25
U4 Communication and
Digitization
.
You will learn

• how does a communication model work

• how can you digitize analog information (e.g., words, signals)

• what are digitalization and digital transformation

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


You will learn

• how does a communication model work (will be provided in EL)

• how can you digitize analog information (e.g., words, signals)

• what are digitalization and digital transformation (will be provided in EL)

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Digitization (Recall)

Digitize analog information in the form of word

Scenario: we have some analogue phrases, sentences out of some letters and want to digitize this
analogue information

• we use some sort of encoding called UTF-8 (8 bits - Unicode Transformation Format) which is
based on ASCII (American Standard Code for Information Interchange)

Digitization of an analog signal

Scenario: we have waveform/timesignal, and want to digitize the analog signal

3 steps

• Sampling
• Quantization
• Encoding
WS 2023/24 - Introduction: Applied Informatics (IAI VO)
UTF-8 (Unicode Transformation Format – 8 bits)

ASCII: standardized encoding (process of converting characters in human language into binary
sequence) system for text.

• Alphabets (upper-case and lower-case), digits (0 to 9), symbols(/, ?, !) and assigns a unique
three-digit code and a unique byte

Unicode: standard encoding system for all human languages including emojis. It solves the space
issue of ASCII. In a similar manner to ASCII, unicode assigns a unique code (called code point) to
each character.

UTF-8: translates unicode character to binary string and also translates the binary string back to
unicode character.

Character ASCII code Code point UTF-8 binary encoding


A 065 U+0041 01000001
a 097 U+0061 01100001
0 048 U+0030 00110000
! 033
WS 2023/24 - Introduction: Applied Informatics (IAI VO) U+0021 00100001
Digitization – binary representation

space

A D E 4 . 9

01000001 01000100 01000101 00100000 00110100 00101110 00111001

Put all binary representation together

01000001 01000100 01000101 00100000 00110100 00101110 00111001


Computer uses this digital information

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Digitization of a waveform/timesignal
Digitize an analog signal e.g., waveform of current, voltage. Lets assume we have time signal and
amplitude.
Digitization of an analog signal in 3 steps (recall)

• Sampling
• Quantization
• Encoding
Analog signal
3

2 Digital
Amplitude

signal

0 1 Time(s) 2 3
WS 2023/24 - Introduction: Applied Informatics (IAI VO)
Digitization of a waveform/timesignal

Sampling: Taking samples from the analog waveform. Sampling rate is the number of samples
taken per second and measured in Hertz (Hz). For instance if I take 2 samples per second then
sampling rate is 2 Hz.

3 Analog signal
Sampling
2
Amplitude

0 1 2 3
Time(s)

WS 2023/24 - Introduction: Applied Informatics (IAI VO)


Digitization of a waveform/timesignal
What data occur on these points? How to measure these data?
Quantization: The data are measured based on levels. Levels depend on bit depth. The number of lines between
minimum and maximum value of amplitude depends on the bit depth. For n bits depth, number of levels are 2𝑛𝑛 . Collect
the values at the levels of each sampling point in the waveform.
• number of data points depends on sampling rate
• values (amount of information) depend on bit depth.

Encoding: store the information


(data) as a sequence of n bits
code 3
• digital waveform Sampling
101011101110 2-bit digitization
2
Amplitude

0 2 3
WS 2023/24 - Introduction: Applied Informatics (IAI VO)
10 10 1 11 Time(s) 10 11 10
Digitization of a waveform/timesignal

Computer stores 3 bits numbers together


as our digital wavewform:
011101110100110100

3 Analog signal
2.5 Sampling
3-bit digitization
2
Amplitude

1.5
1
0.5
0 011 101 1 110 100 2 110 100 3

WS 2023/24 - Introduction: Applied Informatics (IAI VO) Time(s)


Other examples of digitization

Digitization - information is being digitized.

Communication:

• analog communication - writting a letter


• digital communication- writing an E-Mail

Voting:

• analog voting - paper based vote; filling out paper form


• digital vote - electronic vote; filling out form in pdf or in an E-mail.

Banking:

• analog banking - filling out a voucher/check


• digital banking – filling out the check on the webpage in ebanking.

WS 2023/24 - Introduction: Applied Informatics (IAI VO)

You might also like