CSCI 360 Spring 2014

Sample Questions for Final Exam Answer Key


Part I. Multiple Choice

Select the answer that is most correct

1. The maximum value for D in a D(X,B) address is _____ bytes.

   a. 1000
   b. 5000
   c. 4096
   d. 4095
   e. there is no limit

2. The instruction L  2,5 will

   a. copy the contents of register 5 into register 2
   b. copy the contents of register 2 into register 5
   c. abend the program with a specification exception
   d. put the value 00000005 into register 2
   e. load 4 bytes into register 2 from address 000005

3. Which of the following is the best instruction to insert one byte
   from storage area FLAG into the LEFTMOST byte of a register?

   a. IC   3,FLAG
   b. L    3,FLAG
   c. LH   3,FLAG
   d. ICM  3,B'0001',FLAG
   e. ICM  3,B'1000',FLAG

4. Which of the following will initialize register 5 to 0?

   a. ZAP  5,5
   b. XR   5,5
   c. XC   5,5
   d. MVC  5,=X'0'
   e. all of the above will initialize register 5 to 0

5. Which of the following system variables is used to create unique
   labels for storage areas and branches?

   a. &SYSUNIQUE
   b. &SYSCNT
   c. &SYSNDX
   d. &SYSLIST
   e. &SYSGLOBAL

6. Which of the following statements about logical operations is true?

   a. ANDing a bit with 0 sets the bit to 0
   b. ORing a bit with 1 always changes the bit to its opposite value
   c. XORing a bit with 0 sets the bit to 1
   d. ANDing a bit with 1 sets the bit to 1
   e. XORing a bit with 0 sets the bit to 0

7. The register save area for standard linkage conventions is

   a. 16 fullwords long
   b. 18 fullwords long
   c. 18 bytes long
   d. 16 bytes long
   e. none of the above

8. A typical use of the EX instruction is to

   a. Move a variable length string of characters from one area to another
   b. Establish addressibility for a DSECT
   c. Reload registers before returning to a calling routine
   d. Call an external subroutine
   e. None of the above

9. Global set symbols must be declared before local set symbols

   a. true      b. false

Part II. Short Answer

  1. Multiply the contents of register 3 by 64 without altering/referencing another register.

  2.   SLA   3,6
  3. Define a scan table that can be used to find the first occurrence of a non-digit.

  4.   SCANTAB  DC    256X'FF'
               ORG   SCANTAB+C'0'
               DC    10X'00'
               ORG
    
  5. Write the code to compare an unknown number of bytes pointed to by register 8 with the contents of FIELD. FIELD may be smaller, bigger, or the same size as the bytes pointed to by register 8. The length of the field pointed to by register 8 is stored in register 3. Be sure to give the instruction required to actually perform the comparison.

  6.            BCTR  3,0
               EX    3,COMPIT
      ...
      ...         
      COMPIT   CLC   0(0,8),FIELD
    
  7. Define a scan table that can be used to change digits. 0 will become 9, 1 will become 8, 2 will become 7,...and vice versa.

  8.   NUMTAB   DC    256X'FF'
               ORG   NUMTAB+C'0'
               DC    X'F9F8F7F6F5F4F3F2F1F0'
               ORG
    
  9. Using the scan table defined in the previous question, change all of the digits in the 12 byte string stored at STRING.

  10.   TR    STRING(12),NUMTAB
  11. Change bits 2, 4, and 6 of the byte at BYTE to 1.

  12.   OI    BYTE,B'00101010'
  13. Swap the contents of registers 7 and 11 without referencing another register or using a storage area.

  14.   XR    7,11
      XR    11,7
      XR    7,11
    
  15. Clearly and precisely describe the contents of the following registers BEFORE the standard linkage of an external subroutine has been executed.

  16.   register 1:   the address of a parameter list
    
      register 13:   the address of the CALLING routine's register save area
    
      register 14:   the address of the next line to execute in the CALLING routine
    
      register 15:   the address of the CALLED routine
    
  17. Clearly and precisely describe the contents of the following registers AFTER the standard linkage of an external subroutine has been executed.

  18.   register 1:   the address of a parameter list
    
      register 13:   the address of the CALLED routine's register save area
    
      register 14:   the address of the CALLED routine's register save area
    
      register 15:   the address of the CALLED routine
    
  19. Clearly and precisely describe the (possible) contents of the following upon exit from an external subroutine.

  20.   register 0:   a calculated value
    
      register 13:   the address of the CALLING routine's register save area
    
      register 14:   the address of the next line to execute in the CALLING routine
    
      register 15:   a return code