13
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 specify SETON LR, the program A) Compiles normally B) Does not compile normally B) Compiles normally but fails execution C) Compiles normally but program loops 3. 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 B) OFF 4. Only array element = 99 is element #10. WSFLD1 = 99. What will be value 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

As400 Iseries Question Paper

Embed Size (px)

Citation preview

Page 1: As400 Iseries Question Paper

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 specify SETON LR, the program

A) Compiles normally B) Does not compile normally

B) Compiles normally but fails execution C) Compiles normally but program loops

3. 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 B) OFF 4. Only array element = 99 is element #10. WSFLD1 = 99. What will be value 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

Page 2: As400 Iseries Question Paper

2 A) ON B) OFF 5. What will be the value of the third (3rd) byte of the variable WSARYC after the following code is executed? 01.0 E ARY 10 1 A 02.0 * 03.0 I DS 04.0 I 1 10 ARY 05.0 I 1 10 WSARYC 06.0 * 07.0 C MOVEA ‘AGBFDEC’ ARY 08.0 C SORTAARY A) ‘C’ B) ‘B’ C) ‘D’ D) ‘G’ E) None of the above. 6. If the array limit in RPG III is 9999, what is the maximum array limit in RPG IV?

A) 9999 B) 99999 C) 32768 D) 20480

7. What is the next number in the series 1,3,7,13,21,31,--?

A) 45 B) 53 C) 43 D) 60

8. 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 record and handles any errors that might occur as a result of the record already being locked (please assume that the record does exist and that the file is defined in the program as an update file) ? A) HiLoEq 01.0 C KEYFLD CHAIN RECNAM 50 02.0 C *IN50 IFEQ ‘1’

Page 3: As400 Iseries Question Paper

3 03.0 C EXSR ERROR 04.0 C ENDIF B) HiLoEq 01.0 C KEYFLD CHAIN RECNAM 5051 02.0 C *IN51 IFEQ ‘1’ 03.0 C EXSR ERROR 04.0 C ENDIF C) HiLoEq 01.0 C KEYFLD CHAIN RECNAM N50 02.0 C *IN50 IFEQ ‘1’ 03.0 C EXSR ERROR 04.0 C ENDIF D) HiLoEq 01.0 C KEYFLD CHAIN RECNAM N5051 02.0 C *IN51 IFEQ ‘1’ 03.0 C EXSR ERROR 04.0 C ENDIF 10. What will be the value of WSFLDA after the following code is executed? 01.0 C MOVE ‘ABCDE’ WSFLDA 5 02.0 C MOVE ‘XYZ’ WSFLDB 3 03.0 C MOVE WSFLDB WSFLDA A) ‘ABCDE’ B) ‘XYZAB’ C) ‘XYZ ’ D) ‘ABXYZ’ E) ‘XYZDE’ 11. Which of the following subroutines will be executed? (Assume IX and IY are 3 byte numeric fields with zero decimals.) 01.0 C Z-ADD 5 IX 30 02.0 C Z-ADD 7 IY 30 03.0 * 04.0 C SELEC 05.0 C IX WHGT IY 06.0 C EXSR SUBRT1 07.0 C IX WHLT IY 08.0 C EXSR SUBRT2 09.0 C IX WHLE IY 10.0 C EXSR SUBRT3 11.0 C OTHER 12.0 C EXSR SUBRT4 13.0 C ENDSL

Page 4: As400 Iseries Question Paper

4 A) SUBRT1 B) SUBRT2 C) SUBRT2, SUBRT4 D) SUBRT3 E) SUBRT2 & SUBRT3 F) SUBRT4 12. Which of the following is true when submitting a job? A) The submitted job takes a copy of the LDA from the submitting job. B) The submitted job gets a fresh and clear LDA. C) The submitted job takes a copy of whatever the default LDA is in the system values. D) The submitted job uses the submitting job’s LDA, not a copy. 13. 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 of a specified substring in character data item.

A) SCAN B) CHECK C) RETURN D) NEXT

15. Assuming a local data area looks like ‘1J75LLK9’, what would the value of the variable &WHSE be, after the execution of the following CL commands? DCL VAR(&WHSE) TYPE(*CHAR) LEN(03) VALUE(‘ ‘) RTVDTAARA DTAARA(*LDA (3 2)) RTNVAR(&WHSE) A) ‘LL’ B) ‘J75’ C) ’75 ‘ D) ‘75L’

Page 5: As400 Iseries Question Paper

516. What will be the value of IZ during the execution of the following code, when statement 09.0 is reached? (Field length 30 implies 3 byte numeric – 0 decimal). 01.0 C Z-ADD 100 IY 30 02.0 C Z-ADD 0 IZ 30 03.0 *-------------------------------- 04.0 C IY DOULT 99 05.0 C ADD 1 IZ 06.0 C ADD 10 IY 07.0 C ENDDO 08.0 *-------------------------------- 09.0 C Z-ADD 1 IY A) 0 B) 1 C) 90 D) 99 E) 100 17. If the following code is executed, what will be the value of IZ when the program reaches statement 09.0? (Field length 30 implies – 3 numeric – 0 decimal). 01.0 C Z-ADD 100 IY 30 02.0 C Z-ADD 0 IZ 30 03.0 *-------------------------------- 04.0 C IY DOWLE 99 05.0 C ADD 1 IZ 06.0 C ADD 10 IY 07.0 C ENDDO 08.0 *-------------------------------- 09.0 C Z-ADD 1 IY A) 0 B) 1 C) 90 D) 99 E) 100 18. What will be the value of WSFLDB after the following code is executed? 01.0 C Z-ADD 1 WSFLDA 40 02.0 C MOVE ‘ABCDE’ WSFLDB 5 03.0 C MOVE WSFLDA WSFLDB A) ‘ABCDE’ B) ‘A1 ‘ C) ‘A0001’ D) ‘1000E’ E) ‘1 E’ 19. 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?

Page 6: As400 Iseries Question Paper

6 A) The file build would not have been allowed in the first place, since QTEMP is a system library. B) The QTEMP file will be moved to the job’s *CURRENT library upon termination of the job. C) 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.

20. What will be the value of IY BEFORE the execution of statement 09.0 in the following code? 01.0 C Z-ADD 0 IX 30 02.0 C Z-ADD 0 IY 30 03.0 *-------------------------------- 04.0 C IX DOWLT 3 05.0 C ADD 1 IX 06.0 C ADD 2 IY 07.0 C ENDDO 08.0 *-------------------------------- 09.0 C Z-ADD 0 IY A) 0 B) 3 C) 6 D) 8 21. If the following code is executed under debug with a break point at statement 15.0, what will be the value of WSFLD2 when the program stops at the break point? 01.0 C Z-ADD 1 WSFLD1 30 02.0 C Z-ADD 0 WSFLD2 30 03.0 *+++++++++++++++++++++++++++++++++ 04.0 C WSFLD1 DOWLE 3 05.0 C Z-ADD 1 WSFLD3 06.0 *------------------------------- 07.0 C WSFLD3 DOWLE 4 08.0 C ADD 1 WSFLD2 09.0 C ADD 1 WSFLD3 10.0 C ENDDO 11.0 *------------------------------- 12.0 C ADD 1 WSFLD1 13.0 C ENDDO 14.0 *++++++++++++++++++++++++++++++++++ 15.0 C Z-ADD 1 WSFLD2

Page 7: As400 Iseries Question Paper

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++++++++Len++D+HiLoEq.... 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 code to an ILE RPG/400 code CL0N01Factor1+++++++Opcode&ExtFactor2+++++++Result++++++++Len++D+HiLoEq....

C Wrk_A Add Wrk_B Wrk_Sum C Wrk_Sum Mult Wrk_X Wrk_Rslt C Wrk_Rslt Div Wrk_Tot Wrk_Answer CL0N01Factor1+++++++Opcode&ExtExtended-factor2+++++++++++++++++++++++++++++

A) C Eval Wrk_Answer=(Wrk_A+Wrk_B)*Wrk_X/Wrk_Tot

B) C Eval ((Wrk_A + Wrk_B)*Wrk_X)/Wrk_Tot=Wrk_Answer

C) C Eval (Wrk_A + Wrk_B)*Wrk_X/Wrk_Tot=Wrk_Answer

D) C Eval Wrk_Answer=Wrk_A+Wrk_B*Wrk_X/Wrk_Tot 24. Given the following code- what is the value of IY BEFORE line 15.00 is executed? 01.0 C Z-ADD 20 IY 50 02.0 C Z-ADD 0 IZ 50 03.0 * 04.0 C IY DOULT IZ 05.0 C IZ DOUGT 10 06.0 C ADD 1 IY 07.0 * 08.0 C IY IFLT 24

Page 8: As400 Iseries Question Paper

8 09.0 C ITER 10.0 C ENDIF 11.0 * 12.0 C ADD 5 IZ 13.0 C ENDDO 14.0 C ENDDO 15.0 * 16.0 C Z-ADD 1 IY 17.0 C MOVE *ON *INLR A) 1 B) 24 C) 29 D) 27

Statement 16.0 will be never be reached 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 gallon in the city than on 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) /INCLUDE B) /COPY C) /DEFINE D) /CPYSRC

27. 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+++++++++++++++++++++++++++ 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)

Page 9: As400 Iseries Question Paper

9A 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 by Order Number and Item Number – with an additional Quantity field and (3) Item Master – keyed by Item Number. About 2 million orders were received 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 FLDA KLIST FLDB KEYFULL KLIST FLDA FLDB FLDC HiLoEq KEYFLD CHAIN RECNAM 50 *in50 DOWEQ *off

Page 10: As400 Iseries Question Paper

10 Move *blanks FLDB Update RECNAM 51 *** To get the unique record for the file and figure out the value for FLDC*** *in51 ifeq *on KEYFULL SETGT RECNAM KEYFULL READPE RECNAM 50 *in50 ifeq *off Z-ADD FLDC SAV_FLD Else Z-ADD 0 SAV_FLD Endif Add 1 SAV_FLD Z-ADD SAV_FLD FLDC MOVE *BLANKS FLDB UPDATE RECNAM KEYFLD READE RECNAM ENDDO 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.

Page 11: As400 Iseries Question Paper

11 8. C) 32768 9. C) 43 8. B) –999.0 9. B) HiLoEq 01.0 C KEYFLD CHAIN RECNAM 5051 02.0 C *IN51 IFEQ ‘1’ 03.0 C EXSR ERROR 04.0 C ENDIF 10. 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) The library QTEMP and everything in it will be deleted when the job ends. 20. C) 6 21. C) 12 22. B) 3

Page 12: As400 Iseries Question Paper

1223. C) Eval ((Wrk_A + Wrk_B)*Wrk_X)/Wrk_Tot=Wrk_Answer

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 the number of unique items ordered for the month. 30. Consider the following code

KEYFLD KLIST FLDA KLIST FLDB KEYFULL KLIST FLDA FLDB FLDC HiLoEq KEYFLD CHAIN RECNAM 50 *in50 DOWEQ *off Move *blanks FLDB Update RECNAM 51 *** To get the unique record for the file and figure out the value for FLDC*** *in51 ifeq *on KEYFULL SETGT RECNAM KEYFULL READPE RECNAM 50 *in50 ifeq *off Z-ADD FLDC SAV_FLD Else Z-ADD 0 SAV_FLD Endif Add 1 SAV_FLD Z-ADD SAV_FLD FLDC MOVE *BLANKS FLDB UPDATE RECNAM

Page 13: As400 Iseries Question Paper

13 KEYFLD READE RECNAM ENDDO Point out the flaws in this code

--------------