You are on page 1of 57

PRINCIPLES OF COMPUTER AND

COMPOSITION

Course Information

Dr. Yiju Wang


School of Aerospace and Engineering, Xiamen University
wangyiju@xmu.edu.my
Office: A1-425
CHAPTER 1

DATA REPRESENTATION AND MANIPULATION


Tutorial/Lab
3

 1. Convert the following binary numbers to their


decimal equivalents(Solve the problem manually
and check the your result with a language C
program.):
 a. 01100
 b. 0010011
 c. 01011101
 d. 11111001
 e. 1010110
Tutorial/Lab
4

 1. Solution
Tutorial/Lab
5

 1. Solution
Tutorial/Lab
6

 2 Convert the following decimal numbers to their


binary equivalents(Solve the problem manually
and check the your result with a language C
program.):
 a. 64
 b. 100
 c. 111
 d. 145
 e. 255
Tutorial/Lab
7

 2. Solution
Tutorial/Lab
8

 2. Solution
Tutorial/Lab
9

 2. Solution
Tutorial/Lab
10

 3 Express the following octal numbers in


hexadecimal notation(Solve the problem manually
and check the your result with a language C
program.):
 a. 12
 b. 5655
 c. 2550276
 d. 76545336
 e. 3726755
Tutorial/Lab
11

 3. Solution
Tutorial/Lab
12

 3. Solution
Tutorial/Lab
13

 4 Convert the following hexadecimal numbers to


their decimal equivalents(Solve the problem
manually and check the your result with a
language C program.):
 a. C
 b. 9F
 c. D52
 d. 67E
 E. ABCD
Tutorial/Lab
14

 4. Solution
Tutorial/Lab
15

 4. Solution
Tutorial/Lab
16

 5 Convert the following decimal numbers to their


hexadecimal equivalents(Solve the problem
manually and check the your result with a
language C program.):
 a. 16
 b. 80
 c. 2560
 d. 3000
 e. 62500
Tutorial/Lab
17

 5. Solution
Tutorial/Lab
18

 5. Solution
Tutorial/Lab
19

 5. Solution
Tutorial/Lab
20

 6. Convert the following hexadecimal numbers to


their binary equivalents (Solve the problem
manually.):
 a. E
 b. 1C
 c. A64
Tutorial/Lab
21

 6. Solution
 a. E=1110B
 b. 1C=00011100B
 c. A64=101001100100B
Tutorial/Lab
22

 6. Solution
 With C++
Tutorial/Lab
23

 7. What is your computer wordsize? What is the


meaning of the computer wordsize?
Tutorial/Lab
24

 7. Solution
 64-bit
 Parallel transmission bits at the same time/moment at
most on the bus
Tutorial/Lab
25

 8. What is your computer main memory


size/capacity? How many bytes does it has?
Tutorial/Lab
26

 8. Solution
 64GB
 64*2^30 Bytes
 64*2^30 locations
Tutorial/Lab
27

 9. What is bit, byte, word and double word?


Tutorial/Lab
28

 9. Solution
 Bit(0 or 1)
 Byte(8 bits)
 Word(16 bits)
 Double word(32 bits).
Tutorial/Lab
29

 10. What is 1K, 1M, 1G and 1T?


Tutorial/Lab
30

 10. Solution
 1K=2^10
 1M=2^20
 1G=2^30
 1T=2^40
Tutorial/Lab
31

 11. Tell the data types of Language C?


Tutorial/Lab
32

 11. Solution
Tutorial/Lab
33

 12. Tell how many bits it is for language C integer


with your computer?
Tutorial/Lab
34

 12. Solution
Tutorial/Lab
35

 13. Please predict the address difference for a and


b in the following program, and check the result
with your computer.
Tutorial/Lab
36

 13. Solution
Tutorial/Lab
37

 14. It is shown in the following figure that the


address of a and b are both 32-bit, why it is 32-bit?
Tutorial/Lab
38

 14. Solution
 Because of the virtual address mode of CPU to access
memory
 The virtual address in the figure is not 64-bit physical
address, but 32-bit virtual/linear address.
Tutorial/Lab
39

 15. Please tell the size and range for different data
types of integer in language C with your
computer?
Tutorial/Lab
40

 15. Solution
 Type on 16-bit computer
Tutorial/Lab
41

 15. Solution
 Type on 32-bit computer
Tutorial/Lab
42

 16. Please tell the size and range for different data
types of character in language C with your
computer?
Tutorial/Lab
43

 16. Solution
 Type on 16-bit computer
Tutorial/Lab
44

 16. Solution
 Type on 32-bit computer
Tutorial/Lab
45

 17. Please tell the size and range for different data
types of float in language C with your computer?
Tutorial/Lab
46

 17. Solution
 Type on 16-bit computer
Tutorial/Lab
47

 17. Solution
 Type on 32-bit computer
Tutorial/Lab
48

 18. What is the difference between the ASCII code


of lower-case letter and upper-case letter? Write a
programming C language program to input an
lower-case letter and output its upper-case letter.
Tutorial/Lab
49

 18. Solution
 A-Z, 41H-5AH
 a-z, 61H-7AH
 The difference between the ASCII code of lower-case
letter and upper-case letter is 61H-41H=20H=32 in
decimal
Tutorial/Lab
50

 18. Solution
Tutorial/Lab
51

 18. Solution
Tutorial/Lab
52

 19. It is shown in the following figure that the


address of b is less/lower than the address of a. Is
it possible that the address of b is more/higher
than the address of a?
Tutorial/Lab
53

 19. Solution
 It is possible.
 It usually depends on computer operation system or
compiler
Tutorial/Lab
54

 20. It is shown in the figure for 32-bit computer


the int data type size is 32-bit. Why its size still 32-
bit for 64-bit computer?
Tutorial/Lab
55

 20. Solution
 Software has not been updated/developed
Tutorial/Lab
56

 21. What conclusion can you have from the


following 2 figures.
Tutorial/Lab
57

 21. Solution
 The virtual address could be different bits even for the
same computer, because of different compilers.
 The virtual address could usually be 32-bit, 48-bit, or
64-bit.

You might also like