Download Practice exercises on binary and hexadecimals numbers

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Large numbers wikipedia , lookup

Arithmetic wikipedia , lookup

Location arithmetic wikipedia , lookup

Addition wikipedia , lookup

Positional notation wikipedia , lookup

Elementary mathematics wikipedia , lookup

Transcript
CIS 120
Review for test 1
1. Do the problems from Binary and hexadecimal practice posted in the Handouts in Koala Connection.
Practice exercises on binary and hexadecimals numbers
Decimal
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Binary
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
Hexadecimal
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
1. Convert to decimal the following binary numbers:
(a) 1011
8 + 2 + 1 = 11
(b) 10010
16 + 2 = 18
(c) 01000101
64 + 4 + 1 = 69
(d) 1100010110
512+256+16+4+2=790
2. Convert to binary the following decimal numbers:
(a) 17
17 -16= 1 1 -1 =0
(b) 20
20 -16 = 4, 4 – 4 = 0
(c) 157
157 – 128 = 29, 29 – 16 = 13, 13 – 8 = 5
5 – 4 =1, 1 – 1 = 0
(d) 245
245 – 128 = 117, 117 – 64 = 53, 53 – 32 = 21,
21 – 16 = 5, 5 – 4 1, 1 -1 1= 0
256
17
20
157
245
128
1
1
64
1
32
1
16
1
1
1
1
17 = 100012
20 = 101002
157 = 100111012
245 = 111101012
8
4
2
1
1
1
1
1
1
1
1
3. Convert to hexadecimal the following binary numbers:
(a) 100100111011
1001 0011 1011 = 93B16
(b) 110100111111
1101 0011 1111 = D3F16
(c) 1101001011
11 0100 1011 = 34B16
(d) 1111010010110
1 1110 1001 0110 = 1E9616
4. Convert to binary the following hexadecimal numbers:
(a) 3A9
0011 1010 10012
(b) 8B2
1000 1011 00102
(c) AFE3
1010 1111 1110 00112
(d) F45B
1111 0100 0101 10112
5. Convert the following hexadecimal numbers to decimal numbers.
(a) A516
10 ∙ 16 + 5 = 165
(b) 13B16
1 ∙ 162 + 3 ∙16 +11 = 256 +48 + 11 = 315
(c) F2A16
15 ∙ 162 + 2 ∙16 +10 = 3840 +32 + 10 = 3882
2. How many binary numbers can be represented with 6 bits? What is the decimal value of the largest
binary number represented with 6 bits?
26 = 64 numbers can be represented with 6 bits. The largest 6-bits binary number is 1111112 as a
binary and 63 (=32+16+8+4+2+1) as a decimal number.
3. What is analog data?
Analog data is data that is continuous and infinite. It is the contrary to discrete data which is finite or
possibly infinite but with gaps between any two data elements. Examples of analog data are
pictures, sounds, real numbers. Examples of discrete data are integers, letters or characters.
4. Why data must be digitized to be processed by the computer?
All data in a computer is represented by a combination of bits (0 or 1). This is discrete data. So in
order to be represented to be represented in a computer, data must be digitized, which means it
must be made discrete and converted to bits.
5. Determine whether each statement is true or false.
a. Raster graphic refers to the process of representing an image in which the rectangle that
includes the image is divided into a grid where each cell of the grid is assigned a color. TRUE
b. In the RGB model, a color is always represented with 3 bytes, one byte for red, one for green
and one for blue. FALSE. This is true if we use TrueColor, but there are other RGB color
representations using either fewer bits (such as HiColor that uses only 15 or 16 bits) or more bits
(some use 32 bits).
c. The color with RGB value (60, 3, 60) is a pale purple. FALSE. The color is purple since it is mainly a
mixture of red and blue but since the R, G and B values are low the color is dark. The lower the
values the darker the color. (0,0,0) is black and (255,255,255) is white.
d. Pictures taken from the same camera with identical settings (for picture size, RGB setting etc…)
will have the same file size when saved as a JPG file. FALSE. When saving in the JPG format the
file is compressed, and the amount of compression depends on the picture. Images with many
details will not be compressed as much as images that are rather uniform. Remember that
compression is a way to make the size of files smaller. Typically pictures or sound files are very
large and need to be compressed for many practical purposes.
e. In the RGB model, a bright color is represented with more bits than dark color. FALSE. In a given
RGB, model all colors are represented by the same number of bits.
f. The process to digitize sound is called sampling. TRUE
g. The amplitude of a sound wave corresponds to pitch of the sound (how high or low the sound
is). FALSE. The amplitude of the sound wave corresponds to the volume of the sound, i.e., how
loud the sound is.
h. The frequency of a sound wave is measured in Hertz. TRUE
6. What can you say about this sound file from this Audacity screen?
7.
8.
9.
10.
We see about 25 seconds of the sound track from 40 seconds to 75 seconds. The sound is first very
soft. It increases very slightly and lowers down again between 48 seconds and 51 seconds and again
between 51 and 54, then increases a little more between 54 seconds and 60 seconds. Finally the
sounds get much louder between 64 seconds and 66 seconds, when it tapers off and becomes very
soft again. From the screen we cannot say anything about the pitch.
Give the scientific notation of the following numbers.
a. 32403.23 = 3.240323 ⋅ 104
c. 0.02302 = 2.302 ⋅ 10-2
b. -1,098,234 = - 1.098234 ⋅ 106
d. 0.0000123901= 1.23901 ⋅ 10-5
Give the 10-digit floating- point representations with a 6-digit mantissa and 3-digit exponent of the
following numbers.
a. 345,809  +345809+00
b. -22,039,343  -220393+02
c. 345  +345000-03
d. 0.0987  +987000-07
e. -0.00009801998191  -980200-10
What is the largest real number that can be represented by the 10-digit floating- point
representation with a 6-digit mantissa and 3-digit exponent?
+999999+99
The largest real number that can be represented by the 10-digit floating- point representation with a
6-digit mantissa and 3-digit exponent is 999,999 ⋅ 1099.
Give 2 numbers that have the same 10-digit floating- point representation with a 6-digit mantissa
and 3-digit exponent than -22,039,343.
The 10-digit floating- point representation with a 6-digit mantissa and 3-digit exponent
of -22,039,343 is -220393+02. Two other numbers with same representation: -22,039,300 and
-22,039,310.
11. Consider the two colors with RGB representations color1 = (70, 70, 70) and color2= (210, 210, 210).
a. Which of the two colors is the darkest? Color1 is the darkest since the RGB values are lower.
b. What colors are color1 and color2? Both colors are grays. When the values of R, G and B are all
the same the color is gray, with, at the extreme ends of the spectrum, black when the values are
all zeros and white when all the values are 255.