EXAMSHARE

Western Delta University, Oghara Delta State

department of computer science
college of computing
western delta university

second semester examination 2022/2023 session

CSC202 - assembly language programming time: 2hrs

answer question 1 and any other THREE questions


  1. Question 1

    1. Write a complete assembly language program that computes circumference of a circle given as πr, where r is the radius of the circle, using the relevant functions in io.H (5 marks)
    2. Define the following:
      1. Register (2 marks)
      2. Directive (2 marks)
      1. Give the syntax of an assembly language directive (2 marks)
      2. State two examples of a directive (2 marks)
      3. Given the decimal number 27.62510, calculate its binary equivalent (4 marks)
      4. Given the hexadecimal number 1516, calculate its binary equivalent (4 marks)
    3. Write an assembly language representation for the following C program segment:
      sum = 0, i = 0, x = 10;
      while (i <= 10)
      {
      sum = sum + x;
      x = x + 2;
      i = i + 2;
      }
      (4 marks)
  2. Question 2

    1. Identify the addressing mode in the following instructions:
      mov ax, 0ah
      mov bx, array + 10h
      mov ax, [si] + 16
      mov ax, [si]
      inc cl
      (5 marks)
      1. Interpret the following instruction: array DW 100 DUP(0) (2 marks)
      2. State two limitations of the MOV instruction (2 marks)
      1. State the function of the movsb instruction (2 marks)
      2. Write an assembly language program segment to move the string: "Sessional Examination for 2021/2022 is in Progress" from its original location to a new location. (4 marks)
  3. Question 3

    1. Define an Interrupt handler (2 marks)
    2. Given that the BIOS keyboard services is INT 16h, calculate:
      1. The address of the interrupt vector table (4 marks)
      2. State the last instruction in an interrupt handler (2 marks)
      3. State the function of the instruction stated in (bii) (2 marks)
      4. What is the result of the execution of the instruction stated in (bii) (2 marks)
    3. Write an assembly language program segment that send a character to the printer using a DOS function call. (3 marks)
  4. Question 4

    1. Define the following:
      1. Macro
      2. Macro processor
      (4 marks)
    2. Given that s = x2y + xy;
      1. Write a macro to compute s (3 marks)
      2. Write a FAR procedure to calculate s (4 marks)
      3. Highlight two differences between macro and procedure (4 marks)
  5. Question 5

    1. In a word division using IDIV instruction, state the register(s) that represents the following:
      1. Dividend
      2. Quotient
      3. Remainder
      (6 marks)
    2. Write an assembly language program segment to demonstrate how the following DOS function service is used: 09h (3 marks)
    3. The following are the scores of Efe in mid-semester test: 56 67 89 82 64. Write an assembly language program segment that declares the scores, computes the total and average scores. (6 marks)
  6. Question 6

    1. State the function of LEA. Give one example of assembly instruction illustrating the use of LEA (4 marks)
    2. Write an assembly language representation for the following C program segment
      y1 = 25;
      y2 = 30;
      printf("Enter value for variable a: ");
      scanf("%d", &a);
      if (a < 60)
      y1 = y1 + 10;
      printf("%d", y1);
      else
      y2 = y2 - 5;
      printf("%d", y1);
      (6 marks)
    3. Define Interrupt (7 marks)
    4. Convert 25616 to its decimal equivalent (3 marks)