MERU UNIVERSITY OF SCIENCE AND TECHNOLOGY
P.O. Box 972-60200 – Meru-Kenya.
Tel: +254(0) 799 529 958, +254(0) 799 529 959, +254 (0)712 524 293
Website: [Link] Email: info@[Link]
UNIVERSITY EXAMINATIONS 2024/2025
SECOND YEAR SECOND SEMESTER EXAMINATION FOR THE DEGREE OF
BACHELOR OF SCIENCE IN COMPUTER SCIENCE, BACHELOR OF SCIENCE IN
COMPUTER TECHNOLOGY AND BACHELOR OF SCIENCE IN COMPUTER
SECURITY AND FORENSICS
CCS 3252: ASSEMBLY LANGUAGE PROGRAMMING
DATE: APRIL 2025 TIME: 2 HOURS
INSTRUCTIONS: Answer Question ONE and any other TWO questions.
QUESTION ONE (30 MARKS)
a) Describe the relationship between machine language and assembly language. (4 marks)
b) Distinguish between the following assembly language instructions
i. Add vs Addi (2 marks)
ii. Mult vs Mul (2 marks)
c) Explain how cache memory helps with the overall performance (2 marks)
d) For each of the following integer numbers: -50 and -100. (Assume they are 8-bit
addressable in 2-bit chunks)
i. write in two’s complement binary form (2 marks)
ii. convert to little endian (2 marks)
e) Provide hex, IEEE 32-bit floating-point representation of -17.125 floating-point value.
(5 marks)
f) Given the expression: c = (a < b) || ((a+b) == 10). Convert the expression to MIPS
Assembly language instructions. (Assume: a: t0, b: t1 and c: t2). (6 marks)
g) Describe the hi and lo registers as used in MIPS processors. (2 marks)
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations
Page | 1
h) With the help of diagrams show how many bytes are needed to store each MIPS
instruction. (3 marks)
QUESTION TWO (20 MARKS)
a) Describe the assembly language instructions a compiler uses to implement a
while loop in MIPS processor. (6 marks)
b) Given the pseudocode:
# Pseudocode:
# sum = 0
# for (i = 0; i < n; i++) {
# sum = sum + i
# }
# Registers: n: $t0, i: $t1, sum: $t2
Write the MIPS assembly instructions for the pseudocode (8 marks)
c) Contrast the usage of registers and the stack for variables in procedures. (6 marks)
QUESTION THREE (20 MARKS)
a) Explain the following directives as used in MIPS assembly Language
i. .byte (1 mark)
ii. .word (1 mark)
iii. .half (1 mark)
iv. .asciiz (1 mark)
v. .space <n> (1 mark)
vi. .float (1 mark)
b) Describe the convention used by MIPS procedures to return values. (3 marks)
c) If a 500 MHz machine takes one clock cycle to fetch and execute an instruction, then
what is the instruction execution rate of the machine? (6 marks)
d) Let’s suppose we have a 40-year-old computer that has an instruction execution rate of
one thousand instructions per second. How long would it take in days, hours, and minutes
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations
Page | 2
to execute the same number of instructions you derived for the 500 MHz machine?
(5 marks)
QUESTION FOUR (20 MARKS)
a) A parallelepiped rectangle has the following dimensions; length = 73, width = 14 and
height = 16. Write a MIPS assembly program to:
i. Calculate the volume. (6 marks)
ii. Calculate the surface area of the rectangle. (6 marks)
b) Explain the following addressing modes as used in the MIPS assembly Language
i. Register addressing mode. (2 marks)
ii. Base addressing mode. (2 marks)
iii. Immediate addressing mode. (2 marks)
iv. PC-relative addressing mode. (2 marks)
QUESTION FIVE (20 MARKS)
a) A parallelepiped rectangle has the following dimensions; length = 73, width = 14 and
height = 16. Write a MIPS assembly program to calculate the volume and the surface area
of the rectangular. (12 marks)
b) Describe the indirect addressing mode. (3 marks)
c) Give the algorithm to convert a number to a decimal ASCII string. (5 marks)
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations
Page | 3