Review Questions for Test 1

The following questions are mostly taken from the first examination of previous semesters. They are similar to questions which likely will appear on the semester's first examination. Be sure to not limit your review to just these questions.


  1. Convert the following unsigned numbers:
    Decimal                     Binary                  Hexadecimal
    
      345              ___________________________    _______________
    
    ______________           110010011110             _______________
    
    ______________     ___________________________          235B

  2. Do the following unsigned integer arithmetic:
    Binary       1 0 1 0 1 0 1 0 1 1             1 1 0 1 0 0 0 1 1 0
               + 1 0 1 1 1 0 1 1 1 1           -   1 0 0 0 0 1 1 1 1
               ---------------------           ---------------------
    
    
    
    Hexadecimal     8 6 7 B                3 F 0 A 7 D C 0
                  + E 8 F 9              - 1 0 C F B A 4 D
                  ---------              -----------------
    
    

  3. Do the following fullword (two's complement) arithmetic and determine if any overflow occurred and explain why or why not:
            5 8 9 A B 8 7 E                        C 8 5 2 9 A C D
          + 4 7 B F 8 7 5 2                      - C 4 8 8 6 B A 6
          -----------------                      -----------------
    
    

  4. Write the correct number in each blank:
         A fullword contains_____bytes.  A fullword contains_____bits.
    
         RR instruction size =_____bytes.  RX instruction size =_____bytes.
    
         A PSW contains ____ bits or ____ bytes or _____ fullwords.
    
         The mask in a BC instruction has how many possible values?  ______

  5. What is the carriage control character for each of these? Note: A blank with nothing written in it is NOT an answer!
         a. Top of Page______          b. Single Space______
    
         c. Double Space______         d. Triple Space______

  6. Given the following register contents, calculate absolute addresses (in Hexadecimal) for the D(B) or D(X,B) addresses given below.
    R0 = 00000040     R1 = F4F4F4F4     R2 = 00000359     R3 = 80012345
    
    
    35(0,3) ____________      28(1) ____________   16(2,3) ____________

  7. Answer the following questions using the PSW AT ABEND given below. Give 'address' answers in hexadecimal.
    PSW AT ABEND    FFC50001  5F000E34
    
    Contents of memory starting at address (hex) 000E20
    
    Address     Contents
    
    000E20      40125802 5012D503 50301231 5872F01C 1A5500CC 47B0F010
    
    a.  What is the address of the instruction which would have been
        executed next had the program not ABENDed on the current
    
        instruction?  ___________________________
    
    
    b.  What is the length (in bytes) of the instruction that
    
        caused the ABEND? ___________________________
    
    
    c.  What is the condition code? (Answer with decimal number) ____
    
    
    d.  What is the address of the instruction that caused the ABEND?
    
        __________________________
    
    
    e.  What type of program interrupt occurred?
    
        Number ____________    Name __________________________________
    
    
    f.  Write the next instruction that would have been
        executed as the programmer would have written it
        in explicit assembler language using decimal values.
    
    
        _________________________________________________________

  8. Encoding/Decoding. Fill in the blanks on the assembly listing below, using implicit addresses where possible:
    Location Counter   Machine                 Source
    Value (hex)        Language (hex)          Language
    
              000000                           EXAM1    CSECT
              000000                                    USING EXAM1,15
              000000   _______________                  L     2,F33
    
            ________   _______________                  LA    3,3
    
            ________   _______________                  MR    2,2
    
            ________   5020 F034                        _______________
    
            ________   _______________                  AR    3,3
    
            ________   5D20 F02C                        _______________
    
            ________   47A0 E000                        _______________
    
            ________   _______________                  BR    14
    
            ________   _______________         F129     DC    F'129'
    
              000020   _______________         F33      DC    F'33'
    
            ________   _______________         AB       DC    2CL3'AB'
    
            ________   _______________         BC       DC    F'-15'
    
            ________   _______________         TOTAL    DC    F'33'
    
                                               END      EXAM1

  9. Write assembly instructions to perform the following tasks. (Define any extra storage you reference.) Inefficient code will not receive full credit. Use literals where possible.
    a. Quadruple the value in register 2.
    
    
    
    
    b. Increment the value in register 7 by 5182.
    
    
    
    
    c. Initialize register 0 to zero.
    
    
    
    
    d. Multiply the contents of register 3 by -17.
    
    
    
    
    e. Divide the contents of register 8 by the contents of register 6.
       (This is harder than some of these.)
    
    
    
         
    f. Test the contents of registers 2 and 3.  Branch to the label 
       FOUND if the contents of register 2 are not equal to the contents 
       of register 3.
    
    
    
    
    g. Write the equate statement necessary to equate the value 3 with the 
       symbol SAVE.
    
    
    
    
    g. Save the contents of register 10 into a fullword labelled HAVEN.
    
    
    
    

  10. Given the starting values listed for registers and a portion of storage, show the complete contents (in hex) after execution of the instruction. Starting values apply to each instruction. Results are not cumulative.
    Starting values (for each instruction):
    
      R0 = 00000200    R1 = FF000204    R3 = 0000036C    R4 = FFFFFFFF
      R5 = FFFFFFFF    R6 = 00000004    R7 = 00000064    R8 = 00000004
    
            Address  Contents
            000200   F5F5F5F5 0000003C 00000123 00000008
    
             LR    5,6          R5 = _____________
    
             LA    1,2(0,3)     R1 = _____________
    
             L     6,4(6,1)     R6 = _____________
    
             DR    4,8          R4 = _____________  R5 = _____________
    
             AR    0,6          R0 = _____________
    
             MR    4,4          R4 = _____________  R5 = _____________
    
             LTR   3,4          R3 = _____________

  11. Write the assembler source code to implement the expression below. Assume that all fields have already been correctly defined as fullwords in your storage area. Provide all necessary labels. Use literals if appropriate. Rounding is not necessary.
             VALUE = ((NUM4 - NUM3)/2) * NUM2 + NUM4
    
    

  12. The following complete assembly language program reads an unknown number of 80 byte records and calculates the average of the first number found on all records. Some parts of the program have been left out, and you are to fill in each blank with the appropriate value. What follows is the complete program: no additional fields are available, nor may they be written in. This is much longer than you would normally find on an exam.
    CALCUL8  CSECT ,                   Begin program
    
             USING ________________    Define base register
             SR    3,3                 Initialize sum of card values
             SR    4,4                 Initialize count of valid values
             XREAD CARD,80             Read first record
    *
    LOOP     BC    ____________,EOF    Finished if no more records
    
             XDECI ________________    Get first number from record
    
             BC    ________________    B if none found
             AR    3,0                 Else add to total
    
             A     4,______________    And increment count of numbers
    NEXTCARD XREAD CARD,80             Get next input record
    
             ______________________    Continue
    
    EOF      LTR   4,______________    Any numbers found?
             BC    B'1000',SAVE        No, save zero
    
             M     2,______________    Prepare to divide
    
             DR    2,______________    Get average in R3
             AR    2,2                 Double the remainder
             CR    2,______________    Compare with divisor
    
             BC    ___________,SAVE    Branch if no rounding needed
    
             A     3,______________    Else round up
    *
    SAVE     ST    3,AVG               Save for XDUMP
    
             XDUMP ________________    Display value saved above
    
             BCR   ________________    Return to caller
    *
             ______________________    (This belongs in every program!)
    
    CARD     DS    ________________
    
    AVG      DS    ________________
             END   CALCUL8
  13. Write a loop that will read and count an unknown number of 80-byte records. Each record contains one integer value. Get the integer values and find the sum. Once all of the records have been read, display a summary line with the sum. The summary line should be triple spaced.

    Define any storage that is used.

    This does not have to be a complete program--just the code for the loop and any storage area(s) that may be needed. There is no need to document the code. Do nothing extra.


Multiple Choice and True/False

     Answer each question with the best available answer.

 1.  A field defined as DC CL3'32' will contain __________ in machine
     code.

     A.  000020
     B.  F3F240
     C.  F3F2FO
     D.  200000
     E.  40F3F2

 2.  The absolute address 0023D50A (in hex) would not be aligned on a
     fullword boundary.

     A.  True
     B.  False

 3.  How many bits are there in a fullword?

     A.    16
     B.    32
     C.     8
     D.    64
     E.  4096

 4.  Under the EBCDIC coding system, each character requires ________
     to represent it in the computer.

     A.  4 bits
     B.  1 fullword
     C.  8 bytes
     D.  1 byte
     E.  2 bytes

 5.  Suppose Register 5 = 00000022 and register 7 = 00000014. What
     absolute address will the D(X,B) address 19(7,5) resolve to?

     A.  00000055
     B.  00000031
     C.  00000049
     D.  00000073
     E.  00000037

 6.  The instruction LR 5,4 will

     A.  copy the contents of register 5 into register 4.
     B.  ABEND the program with a specification error.
     C.  put 4 into register 5.
     D.  copy the contents of register 4 into register 5.
     E.  test whether the value in register 4 is less than the value
         in register 5.


     Questions 7 and 8 refer to this instruction:

                   MR    8,5

 7.  Which registers will be multiplied?

     A.  8 and 9
     B.  8 and 5
     C.  9 and 5
     D.  8 and 6
     E.  9 and 6 

 8.  Where will the product be stored?

     A.  In registers 5 and 6
     B.  In registers 8 and 9
     C.  In register 8
     D.  In register 9
     E.  None of the above

 9.  The following instruction will assemble without an error:

                   LA 1,5000

     A.  True
     B.  False

     Questions 10 and 11 refer to this instruction, which we are
     using to divide 239 by 17:

                   DR     2,5

10.  Where will the quotient be stored after execution?

     A.  In register 5
     B.  In register 2
     C.  In registers 2 and 3
     D.  In registers 5 and 6
     E.  None of the above

11.  Where will the remainder be stored after execution?

     A   In register 2
     B.  In register 3
     C.  In register 5
     D   In register 6
     E.  There is no remainder--we just have a quotient.

12.  A field defined as DC F'29' will contain 00000029 in machine code.

     A.  True
     B.  False

13.  XREAD will set the condition code to 1 if it encounters the end 
     of the file.

     A.  True
     B.  False

14.  If your program attempts to divide by 0, the result should be an
     ABEND with interruption code 0009.

     A.  True
     B.  False

15.  The signed 32-bit number 5FFFFFF7 is negative.

     A.  True
     B.  False

16.  If your program tries to execute an invalid instruction, the result
     should be an ABEND with interruption code 0001.

     A.  True
     B.  False