0% found this document useful (0 votes)
79 views10 pages

Test Exercise Solution Cte 221

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views10 pages

Test Exercise Solution Cte 221

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

TEST EXECISE PART 1 CTE 221 SOLUTION

1. Write a simple Assembly Language program to Print ‘Hello World’ on the


screen

SOLUTION 10 marks
.mode1 small
.stack 100h
.data tot db “HelloWorld$”
.code
Start:
Mov ax, @data
Mov ds, ax
Mov ah, 09h
Mov dx, offset tot
Int 21h
Mov ah, 4ch
Int 21h
End start.
2. Itemize five (5) functions of Addressing mode in the 8086 microprocessor

SOLUTION
i. To access large address space
ii. To specify address with smaller number of bit
iii. For easy implementation of common data structure e.g Array, stack, linkers
iv. To achieve fast and less complex computation
v. To enhance easy implementation of software features. 2 marks each

3. Highlight any eight (8) General purpose Register for x86 microprocessor.

SOLUTION:

Five (5) General purpose Register

1. – AX – Accumulator register
2. – Bx – Base register
3. – Cx – Counter register
4. – Dx – Data Register or general ledger register
5. – Si – Source index pointer
6. – Di – destination index pointer
7. – bp – base pointer register
8. -sp – stack pointer register

4. Explain Assembly Register with respect to Assembly Language.

SOLUTION

Assembly Register is an internal memory storage built into the processor


chip and used to store data elements for processing without having to access
the memory hence reading data from and storing data into Register is faster
than from main memory location.
5. Enumerate five (5) Differences between Assembly Language and
Machine Language.
SOLUTION
S/N ASSEMBLY LANGUAGE MACHINE LANGUAGE
1 Instruction and registers are given names Machine language is represented using
using mnemonics strings of 0’s and 1’s,
2 It is more efficient and useful for security It is slow, tedious and cumbersome for
reason programmers
3 It requires an assembler to translate the It is a set of instruction executed directly
instruction into machine code. by the C.P.U
4 it easily readable and understood by it not easily understood by human
humans
5 It is cost effective It is expensive in program preparation and
debugging stages

6. List Merits and Demerits of HLL


SOLUTION:
Merits/Advantages of High Level Language (HLL)
i. Compilers are easy to get
ii. It is easier to use than any other programming language
iii. It is easier to understand compared to any other programming language
Demerit/Disadvantages of High Level Language
i. It takes more time to process in a computer than any other programming
language

7. Explain Low Level Language and give an example.

SOLUTION:
In low level language, programmers use English-like abbreviations to represent
elementary operations. Instructions are coded using mnemonics:
E.g. DIV, ADD, SUB, MOV.
Assembly language is an example of a low level language.

AN ASSEMBLY LANGUAGE is a low-level language for programming


computers. It implements a symbolic representation of the numeric machine
codes and other constants needed to program a particular CPU architecture.

8. The decimal equivalent of (11101010) 2


Solution
128+64+32+8+2 = 234
9. Convert binary number 101110.01101 to its Hexadecimal equivalent

Solution

 Group in four bits:

⇒ 10 1110.0110 1

 The first group is having only 2 bits. So, include two zeros on extreme side
in order to make it as group of 4 bits.
 Include three zeros on extreme side in order to make the last group also as
group of 4 bits.

⇒ 0010 1110.0110 1000

 Write the Hexa-decimal digits corresponding to each group of 4 bits.

⇒ 0010 1110.0110 10002


= 2E.6816
Therefore, the Hexadecimal equivalent of binary number 101110.01101
is 2E.68.

10.Convert binary number 11101.111011 to its Hexadecimal equivalent

⇒1 1101.1110 11

⇒0001 1101 . 11101100

⇒1 D . E C

=1D.EC16

11.Convert (101110.01101)2 to its Octal equivalent

Solution:

 Separate the binary numbers into groups of 3 bits on both sides of binary
point.

⇒101 110.011 01

 The last group is having only 2 bits. So, include one zero on extreme side
in order to make it as group of 3 bits.

⇒ 101 110.011 010

 Write the octal digits corresponding to each group of 3 bits.

⇒ 101110.0110102
= 56.328

Therefore, the octal equivalent of binary number 101110.01101 is 56.32

12.Convert (11111.1011)2 to its Octal equivalent


Solution:

 Separate the binary numbers into groups of 3 bits on both sides of binary
point.

⇒11 111. 101 1

 The last group is having only 2 bits. So, include one zero on extreme side in
order to make it as group of 3 bits.

⇒ 011 111.101 100

 Write the octal digits corresponding to each group of 3 bits.

⇒011 111.101 100

=3 7. 5 4

⇒ 011111.1011002
= 37.548

Therefore, the octal equivalent of binary number 011111.101100 is 37.548

13. Convert 53210 to BCD

SOLUTION

⇒53210

⇒ 5 3 2

= 0101 0011 0010


14. Convert 26710 to BCD

SOLUTION

⇒26710

⇒2 6 7

= 0011 0110 0111

15. Convert -17 to binary on an 8 bits machine

SOLUTION

⇒The binary equivalent 17 = 10001

⇒1 is used to represent negative magnitude

Therefore, -17

= 110001

⇒For an 8-bit machine pad with zeros to make a total of 8-bits

= 00110001

but the sign bit has to come first before the padded zeros

-17 = 10010001 on an 8-bit machine

16. Convert -28 to binary on an 8 bits machine

SOLUTION
⇒The binary equivalent 28

= 11100

⇒1 is used to represent negative magnitude

Therefore, -28

= 111100

⇒For an 8-bit machine pad with zeros to make a total of 8-bits

=00111100

⇒but the sign bit has to come first before the padded zeros

-28 = 10011100 on an 8-bit machine

17. Using a 5-bit machine add -9 and +4 and find its 2’s complement.

SOLUTION

⇒The 2’s complement of -9 =10111

⇒The sign magnitude of +4 =00100

10111

+ 00100

11011

⇒To 2’s complement the sum


⇒Find the 1’s complement of 11011 (leave the signed bit
unchanged)

= 10100

add 1 to get the 2’s complement is

10100

+ 1

10101

This is equivalent to -5

18. Using a 5-bit machine Add -9 and +9


⇒ 9=1001
⇒ +9= 01001
⇒ -9=11001
⇒1’S of -9 = 10110
⇒2’s of -9 add +1
= 10111
⇒Add -9 and +9
10111
01001
1 00000

⇒The expected answer is (ZERO) 0


1 00000

⇒the last leftmost bit is an off bit thus, it is truncated.

19.Find the 2’s complement representation of 76


SOLUTION
i. 76 X2 = 10011000
1’s complement = 01100111
2’s complement + 1
01101000

______________

20.Determine the value of the Accumulator for the instruction below


MOV A, #6AH
ADD A, #0FH
SOLUTION
6AH = 0110 1010
0FH = + 0000 1111
0111 1001
Accumulator: 79H

You might also like