Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Introduction to Computer Science

Homework 12/04/2024
Due: 26/04/2024

1. (10%) If each cell’s address can be represented by two hexadecimal digits, how
many cells can be in a computer's main memory? What if four hexadecimal digits
are used?

If each cell's address is represented by 2 hexadecimal digits, then there are 16 x


16 = 256 possible locations in memory. This means that there can be 256 cells in
memory. If 4 hexadecimal digits are used, there are 16 x 16 x 16 x 16 = 65536
possible locations, and therefore 65,536 cells in memory.

2. (10%) What input bit patterns will cause the following circuit to produce an
output of 1?

Upper input= U

Lower input=P

U P NOT NOT AND NAND

1 0 0 1 0 1

1 1 0 0 0 1

0 0 1 1 1 0

0 1 1 0 0 1

The inputs marked in blue will cause a result 1


3. (10%) If the output of an OR gate is passed through a NOT gate, the combination
computes the Boolean operation called NOR, which only has an output of 1 when
both its inputs are 0. The symbol for a NOR gate is the same as an OR gate except
that it has a circle at its output. The following is a circuit containing an AND gate
and two NOR gates. What Boolean operation does the circuit compute?

U P AND NOR Final NOR


1 0 0 0 1
1 1 1 0 0
0 0 0 1 0
0 1 0 0 1
Upper input= U
Lower input=P
The inputs marked in blue will cause a result 1.

(10%) 4. Suppose an image is represented on a display screen by a square array


containing 256 columns and 256 rows of pixels. If 3 bytes are required to encode
the color and another 8 bits to encode the intensity for each pixel, how many
byte-size memory cells are required to hold the entire image?

Since 8 bits = 1 byte, we have a total of 4 bytes that will be used per pixel
The total of pixels equal 256*256=65536
So, the entire byte-size memory cells that are required to hold the entire image is
65536*4➔ 262144 bytes

5. (10%) Solve the following problems by translating the values into two’s
complement notation (using patterns of 5 bits), converting any subtraction
problem to an equivalent addition problem, and performing that addition.
Check your work by converting your answer to base ten notation. (watch out
for overflow)
(a) 5+1 =6

00101+00001=00110
Check= 0+0+22 + 21 +0=6

(b) 5-1 =4

00101+11111=1 00100 (truncate the first 1)

(c) 12-5

01100+11011= 1 00111 (truncate the first 1)

(d) 12+5=17

01100+00101=10001

24 + 0 + 0 + 0 + 20 = 17

(e) 5-11

00101+ 10101=11010

6. (10%) What is the best approximation to the square root of 2 that can be
expressed in the 8-bit floating-point shown below? What value is obtained if
this approximation is squared by a machine using this floating-point format?

3
√2=1.4142 ➔√2 = 1 8 APROX 1.011

1.011 × 2101

0.375 × 2 = 0.75

0.75 × 2 = 1.5

1.5 × 2 = 1

01011011
7. (10%) What kind of logic gate do we need to design an overflow detection
circuit?

I say that a XOR gate will do it.


Because Overflow is detected when XOR(Carry in, Carry out) = 1 for the most
significant bit.

8. (20%) What is LZW compression? If LZW compression, starting with the


dictionary containing x, y, and a space, were used. What would be the
encoded version of the message xyx yxxxy xyx yxxxy yxxxy?

The LZW algorithm is a compression technique. It is lossless, meaning no data


is lost when compressing.
Starting with the dictionary containing x, y, and a space, were used the
encoded version of the message xyx yxxxy xyx yxxxy yxxxy should be
121321112343535

9. (10%) MP3 takes advantage of the properties of the human ear, removing
details that the human ear cannot perceive, which is called temporal masking
and frequency masking. Please explain temporal and frequency maskings.

Frequency Masking:

Frequency Masking occurs when a sound is made inaudible by a noise or unwanted


sound of the same duration as the original sound. For example, a powerful spike at
1 kHz will tend to mask out a lower-level tone at 1.1 kHz. Also, two sine tones at 440
and 450 Hz can be perceived clearly when separated. They cannot be perceived clearly
when presented simultaneously.

Temporal masking:

Temporal masking occurs when a sudden stimulus sound makes inaudible other sounds
which are present immediately preceding or following the stimulus.

You might also like