1
AS400 QUESTIONNAIRE Instructions •
• • • •
Please do not mark anything on the question paper. Please mention your workings in a separate sheet. All questions carry equal marks No Negative marks Please write/specify reason for your answer as much as possible Time Duration : 90 minutes
Each of the following questions (with the exception of #30) has one correct answer. Please circle the correct one. 1.
No value higher than 99 is found in array. WSFLD1 = 99. What will be the value of indicator after the execution of the given statements? HiLoEq 01.0 C Z-ADD 1 IX 02.0 C SETON 01 03.0 C WSFLD1 LOKUP ARY,IX 01 A) ON
B) OFF
2. If a program does not not specify SETON LR, the program A) B) B) C)
3.
Compiles normally Does not compile normally Compiles normally but fails execution Compiles normally but program loops
Array element #16 = 99. WSFLD1 = 99. What will be the value of indicator 01 after the execution of the given statements? HiLoEq 01.0 C Z-ADD 1 IX 02.0 C WSFLD1 LOKUP ARY,IX 01 A) ON
4.
B) OFF
Only array element = 99 is element element #10. WSFLD1 = 99. What will be value of of indicator after the execution of the given statements? HiLoEq 01.0 C Z-ADD 25 IX 02.0 C WSFLD1 LOKUP ARY,IX 01
2
A) ON
B) OFF
5. What will be the value of the third (3rd) byte of the variable WSARYC after the code is executed? 01.0 02.0 03.0 04.0 05.0 06.0 07.0 08.0
E * I I I * C C
A) ‘C’
6.
DS 1 10 ARY 1 10 WSARYC MOVEA ‘AGBFDEC’ ARY SORTAARY
B) ‘B’
C) ‘D’
D) ‘G’
E) None of the above.
9999 99999 32768 20480
What is the next number in the series 1,3,7,13,21,31,--? A) B) C) D)
8.
10 1 A
If the array limit in RPG III is 9999, what is the t he maximum array limit in RPG IV? A) B) C) D)
7.
ARY
following
45 53 43 60
Which number (among the numbers given as answers) represents the smallest amount? A) –0.999
B) –999.0
C) –0.9
D) –0.88
E) –0.125
9. Which of the following lines of code effectively attempts to lock a specific specific record and handles any errors that might occur occur as a result of the record already being locked locked (please assume assume that the the record does exist and that the file is defined in the program as an update file) ? A) 01.0 02.0
C C
KEYFLD *IN50
CHAIN IFEQ ‘1’
RECNAM
HiLoEq 50
3
03.0 04.0 B) 01.0 02.0 03.0 04.0 C) 01.0 02.0 03.0 04.0 D) 01.0 02.0 03.0 04.0
10.
C C
C C C C
C C C C
C C C C
KEYFLD *IN51
KEYFLD *IN50
KEYFLD *IN51
HiLoEq 5051
CHAIN RECNAM IFEQ ‘1’ EXSR ERROR ENDIF
HiLoEq N50
CHAIN RECNAM IFEQ ‘1’ EXSR ERROR ENDIF
HiLoEq N5051
CHAIN RECNAM IFEQ ‘1’ EXSR ERROR ENDIF
What will be the value of WSFLDA after the following code is executed? 01.0 02.0 03.0
C C C
A) ‘ABCDE’
11.
EXSR ERROR ENDIF
MOVE MOVE MOVE B) ‘XYZAB’
‘ABCDE’ ‘XYZ’ WSFLDB
C) ‘XYZ ’
WSFLDA WSFLDB WSFLDA
D) ‘ABXYZ’
5 3
E) ‘XYZDE’
Which of the following subroutines will be executed? (Assume IX and IY are 3 byte numeric fields with zero decimals.) 01.0 02.0 03.0 04.0 05.0 06.0 07.0 08.0 09.0 10.0 11.0 12.0 13.0
C C * C C C C C C C C C C
Z-ADD Z-ADD
IX IX IX
5 7
SELEC WHGT IY EXSR SUBRT1 WHLT IY EXSR SUBRT2 WHLE IY EXSR SUBRT3 OTHER EXSR SUBRT4 ENDSL
IX IY
30 30
4
A) SUBRT1 B) SUBRT2 C) SUBRT2, SUBRT4 E) SUBRT2 & SUBRT3 F) SUBRT4
12.
Which of the following is true when submitting a job? A) B) C) D)
13.
D) SUBRT3
The submitted job takes a copy of the LDA from the submitting job. The submitted job gets a fresh and clear LDA. The submitted job takes a copy of whatever the default LDA is in the system values. The submitted job uses the submitting job’s LDA, not a copy.
Consider Program A calls Program B and passes a variable FLD C. Program B expects FLD C to be numeric – how do we handle this in program. A) Initialize FLD C to a numeric constant in program B B) Ensure that program A always passes numeric data C) Use TESTN opcode in program B and initialize FLD C if not numeric D) Do nothing, let error handler handle bad data.
14. Locate the position position of a specified specified substring in character data item. item. A) B) C) D)
SCAN CHECK RETURN NEXT
15. Assuming a local data area looks like ‘1J75LLK9’, what would the value of the &WHSE be, after the execution of the following CL commands?
variable
DCL VAR(&WHSE) TYPE(*CHAR) LEN(03) VALUE(‘ ‘) RTVDTAARA DTAARA(*LDA (3 2)) RTNVAR(&WHSE) A) ‘LL’
B) ‘J75’
C) ’75 ‘
D) ‘75L’
5
16. What will be the value of IZ during the execution of the following code, when 09.0 is reached? (Field length 30 implies 3 byte numeric – 0 decimal). 01.0 02.0 03.0 04.0 05.0 06.0 07.0 08.0 09.0
C C *-------------------------------C IY C C C *-------------------------------C
A) 0
B) 1
Z-ADD Z-ADD
100 0
DOULT ADD 1 ADD 10 ENDDO
99
Z-ADD
1
C) 90
IY IZ
statement
30 30
IZ IY
D) 99
IY
E) 100
17. If the following code is executed, what will be the value of IZ when the program program reaches statement 09.0? (Field length 30 implies – 3 numeric – 0 decimal). 01.0 02.0 03.0 04.0 05.0 06.0 07.0 08.0 09.0
C C *-------------------------------C IY C C C *-------------------------------C
A) 0
18.
B) 1
100 0
DOWLE ADD 1 ADD 10 ENDDO
99
Z-ADD
1
C) 90
D) 99
IY IZ
30 30
IZ IY
IY
E) 100
What will be the value of WSFLDB after the following code is executed? 01.0 02.0 03.0
C C C
A) ‘ABCDE’
19.
Z-ADD Z-ADD
Z-ADD MOVE MOVE B) ‘A1 ‘
C) ‘A0001’
1 ‘ABCDE’ WSFLDA D) ‘1000E’
WSFLDA WSFLDB WSFLDB
40 5
E) ‘1 E’
A job is submitted that builds a file in the library QTEMP. When the job ends, what happens to the file that was built in QTEMP?
6
A)
The file build would not have been allowed in the first place, since QTEMP is a system library. The QTEMP file will be moved to the job’s *CURRENT library upon termination of the job. The library QTEMP and everything in it will be deleted when the job ends. Nothing happens. All data in QTEMP remains in tact and is accessible by jobs running later.
B) C)
20.
What will be the value of IY BEFORE the execution of statement 09.0 in the following code? 01.0 02.0 03.0 04.0 05.0 06.0 07.0 08.0 09.0
A) 0
C C *-------------------------------C IX C C C *-------------------------------C
B) 3
C) 6
Z-ADD Z-ADD
0 0
DOWLT ADD 1 ADD 2 ENDDO
3
Z-ADD
0
IX IY
30 30
IX IY
IY
D) 8
21. If the following code is executed under debug with a break point at statement 15.0, will be the value of WSFLD2 when the program stops at the break point? 01.0 02.0 03.0 04.0 05.0 06.0 07.0 08.0 09.0 10.0 11.0 12.0 13.0 14.0 15.0
C Z-ADD 1 WSFLD1 C Z-ADD 0 WSFLD2 *+++++++++++++++++++++++++++++++++ C WSFLD1 DOWLE 3 C Z-ADD 1 WSFLD3 *------------------------------C WSFLD3 DOWLE 4 C ADD 1 WSFLD2 C ADD 1 WSFLD3 C ENDDO *------------------------------C ADD 1 WSFLD1 C ENDDO *++++++++++++++++++++++++++++++++++ C Z-ADD 1 WSFLD2
30 30
what
7
A) 1
B) 8
C) 12
D) 16
22. In the code segment below, What would the value of field I01 after the second statement has executed?
* Ary_Elem = Number of Elements = 7 Element Length = 1 * Con_X = 7, Ary_Elem = '5374269' CL0N01Factor1+++++++Opcode&ExtFactor2+++++++Result++++ CL0N01Factor1+++++++Opcode&ExtFacto r2+++++++Result++++++++Len++D+Hi ++++Len++D+HiLoEq.... LoEq.... C Z-Add 1 I01 C Con_X LookUp Ary_Elem(I01) 90
A) 1
B) 3
C) 5
D) 7
23. Convert the following RPG/400 RPG/400 code to an ILE RPG/400 code CL0N01Factor1+++++++Opcode&ExtFactor2+++++++Result++++++++Len++D+HiLo CL0N01Factor1+++++++Opcode&ExtFactor2+++++++Result+++ +++++Len++D+HiLoEq.... Eq.... C Wrk_A Add Wrk_B Wrk_Sum C Wrk_Sum Mult Wrk_X Wrk_Rslt C Wrk_Rslt Div Div Wrk_Tot Wrk_Answer CL0N01Factor1+++++++Opcode&ExtExtended-factor2+++++++++++++++++++ CL0N01Factor1+++++++Opcode&ExtExtended-factor2++++++ +++++++++++++++++++++++ ++++++++++ A) C Eval Wrk_Answer=(Wrk_A+Wrk_B)*Wrk_X/Wrk_Tot Wrk_Answer=(Wrk_A+Wrk_ B)*Wrk_X/Wrk_Tot
24.
B)
C
Eval
((Wrk_A + Wrk_B)*Wrk_X)/Wrk_Tot=Wr Wrk_B)*Wrk_X)/Wrk_Tot=Wrk_Answer k_Answer
C)
C
Eval
(Wrk_A + Wrk_B)*Wrk_X/Wrk_Tot=W Wrk_B)*Wrk_X/Wrk_Tot=Wrk_Answer rk_Answer
D)
C
Eval
Wrk_Answer=Wrk_A+Wrk_B*Wrk_X/Wrk_Tot Wrk_Answer=Wrk_A+Wrk_B*Wrk_ X/Wrk_Tot
Given the following code- what is the value of IY BEFORE line 15.00 is executed? 01.0 02.0 03.0 04.0 05.0 06.0 07.0 08.0
C C * C C C * C
IY IZ
IY
Z-ADD Z-ADD
20 0
DOULT DOUGT ADD 1
IZ 10
IFLT 24
IY IZ
IY
50 50
8
09.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0
C C * C C C * C C
ITER ENDIF ADD 5 ENDDO ENDDO Z-ADD MOVE
IZ
1 *ON
IY *INLR
A) 1 B) 24 C) 29 D) 27 Statement 16.0 will be never be reached reac hed due to preceding endless loop.
25.
A car traveled 462 miles per tank full of gasoline on the highway and 336 miles per tank full of gasoline in the city. If the car traveled 6 fewer miles per per gallon in the city than on the the highway, how many miles per gallon did the car travel in the city? A) 14
B) 16
C) 21
D) 22
E) 27
26. Which compiler directive is used to copy RPG code from a specified source member into the program? A) B) C) D)
27.
/INCLUDE /COPY /DEFINE /CPYSRC
Given the DDS specification below and the following information: Indicator 20 is On No records have been written to the subfile What will be the result if the EXFMT operation code is performed on the record format CTL1? AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions+++++++++++++++ AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions +++++++++++++++++++++++++++ ++++++++++++ A R SFL1 SFL A FLD01 10 I 6 10DFT('FLD01TEXT') * A R CTL1 SFLCTL(SFL1) A 20 SFLDSP A SFLDSPCTL A SFLINZ A N37 SFLEND A SFLSIZ(0006) A SFLPAG(0005)
9
A
FLD02
10 O 5 10
A) Only FLD02 is displayed B) SFL1 will be initialized with 6 blank records C) An I/O exception error will occur D) The screen will display 5 records with 'FLD01TEXT'
28. What will be the value of WSFLDX after the following code is executed? EVAL WSFLDX = ((1 + 2 * 3) – (7 – 3 * 2 – 2)). A) 3
B) 7
C) 8
D) 9
29. A sales orders system consists of three major files (1) Order Header – keyed by Order Number (2) Order Detail – keyed keyed by Order Number and Item Number Number – with an additional Quantity field and (3) Item Item Master – keyed by Item Number. About About 2 million orders were received into into the system during the month of May 1998. Which of the following statements would be true with respect to an Item Summary Report (listing total quantity ordered by item – excluding items with zero summary quantity) for the month May 1998 ?
A) The report would be very big due to the huge number of orders received for the month. B) The size of the report would depend on the number of items defined in the item master. C) The size of the report would depend on the average number of detail records per order for the month. D) The size of the report would depend on the number of unique items ordered for the month. The size of the report would be exactly the same as that of the previous month.
30.
Consider the following code
KEYFLD
KLIST KLIST
FLDA FLDB
KEYFULL
KLIST
FLDA FLDB FLDC
KEYFLD *in50
CHAIN DOWEQ
RECNAM *off
HiLoEq 50
10
Move Update
*blanks FLDB RECNAM
51
*** To get the unique record for the file and figure out the value for FLDC*** F LDC*** *in51 KEYFULL KEYFULL
ifeq *on SETGT RECNAM READPE RECNAM
*in50
ifeq Z-ADD Else Z-ADD Endif Add
50
*off FLDC
SAV_FLD
0
SAV_FLD
1
SAV_FLD
Z-ADD SAV_FLD MOVE *BLANKS UPDATE RECNAM KEYFLD
READE ENDDO
FLDC FLDB
RECNAM
Point out the flaws in this code
--------------
AS-400 ANSWER KEY
1.
B) OFF
2.
B ) Does not compile normally
3.
A) ON
4.
B) OFF
5.
E) None of the above.
11
8.
C) 32768
9.
C) 43
8.
B) –999.0
9.
B)
HiLoEq
01.0 02.0 03.0 04.0 10.
C C C C
KEYFLD *IN51
CHAIN RECNAM IFEQ ‘1’ EXSR ERROR ENDIF
5051
D) ‘ABXYZ’
11.
B) SUBRT2
12.
A) The submitted job takes a copy of the LDA from the submitting job.
13.
C ) Use TESTN opcode in program B and initialize FLD C if not numeric
14.
A) SCAN
15. C) ’75 ‘
16. C) 90 17. A) 0 18. C) ‘A0001’ 19. C) 20. C) 6 21. C) 12 22. B) 3
The library QTEMP and everything in it will be deleted when the job ends.
12
23. C) Eval
((Wrk_A + Wrk_B)*Wrk_X)/Wrk_Tot=Wrk_A Wrk_B)*Wrk_X) /Wrk_Tot=Wrk_Answer nswer
24. C) 29 25. C) 21 26. B) /COPY 27.
C) An I/O exception error will occur
28. C) 8 29. D) The size of the report would depend on on the number of unique unique items ordered for for the month. 30.
Consider the following code KEYFLD
KLIST KLIST
FLDA FLDB
KEYFULL
KLIST
FLDA FLDB FLDC
KEYFLD *in50
CHAIN DOWEQ Move Update
RECNAM *off *blanks FLDB RECNAM
HiLoEq 50
51
*** To get the unique record for the file and figure out the value for FLDC*** F LDC*** *in51 KEYFULL KEYFULL
ifeq *on SETGT RECNAM READPE RECNAM
*in50
ifeq Z-ADD Else Z-ADD Endif Add
50
*off FLDC
SAV_FLD
0
SAV_FLD
1
SAV_FLD
Z-ADD SAV_FLD MOVE *BLANKS UPDATE RECNAM
FLDC FLDB
13
KEYFLD
READE ENDDO
RECNAM
Point out the flaws in this code
--------------