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

Introduction to Computer Science_HW2

Uploaded by

kh1252689
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)
11 views

Introduction to Computer Science_HW2

Uploaded by

kh1252689
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/ 2

Introduction to Computer Science

Homework_2
1 Show the result of the following operations. (ch.4)
a NOT (99)16
b NOT (FF)16
c NOT (00)16
d NOT (01)16

2 Show the result of the following operations. (ch.4)


a (99)16 OR (99)16
b (99)16 OR (00)16
c (99)16 OR (FF)16
d (FF)16 OR (FF)16

3 Using a 16-bit allocation, first convert each of the following numbers to two’s complement, do the
operation, and the convert the result to decimal. (ch.4)
a 161 + 1023
b 161 - 1023
c -161 + 1023
d -161 – 1023

4 Using an 8-bit allocation, first convert each of the following numbers to sign-and-magnitude
representation, do the operation, and the convert the result to decimal. (ch.4)
a 19 + 23
b 19 - 23
c -19 + 23
d -19 – 23

5 An imaginary computer has sixteen data register (R0 to R15), 1024 words in memory, and 16 different
instructions (add, subtract, and so on). What is the minimum size of an instruction in bits if a typical
instruction uses the following format: instruction M R2 (ch.5)

6 In Question 5, if the computer uses the same size of word for data and instructions, what is the size of
each data register. (ch.5)
7 A computer uses memory-mapped I/O addressing, the address bus uses 10 lines (10 bits). If memory
made up of 1,000 words, how many four-register controllers can be accessed by the computer.
(ch.5)

8 We need to flip the three rightmost and the two leftmost bits of a pattern. Show the mask and the
operations. (ch.4)

9 Using the instruction set of the simple computer in Section 5.7, write the code for a program that
perform the following calculation:
D ← A+B+C
A, B, C, and D are integers in two’s complement format. The user types the value of A, B, and C, and
the value of D is displayed on the monitor. (ch.5)

10 Using the instruction set of the simple computer in Section 5.7, write the code for a program that
perform the following calculation:
B ← A-2
A and 2 are integers in two’s complement format. The user types the value of A and the value of D is
displayed on the monitor. (Hint: use the decrement instruction.) (ch.5)

You might also like