Professional Documents
Culture Documents
Good effort
See solution file for detailed solution. Follow this
marked file for detailed marking
Assignment #01
CS101
NIAZ ALI (BC210205800)
Question No. 1
Solution:
Consider the following table when the PROGRAM COUNTER take “E2” as initial value and
then incremented by 2 till the end. For each value of the program counter the machine
language code is fetched into the instruction register. For each value of the program counter
the corresponding instruction code is written in the same row and is explained.
Ans (1): When the machine halts register 1 has content: 03.
Ans (2): When the halt instruction is executed the bit pattern at memory address F3 is: 03.
Ans (3): The machine instruction at EE is never executed before the machine halts.
Ans (4): the content of register 0 is: 03 after the instruction at address EC is executed
Ans (5): the content of register 2 is: 05 when the instruction at address F0 is executed
Marks: 10
correct solution
Question No. 2
1 1
(a): Perform binary addition on 20 and 7
16 4
Solution:
1 1 1 1
16 8 4 2 1 Radix
2 4 8 16
1
20
16 1 0 1 0 0 . 0 0 0 1
1
7 0 0 1 1 1 . 0 1 0 0
4
5
27 1 1 0 1 1 . 0 1 0 1
16
(7 14 ) =( 00111.0100 )
10
2
5
(
( 10100.001 )2+ ( 00111.0100 )2=( 11011.0101 )2= 27
16 )
10
Marks: 5
correct solution
(b): Convert the following binary number into ASCII code and then into its equivalent decimal
representation. 01001001010000010100110101011100
Solution:
Each ASCII code consists of 8 bits (1 byte). So we have the following ASCII codes
01001001
01000001
01001101
01011100
From appendix A of the text book, the above codes represents the following characters
01001001 I
01000001 A
01001101 M
01011100 \
Each of the above codes is converted into decimal as follows:
Marks: 5
correct solution
The End