You are on page 1of 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) 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 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

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 ARY DS 1 10 ARY 1 10 WSARYC MOVEA AGBFDEC ARY SORTAARY 10 1 A

following

A) C 6.

B) B

C) D

D) G

E) None of the above.

If the array limit in RPG III is 9999, what is the maximum array limit in RPG IV? A) B) C) D) 9999 99999 32768 20480

7.

What is the next number in the series 1,3,7,13,21,31,--? A) B) C) D) 45 53 43 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) 01.0 02.0 C C KEYFLD *IN50 CHAIN IFEQ 1 RECNAM HiLoEq 50

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

EXSR ERROR ENDIF CHAIN RECNAM IFEQ 1 EXSR ERROR ENDIF CHAIN RECNAM IFEQ 1 EXSR ERROR ENDIF CHAIN RECNAM IFEQ 1 EXSR ERROR ENDIF HiLoEq 5051

KEYFLD *IN50

HiLoEq N50

KEYFLD *IN51

HiLoEq N5051

What will be the value of WSFLDA after the following code is executed? 01.0 02.0 03.0 C C C B) XYZAB MOVE MOVE MOVE ABCDE XYZ WSFLDB WSFLDA WSFLDB WSFLDA 5 3

A) ABCDE 11.

C) XYZ

D) ABXYZ

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 5 7 IX IY 30 30

IX IX IX

SELEC WHGT IY EXSR SUBRT1 WHLT IY EXSR SUBRT2 WHLE IY EXSR SUBRT3 OTHER EXSR SUBRT4 ENDSL

A) SUBRT1 B) SUBRT2 C) SUBRT2, SUBRT4 E) SUBRT2 & SUBRT3 F) SUBRT4

D) SUBRT3

12. A) B) C)

Which of the following is true when submitting a job? 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 jobs LDA, not a copy.

D)

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) B) C) D) SCAN CHECK RETURN NEXT variable

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?

DCL VAR(&WHSE) TYPE(*CHAR) LEN(03) VALUE( ) RTVDTAARA DTAARA(*LDA (3 2)) RTNVAR(&WHSE) A) LL B) J75 C) 75 D) 75L

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 Z-ADD Z-ADD DOULT ADD 1 ADD 10 ENDDO Z-ADD 100 0 99 IZ IY IY IZ 30 30

statement

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 02.0 03.0 04.0 05.0 06.0 07.0 08.0 09.0 C C *-------------------------------C IY C C C *-------------------------------C Z-ADD Z-ADD DOWLE ADD 1 ADD 10 ENDDO Z-ADD 100 0 99 IZ IY IY IZ 30 30

IY

A) 0 18.

B) 1

C) 90

D) 99

E) 100

What will be the value of WSFLDB after the following code is executed? 01.0 02.0 03.0 C C C B) A1 Z-ADD MOVE MOVE C) A0001 1 ABCDE WSFLDA D) 1000E WSFLDA WSFLDB WSFLDB E) 1 E 40 5

A) ABCDE

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?

A) B) C)

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 jobs *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.

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 C C *-------------------------------C IX C C C *-------------------------------C Z-ADD Z-ADD DOWLT ADD 1 ADD 2 ENDDO Z-ADD 0 0 3 IX IY IX IY 30 30

IY

A) 0

B) 3

C) 6

D) 8 what

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

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) D) C C C Eval Eval Eval ((Wrk_A + Wrk_B)*Wrk_X)/Wrk_Tot=Wrk_Answer (Wrk_A + Wrk_B)*Wrk_X/Wrk_Tot=Wrk_Answer 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 02.0 03.0 04.0 05.0 06.0 07.0 08.0 C C * C C C * C Z-ADD Z-ADD IY IZ DOULT DOUGT ADD 1 IFLT 24 20 0 IZ 10 IY IY IZ 50 50

IY

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 1 *ON IZ

IY *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) 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+++++++++++++++++++++++++++ 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)

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 KLIST KLIST FLDA FLDB FLDA FLDB FLDC HiLoEq 50

KEYFULL

KEYFLD *in50

CHAIN DOWEQ

RECNAM *off

10

Move Update

*blanks FLDB RECNAM

51

*** To get the unique record for the file and figure out the value for FLDC*** *in51 KEYFULL KEYFULL *in50 ifeq *on SETGT RECNAM READPE RECNAM ifeq Z-ADD Else Z-ADD Endif Add *off FLDC 0 1

50

SAV_FLD SAV_FLD SAV_FLD FLDC FLDB

Z-ADD SAV_FLD MOVE *BLANKS UPDATE RECNAM KEYFLD READE ENDDO RECNAM

Point out the flaws in this code

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

AS-400 ANSWER KEY

1. 2. 3.

B) OFF B ) Does not compile normally A) ON

4.

B) OFF

5.

E) None of the above.

11

8. 9. 8. 9.

C) 32768 C) 43 B) 999.0 B) 01.0 02.0 03.0 04.0 C C C C KEYFLD *IN51 CHAIN RECNAM IFEQ 1 EXSR ERROR ENDIF HiLoEq 5051

10.

D) ABXYZ

11.

B) SUBRT2

12. 13. 14.

A) The submitted job takes a copy of the LDA from the submitting job. C ) Use TESTN opcode in program B and initialize FLD C if not numeric 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 24. C) 29 25. C) 21 26. B) /COPY 27.

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

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 KLIST KLIST FLDA FLDB FLDA FLDB FLDC HiLoEq 50

KEYFULL

KEYFLD *in50

CHAIN DOWEQ Move Update

RECNAM *off *blanks FLDB RECNAM

51

*** To get the unique record for the file and figure out the value for FLDC*** *in51 KEYFULL KEYFULL *in50 ifeq *on SETGT RECNAM READPE RECNAM ifeq Z-ADD Else Z-ADD Endif Add *off FLDC 0 1

50

SAV_FLD SAV_FLD SAV_FLD FLDC FLDB

Z-ADD SAV_FLD MOVE *BLANKS UPDATE RECNAM

13

KEYFLD

READE ENDDO

RECNAM

Point out the flaws in this code

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

You might also like