CSCI 360 Sample Exam 1 Answers
PART I: MULTIPLE CHOICE
1. A field defined as DC CL3'32' will contain __________ in machine code.
A) 000020
B) F3F240 *** the EBCDIC representation of 3, 2 and space ***
C) F3F2FO
D) 200000
2. The absolute address 23D507 would be aligned on a fullword boundary.
A) true
B) false *** addresses on fullword boundaries end in 0, 4, 8 or C ***
C) sometimes
D) cannot be determined
3. What is the smallest unit of memory that has its own address?
A) a fullword
B) a bit
C) a byte
D) a doubleword
4. How many bits in a fullword?
A) 16
B) 32 *** 8 bits in a byte, and 4 bytes in a fullword, 8 * 4 = 32 ***
C) 8
D) 64
5. 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 *** 2 hex digits for each character ***
6. If your program abends with an interrupt code of 0004, this means what?
A) boundary alignment error
B) you tried to access an address outside of your program area
C) you tried to access an address outside of any actual memory location
D) you have tried to execute an invalid op code
Answer A is a specification exception (0006), C is an addressing
exception (0005), and D is an operation exception (0001)
7. Register 5 = 00000022 and register 7 = 00000014. What absolute address will the D(X,B)
address 19(7,5) resolve to?
A) 000055
B) 000031
C) 000049 *** 000022 + 000014 + 13 ***
D) 000073
8. If your program abends with an interrupt code of 0009, this means what?
A) boundary alignment error
B) you tried to access an address outside of your program area
C) you tried to access an address outside of any actual memory location
D) you have tried to divide by zero
9. 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
10. A field defined as DC F'29' will contain __________ in machine code.
A) 0000001D *** 29 in hex ***
B) 00000029
C) 29
D) 1D
PART II: ENCODING/DECODING
Fill in the blanks on the assembly listing below (27 points total):
(1 point each) (2 points each) (2 points each)
LOCATION COUNTER MACHINE SOURCE
VALUE LANGUAGE LANGUAGE
000000 EXAM CSECT
000000 USING EXAM,15
000000 5850 F018 L 5,NUM1
000004 5870 F01C L 7,NUM2
000008 1A75 AR 7,5
00000A 1827 LR 2,7
00000C 5B20 F024 S 2,NUM4
000010 5020 F028 ST 2,RESULT
000014 07FE BCR B'1111',14
000018 00000026 NUM1 DC F'38'
00001C 0000001B NUM2 DC F'27'
000020 C1C2C3C4 TEXT DC C'ABCD'
000024 0000001C NUM4 DC F'28'
000028 RESULT DS F
END EXAM
PART III: DEBUGGING
Answer the following questions using the ASSIST COMPLETION DUMP given below.
All ‘address’ should be given in hexadecimal. (12 points, 2 for each answer)
ASSIST COMPLETION DUMP
PSW AT ABEND FFC50009 4000000C
REGS 0-3 F4F4F4F4 F4F4F4F4 00000000 F4F4F4F4
REGS 4-7 00000000 00000017 F4F4F4F4 F4F4F4F4
REGS 8-11 F4F4F4F4 F4F4F4F4 F4F4F4F4 F4F4F4F4
REGS 12-15 F4F4F4F4 00000028 FFFE7960 00000000
USER STORAGE
000000 1B225850 F0185C40 F01C1D42 5040F024
000010 5050F020 07FEF5F5 00000017 00000001
000020 F5F5F5F5 F5F5F5F5 F5F5F5F5 00000000
000030 F5F5F5F5 F5F5F5F5 F5F5F5F5 F5F5F5F5
000040 F5F5F5F5 F5F5F5F5 F5F5F5F5 F5F5F5F5
000050 F5F5F5F5 F5F5F5F5 F5F5F5F5 F5F5F5F5
1. What is the address of the instruction that WOULD HAVE BEEN EXECUTED
NEXT had the program not ABENDed?
00000C *** the LAST 3 bytes of PSW ***
2. What is the length (in bytes) of the instruction that caused the
ABEND?
2 *** ILC * 2 = 1 * 2 ***
3. What was the condition code at ABEND (give a decimal number)?
0 *** binary 00 => decimal 0 ***
4. What is the address of the instruction that caused the ABEND?
00000A *** 00000C - 2 ***
5. What type of program interrupt occurred (give the name)?
Fixed-point Divide Exception *** a SOC 9 ***
6. Why did the program ABEND? Be as specific as possible.
Tried to divide by zero. The instruction at address 00000A
is 1D42, which is DR 4,2. Registers 4 and 5 hold 00000000 00000017
and register 2 holds 00000000.
PART IV. SHORT CODING (3 points each)
Write assembly language instructions to perform the following tasks.
Define ANY extra storage you use. You may use register equates if you wish.
Inefficient code will not receive full credit.
1. Add five to register 3.
A 3,=F'5' or LA 3,5(,3)
2. Save the contents of register 6 in a storage area labeled RESULT, also
define the storage area RESULT.
ST 6,RESULT
RESULT DS F
3. Test the contents of registers 4 and 5. Branch to the label ENDIF1
if the contents of register 4 are greater than or equal to the
contents of register 5.
CR 4,5
BNL ENDIF1
...
ENDIF1 DS 0H
4. Multiply the contents of register 5 by –1.
M 4,=F'-1'
5. Set register 4 equal to zero.
SR 4,4 or LA 4,0 or L 4,=F'0'
PART V. LONG CODING (23 points)
Write a COMPLETE assembler program (including all storage areas) to read
in an unknown number of 80 byte records. Each record contains a single
integer number in EBCDIC character format. You may assume that the
number is always present and is a valid integer. Your program should
calculate the average of all of the numbers read in. Print the average
(with an appropriate label) starting at the top of a new page.
Inefficient code will not receive full credit.
MAIN CSECT
USING MAIN,15 Setup addressibility for program
SR 5,5 Set record count to 0
SR 7,7 Set total to 0
XREAD BUFFER,80 Read the 1st record
DO1 BL ENDDO1 Do while there are input records
XDECI 6,BUFFER Get the #
AR 7,6 Increment total
LA 5,1(,5) Increment record count by 1
XREAD BUFFER,80 Read the next record
B DO1 Goto top of loop
ENDDO1 DS 0H Enddo
M 6,=F'1' Prepare for division
DR 6,5 Calculate avg = total / record count
XDECO 7,AVG Put average on print line
XPRNT PLINE,28 Write average
BR 14 Return to caller
LTORG
BUFFER DS CL80 Input buffer
PLINE DC C'0' Average line
DC C'The average is:'
AVG DS CL12 Storage for average
END MAIN