0% found this document useful (0 votes)
6 views4 pages

Solution TD 01

The document outlines exercises from a computer science module for first-year technology engineering students at the University of Skikda for the academic year 2024/2025. It includes various exercises on number base conversions, arithmetic operations in binary, and the representation of signed and unsigned integers. Additionally, it covers data size calculations and conversions between different numeral systems.

Uploaded by

tazirammar03
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)
6 views4 pages

Solution TD 01

The document outlines exercises from a computer science module for first-year technology engineering students at the University of Skikda for the academic year 2024/2025. It includes various exercises on number base conversions, arithmetic operations in binary, and the representation of signed and unsigned integers. Additionally, it covers data size calculations and conversions between different numeral systems.

Uploaded by

tazirammar03
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/ 4

University of 20 august 1955 - Skikda ‫ – ﺳﻜ�ﻜﺪة‬1955 ‫ أوت‬20 ‫ﺟﺎﻣﻌﺔ‬

Faculty of technology – Department of technology ‫كﻠ�ﺔ اﻟﺘﻜﻨﻮﻟﻮﺟ�ﺎ – ﻗﺴﻢ اﻟﺘﻜﻨﻮﻟﻮﺟ�ﺎ‬


1st year common core technology engineer ‫ﻣﺸ�ك ﻣﻬﻨﺪس ﺗﻜﻨﻮﻟﻮﺟ�ﺎ‬‫اﻟﺴﻨﺔ اﻷو� ﺟﺬع ت‬
Academic year: 2024/2025 – First Semester ‫اﻟﺴﺪا� اﻷول‬
‫ي‬ - 2025/2024 : ‫اﻟﺴﻨﺔ اﻟﺪراﺳ�ﺔ‬
Module: Computer science
Solution of TD 01 �‫اﻵ‬
‫ﻣﻘ�ﺎس اﻹﻋﻼم ي‬

Exercise 01: 49 ÷ 2 = 24 Reminder = 1


24 ÷ 2 = 12 Reminder = 0
• (49)10 = (110001)2
12 ÷ 2 = 6 Reminder = 0
6÷2=3 Reminder = 0
3÷2=1 Reminder = 1
1÷2=0 Reminder = 1

• (10110110)2 = (182)10 101101102 = 0 × 20 + 1 × 21 + 1 × 22 + 0 × 23+ 1 × 24 +1 × 25 + 0 × 26 + 1 × 27


= 0 × 1 + 1 × 2 + 1 × 4 + 0 × 8+ 1 × 16 +1 × 32 + 0 × 64 + 1 × 128
= 182

8 = 23  one digit in base 8 correspond to 3 digits in base 2


• (20)8 = (010000)2 (0)8 = (000)2 , (2)8 = (010)2
(20)8 = (010 000)2

16 = 24  one digit in base 16 correspond to 4 digits in base 2


• (1010111)2 = (57)16 (0111)2 = (7)16 , (101)2 = (5)16
(101 0111)2 = (57)16

8 = 23  one digit in base 8 correspond to 3 digits in base 2


• (1010111)2 = (127)8 (111)2 = (7)8 , (010)2 = (2)8 , (1)2 = (1)8
(1 010 111)2 = (127)8

8E316 = 3 × 160 + E × 161 + 8 × 162


• (8E3)16 = (2275)10 = 3 × 160 + 14 × 161 + 8 × 162
= 2275
182
16 = 24  one digit in base 16 correspond to 4 digits in base 2
• (F7)16 = (11110111)2 (7)16 = (0111)2 , (F)16 = (1111)2
(F7)16 = (1111 0111)2

We need first to convert (520)6 to base 10:


• (520)6 = (363)7 5206 = 0 × 60 + 2 × 61 + 5 × 62 = 0 × 1 + 2 × 6 + 5 × 36 = 19210
Then we convert the result to base 7:
192 ÷ 7 = 27 Reminder = 3
27 ÷ 7 = 3 Reminder = 6
3÷7=0 Reminder = 3

• (12212)3 = (185)9 9 = 32  one digit in base 9 correspond to 2 digits in base 3


(12)3 = (5)9 , (22)3 = (8)9 , (1)3 = (1)9
(1 22 12)3 = (185)9

• (15F)16 = (537)8 15F16 = 0001 0101 11112 = 000 101 011 1112 = 5378
University of 20 august 1955 - Skikda ‫ – ﺳﻜ�ﻜﺪة‬1955 ‫ أوت‬20 ‫ﺟﺎﻣﻌﺔ‬
Faculty of technology – Department of technology ‫كﻠ�ﺔ اﻟﺘﻜﻨﻮﻟﻮﺟ�ﺎ – ﻗﺴﻢ اﻟﺘﻜﻨﻮﻟﻮﺟ�ﺎ‬
1st year common core technology engineer ‫ﻣﺸ�ك ﻣﻬﻨﺪس ﺗﻜﻨﻮﻟﻮﺟ�ﺎ‬‫اﻟﺴﻨﺔ اﻷو� ﺟﺬع ت‬

Exercise 02:

1001 01101001 01101001


* 11 - 00100011 + 00100011
1001 01000110 10001100
1001
11011 00010101 01111111
- 00001011 + 10000001
1101
00001010 100000000
* 101
Overflow
1101 1 - 0 = 1
1 - 1 = 0
0000 0 - 0 = 0
0 - 1 = 1 with borrow
1101
1000001

Exercise 03:
For unsigned n-bit integer the values vary between 0 and 2n-1,
So for 4-bit we have the interval [0 .. 24-1] = [0 .. 15]
Unsigned integers in 4 bits
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

For signed n-bit integer with the two's complement system the values vary between -2n-1 and 2n-1-1,
So for 4-bit we have the interval [-23 .. 23-1] = [-8 .. 7]
Signed integers in 4 bits (two's complement)
0 1 2 3 4 5 6 7 -8 -7 -6 -5 -4 -3 -2 -1
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

7  0111,
3  0011,
-7  inversing (0111) + 1  1000 + 1  1001
-3  inversing (0011) + 1  1100 + 1  1101

We can’t put the number -10 in a signed 4-bit space because it is outside the limit of the interval [-8, 7]
University of 20 august 1955 - Skikda ‫ – ﺳﻜ�ﻜﺪة‬1955 ‫ أوت‬20 ‫ﺟﺎﻣﻌﺔ‬
Faculty of technology – Department of technology ‫كﻠ�ﺔ اﻟﺘﻜﻨﻮﻟﻮﺟ�ﺎ – ﻗﺴﻢ اﻟﺘﻜﻨﻮﻟﻮﺟ�ﺎ‬
1st year common core technology engineer ‫ﻣﺸ�ك ﻣﻬﻨﺪس ﺗﻜﻨﻮﻟﻮﺟ�ﺎ‬‫اﻟﺴﻨﺔ اﻷو� ﺟﺬع ت‬

Exercise 04:
25 ÷ 20 = 1 Reminder = 5
• (25)10 = ( )20 1 ÷ 20 = 0 Reminder = 1

• (62)10 = ( )20 62 ÷ 20 = 3 Reminder = 2


3 ÷ 20 = 0 Reminder = 3

360 ÷ 20 = 18 Reminder = 0
• (360)10 = ( )20
18 ÷ 20 = 0 Reminder = 18

• ( )20 = ( 78)10
20 = 18 × 200 + 3 × 201 = 18 + 60 = 78

• ( )20 = ( 7211)10 20 = 11 × 200 + 0 × 201+18 × 202 = 11 + 0 + 7200 = 7211

Exercise 05:
• First line (20 characters) + 2 characters (CR + LF) +
University Of Skikda
second line (21 characters) = 43 characters. Each Faculty Of Technology
one �its in one byte, then the total size is 43 bytes.
• 17.6 MB = 17.6*210 KB = 17.6*210*8 Kb = 144179.2 Kb;
(144179.2 Kb) / (256 Kb/s) = 563.2 seconds = 9.39 minutes.
• 24 bits BMP: 200*150*3 = 90000 bytes = 87.89 KB
256 intensities: 200*150*1 = 30000 bytes = 29.29 KB
16 intensities: 200*150*0.5 = 15000 bytes = 14.65 KB
(plus some bytes for header information in the beginning of the �ile)
University of 20 august 1955 - Skikda ‫ – ﺳﻜ�ﻜﺪة‬1955 ‫ أوت‬20 ‫ﺟﺎﻣﻌﺔ‬
Faculty of technology – Department of technology ‫كﻠ�ﺔ اﻟﺘﻜﻨﻮﻟﻮﺟ�ﺎ – ﻗﺴﻢ اﻟﺘﻜﻨﻮﻟﻮﺟ�ﺎ‬
1st year common core technology engineer ‫ﻣﺸ�ك ﻣﻬﻨﺪس ﺗﻜﻨﻮﻟﻮﺟ�ﺎ‬‫اﻟﺴﻨﺔ اﻷو� ﺟﺬع ت‬

BASE
10 8 16 2
0 0 0 0
1 1 1 1
2 2 2 10
3 3 3 11
4 4 4 100
5 5 5 101
6 6 6 110
7 7 7 111
8 10 8 1000
9 11 9 1001
10 12 A 1010
11 13 B 1011
12 14 C 1100
13 15 D 1101
14 16 E 1110
15 17 F 1111
16 20 10 10000

BASE 3 BASE 9 BASE 10


0 0 0
1 1 1
2 2 2
10 3 3
11 4 4
12 5 5
20 6 6
21 7 7
22 8 8
100 10 9
101 11 10
102 12 11
110 13 12
111 14 13
112 15 14
120 16 15
121 17 16
122 18 17
200 20 18
201 21 19
202 22 20

You might also like