UNIVERSITY EXAMINATIONS: 2021/2022
EXAMINATION FOR DEGREE IN BACHELOR OF SCIENCE IN
SOFTWARE DEVELOPMENT
BSD 1308: ASSEMBLY PROGRAMMMING
MODE: PART TIME/FULL TIME/DISTANCE LEARNING
ORDINARY EXAMINATIONS
DATE: DECEMBER.2021 TIME: 2 HOURS
INSTRUCTIONS: Answer QUESTION ONE and any other TWO
QUESTION TWO [20 MARKS] – COMPULSORY
a). Differentiate between a one-pass and a two-pass assembler 4 Marks
b). Explain the difference between register and immediate addresses in assembly.
4 Marks
c). In assembly language, a procedure is described as a collection of instructions to which we
can direct the flow of the program and once the execution of the instructions is
completed, the control is given back to the next line to the process of the code that called
the procedure. Write an assembly program, assuming you are working with the
following procedures:
• Main: This procedure will receive the radius of a circle then pass the value to procedure
called Circumference and another procedure called Area.
• Circumference: This procedure receives the value of the radius then calculates the
circumference and displays it in 2 decimal places.
• Area: This procedure receives radius then calculates and displays the area of a circle in 3
decimal places.
Assume PI (π=3.14) is a constant. 12 Marks
QUESTION TWO [15 MARKS]
a). Differentiate a conditional and unconditional jump in assembly. 4 Marks
b). You are required to develop a guessing game where the user has to guess a secret
number. If the guess is right then the program will display a message for the score but if
wrong, the program will display message that the player has lost.
i). From the case above draw a flowchart to show the program design. 4 Marks
ii). Implement the design in a) using assembly language. 7 Marks
QUESTION THREE [15 MARKS]
An array is defined as a data structure that stores elements that are homogenous in contiguous
locations. Assuming you have 10 scores obtained by students in a test:
50,65,77,58,95,81,75,63,50 and 72. Write an assembly program to accomplish the following
tasks:
a) Display the addresses of the last three scores 7 Marks
b) Display the sum of all the scores 8 Marks
QUESTION FOUR [15 MARKS]
a). Briefly describe the following flags as used in assembly programming:
i). Parity flag
ii). Zero flag
iii). Overflow flag 6 Marks
b). Write an assembly program to receive a number keyed in by the user then print all odd
numbers (without duplicates) that are less or equal to that number and display these
numbers in ascending order 9 Marks