0% found this document useful (0 votes)
10 views

Week2 Tutorial Chapter1 With Solution

This document provides information about a course on principles of computer and composition. It includes the course instructor's information and covers Chapter 1 on data representation and manipulation. The chapter discusses different number systems for representing integers like binary, hexadecimal, sign-magnitude, one's complement, and two's complement. It includes examples of converting between different representations and performing arithmetic operations in two's complement format. There are also examples of addressing memory locations based on the number of address lines.

Uploaded by

CST2109168
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Week2 Tutorial Chapter1 With Solution

This document provides information about a course on principles of computer and composition. It includes the course instructor's information and covers Chapter 1 on data representation and manipulation. The chapter discusses different number systems for representing integers like binary, hexadecimal, sign-magnitude, one's complement, and two's complement. It includes examples of converting between different representations and performing arithmetic operations in two's complement format. There are also examples of addressing memory locations based on the number of address lines.

Uploaded by

CST2109168
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

PRINCIPLES OF COMPUTER AND

COMPOSITION

Course Information

Dr. Yiju Wang


School of Aerospace and Engineering, Xiamen University
[email protected]
Office: A1-425
CHAPTER 1

DATA REPRESENTATION AND MANIPULATION


Tutorial/Lab
3

 1. Given a negative number -24, represent it with


three representations.
Tutorial/Lab
4

 1. Solution
Tutorial/Lab
5

 2. Given the binary signed integers in two’s


Complement representation below:
 A=10101001 B=11101010
 C=10000000 D=01011001
 1)Find the decimal equivalent of A, B, C, and D.
 2) Convert A, B, C, and D into sign-magnitude and one’s
Complement.
 3)Show how the arithmetic operations A+B, A-B, A-C, and
A-D are performed in Two’s Complement representation
by a computer if you want to have the supposed right
result.
Tutorial/Lab
6

 2. Solution
Tutorial/Lab
7

 2. Solution
Tutorial/Lab
8

 2. Solution
Tutorial/Lab
9

 3. Think the result of Addition of +1D and -1D with


8-bit and 16-bit signed integer respectively.
Tutorial/Lab
10

 3. Solution
 Addition of +1D and -1D with 8-bit signed integer
 01H+FFH=00H
Tutorial/Lab
11

 3. Solution
 Addition of +1D and -1D with 16-bit signed integer
 0001H+FFFFH=0000H
Tutorial/Lab
12

 4. If there is a binary number 01010011, what


could it be?
Tutorial/Lab
13

 4. Solution
 Unsigned integer 01010011B=53H=5*16+3=83D
 Signed integer 01010011B=53H=5*16+3=83D
 BCD code 01010011B=53D
 ASCII code 01010011B=‘S’
Tutorial/Lab
14

 5. If there is a binary number 10011000, what


could it be?
Tutorial/Lab
15

 5. Solution
 Unsigned integer 10011000B=98H=9*16+8=152D
 Signed integer 10011000B is a negative integer, its
negation is
01100111B+1=01101000B=68H=6*16+8=104D,
So 10011000B is -104D.
 BCD code 10011000B=98H
Tutorial/Lab
16

 6. Find directly the result of negation of the


following signed integers:
 C4A3
 5BE2
Tutorial/Lab
17

 6. Solution
Tutorial/Lab
18

 7. For the machine code of integer addition


FFH+01H, what it stands for with decimal
representation addition?
Tutorial/Lab
19

 7. Solution
 Unsigned integer FFH+01H=00H, 255D+1D=256D, is
there something wrong?
 Signed integer FFH+01H=00H, -1D+1D=0D
Tutorial/Lab
20

 8. List the range of three representations for


signed integers with 4-bit, 8-bit and 16-bit word
size.
Tutorial/Lab
21

 8. Solution

Sign-magnitude One’s Complements Two’s Complements

4-bit -7~+7 -7~+7 -8~+7

8-bit -127~+127 -127~+127 -128~+127

16-bit -32767~+32767 -32767~+32767 -32768~+32767


Tutorial/Lab
22

 9. Tell the address range when the address line of


the computer is 20-bit, 32-bit, or 64-bit.
Tutorial/Lab
23

 9. Solution
 20-bit, 00000H-FFFFFH
 32-bit, 00000000H-FFFFFFFFH
 64-bit, 0000000000000000H-FFFFFFFFFFFFFFFFH
Tutorial/Lab
24

 10. Convert the following signed integers from the


given number system to the other number systems
as listed below. Indicate the unavailable answer, if
any.
Tutorial/Lab
25

 10. Solution
 Please use the afforded T2-10.c to check the result
and think about sth.
Decimal Sign-magnitude One’s Complement Two’s Complement

715 02CB 02CB 02CB


-367 816F FE90 FE91
-5292 94AC EB53 EB54
29645 73CD 73CD 73CD
-14913 BA41 C5BE C5BF
-32768 Out of range Out of range 8000
-10623 A97F D680 D681
21369 5379 5379 5379

You might also like