RPG-ILE : 35 Question quiz

March 8, 2010
By

RPG-ILE – RPG-IV

Quiz offered in 2007 to co’s and agencies for technical testing of their RPG programmer job applicants.

If you have been in an interview recently and were asked a question that you thought was good and worth mentioning to others, here, to be aware of, offer it to us in a comment below, along with the answer. We don’t think these questions are “good”, only that you may be faced with them. In fact, there were several that were so bad, we could not even agree on any reasonable “correct” answer and so “threw them out”.

35 Questions with answers

All questions are multiple choice.
Each question has only 1 best answer.

“This test is designed to evaluate a programmer’s knowledge of RPGIV, or RPG/LE.”

1 Which of the following statements is used to declare an array
with 20 elements, each element 10 characters long?

a. D Items S 20 DIM(10)
b. D Items S 20A DIM(10)
c. D Items S 10A DIM(20)
d. D Items C 10A DIM(20)

2 Which of the following is used to allocate memory to a program
at run time?

a. ALLOCATE
b. ALLOC
c. ALLMEM
d. LOADM
e. None of the above

3 Which of the following statements will trim off the leading blanks
from a character field CUSTOMER and place the results in NEWCUST?

a. Eval newcust = %trim(customer)
b. Eval newcust = %trimr(customer)
c. Movel customer newcust
d. Move customer newcust
e. None of the Above

4 Which of the following contains an invalid operation code extender?

a. H, M, P
b. N, P, Z
c. H, N, P
d. H, L, N

5 What type of values can be used with the %CHAR built in function?

a. Time
b. Numeric
c. Date
d. all of the above
e. none of the above

6 Which of the following can be used to determine if a CHAIN to a
keyed file was successful?

a. %FOUND
b. %ERROR
c. %EQUAL
d. %STATUS
e. none of the above

7 What is the purpose of the %ELEM built in function?

a. to return the number of used elements in an array
b. to return the value of the current array index
c. to return the number of elements in an array
d. to return the number of uninitialized elements in an array

8 Which of the following is the PDM option used to create an RPG module?

a. 14
b. 15
c. 16
d. 18

9 Which PDM option is not valid with which source member type?

a. PDM option 14 with RPGLE source member type
b. PDM option 25 with RPG source member type
c. PDM option 15 with RPG source member
d. PDM option 15 with RPGLE source member

10 Which of the following statements will extract the state code
‘MA’ out of the text field CITYST which contains ‘BOSTON MA’?

a. Movel cityst state
b. Eval state = %TRIML(cityst:7)
c. Eval state = %TRIMR(cityst:8:10)
d. Eval state = %SUBST(cityst:2:8)
e. Eval state = %SUBST(cityst:8:2)

11 Which statement will rename field CUSACT in file CUSTOMER to SAVACT?

a. Fcustomer if e k disk prefix(SAV)
b. Fcustomer if e k disk prefix(SAV:3)
c. Fcustomer if e k disk prefix(SAV,3)
d. Fcustomer if e k disk rename(CUSACT:SAVACT)
e. none of the above

12 Which of the following contains only valid File Specification keywords?

a. IGNORE, MAXDEV, SFLLIN
b. SFILE, CALLP, INCLUDE
c. INDSP, INFDS, PREFIX
d. PGMNAME, PLIST, RECNO
e. none of the above

13 In a D specification what do ‘Standalone’ and ‘Constant’ describe?

a. the declaration type
b. the internal data type
c. the data structure type
d. the subroutine type

14 In the following example, what is %SUBST?
EVAL Result = %SUBST(Fielda : STR : LEN)

a. a built-in function
b. a procedure
c. an initializer
d. a free form expression
e. none of the above

15 Which of the following date formats does the DATFMT keyword
in an H specification allow you to specify?
I. *USA
II. *MDYC
III. *YDM
IV. *JUL
V. *ILE
VI. *ISO
VII. *STD

select your answer:
a. I, V & VII
b. I, IV & VI
c. II, IV & VII
d. III, VI & VII

16 (dropped)

17 Which of the following is contained in Binding Directories?

a. PC directory names
b. names of RPGLE programs that are linked together
c. names of modules and service programs
d. names of procedures
e. names of prototypes

18 Which of the following is true of dynamic calls?

a. external calls made to programs
b. calls made to procedures within an ILE program
c. more efficient than Bound calls
d. all of the above
e. none of the above

19 Which of the following is true of Bound Calls?

a. calls made to procedures within an ILE program
b. calls made to procedures in a service program
c. executed with the CALLB Opcode
d. more efficient than dynamic calls
e. all of the above

20 What are the 2 types of binding?

a. bind by copy and bind by static
b. bind by reference and bind by dynamic
c. bind by copy and bind by reference
d. bind by reference and bind by pointers
e. Static and Dynamic

21 (dropped)

22 (dropped)

23 Which of the following parameters can be used with the %EOF
built in function?

a. record format name only
b. file name only
c. record format or and file name
d. indicator

24 Which of the following is the result of using PREFIX(XX) on a
File Definition specification line for a file FILE01 that has
one field named FIELD1 ?

a. file FILE01 is renamed to XXFILE01
b. field FIELD1 is renamed to FIELD1XX
c. field FIELD1 is renamed to XX_FIELD1
d. field FIELD1 is renamed to XXFIELD1

25 Which of the following is the result of using PREFIX(XX:2) on a
File Definition specification line for a file FILE01 that has
one field named FIELD1 ?

a. file FILE01 is renamed to XXLE01
b. field FIELD1 is renamed to XXELD1
c. field FIELD1 is renamed to XXFIELD1
d. field FIELD1 is renamed to FXXIELD1

26 Which of the following best describes the purpose of the
RENAME keyword on the File Definition Specification?

a. to rename a file
b. to rename all fields in a file
c. to rename record format
d. to rename member

27 Which of the following is the operation code extender for using
the TEST opcode to test a Timestamp ?

a. D
b. T
c. S
d. Z

28 If constants DATFMT = ‘ / / ‘ and INPDATE = 010498, what would
the value of NEWDATE be in the following calculation?

EVAL NEWDATE = %EDITW(INPDATE : DATFMT)

a. 010498
b. 01/04/98
c. 1/04/98
d. 1/4/98

29 If constants NUMFMT = ‘ , , $0. ‘ and INPNUM = 000123456, what would
the value of NEWNUM be in the following calculation?

EVAL NEWNUM = %EDITW(INPNUM : NUMFMT)

a. $000,001,234.56
b. $123,456.00
c. $ 1,234.56
d. $1,234.56

30 Which of the following is the File Specification keyword that
causes a file not to be opened at program initialization?

a. USER
b. USEROPEN
c. USROPN
d. OPEN

31 Which of the following does an ‘S’ in the Type Of Data Structure
column of a Definition Specification line indicate?

a. Stand Alone Data Structure
b. System Data Structure
c. Data Area Data Structure
d. Program Status Data Structure
e. none of the above

32 Which of the following does a ‘PR’ in the Definition Type
column of a Definition Specification line indicate?

a. Parm
b. Prototype
c. Procedure Interface
d. Bound Program

33 Which of the following is the correct calculation for
adding 23 days to date field CURDATE?

a. ADDUR 23:*DAYS CURDATE
b. ADDDUR 23:*DAY CURDATE
c. ADDDUR 23:*D CURDATE
d. ADDDAY 23 CURDATE

34 Which of the following is the correct calculation for
subtracting 6 months from date field CURDATE ?

a. SUBDDUR 6:*MONTHS CURDATE
b. SUBDUR 6:*M CURDATE
c. SUBDUR 6:*MONTH CURDATE
d. SUBMON 6 CURDATE

35 Which of the following is the operation code extender for
not locking a record on a READ or CHAIN?

a. L
b. N
c. E
d. P
e. none of the above

36 Which of the following contains all the valid extenders for
the SUBST operation code?

a. E, P
b. E, M, N, P
c. E, D, M, N
d. E, H, M, N, P
e. none of the above

37 Which of the following is the OPTIONS keyword on a
Definition specification used to specify?

a. Parameter Passing Options
b. Compilation Options
c. Program Initialization Options
d. Date Format Options
e. all of the above

38 Which of the following values is a valid option for
the OPTIONS keyword?

a. *NOPASS
b. *OMIT
c. *VARSIZE
d. *STRING
e. all of the above

39 Which of the following is the object type for a Binding Directory?

a. BNDDIRE
b. BDNDIR
c. BNDDIR
d. BNDD
e. none of the above



** ** ** Answers ** ** **

( The correct answers are marked with an asterisk. )


for instance, the first answer is marked as
D Items S 10A DIM(20)

    a.  D Items S 20 DIM(10)
    b.  D Items S 20A DIM(10)
    c.  *D Items S 10A DIM(20)
    d.  D Items C 10A DIM(20)

 

 

10 Responses to RPG-ILE : 35 Question quiz

  1. TH on March 19, 2010 at 1:48 pm

    THANK YOU

  2. Nina on June 1, 2010 at 12:34 pm

    I think some of the answers are incorrect

    It should be easy enough to find some answers in your own code. For others, you can clone a pgm and put some of these examples in it. Others, you can just do a google search – we did. If we had the answer and still “messed up”, please give us an example or a website source – then we will all know. -Greg.

  3. Mickey on July 14, 2010 at 4:39 pm

    I liked your site and was looking for answers after I took quiz … I’m an out of work AS400 programmer and just was interested to see how I did.

    P.S. Love the picture of Fort Lauderdale been there for Jets Dolphins games the last 20 years have breakfast right on strip

    Thanks

    Thank you
    Woops. I apologize. Been working on web site security and I missed making an exception for the ans. file. … it is now accessible again.

    PS
    Thanks, Fort Lauderdale beach is great

  4. Mike on January 27, 2011 at 8:41 am

    I am also out of work and trying to get the answers to your quiz. When I click on the “** Answers *”, I get a zip file of the questions in a text format. Any help would be appreciated.


    Sorry, I should have said. … The correct answers are marked with an asterisk. I apologize and will add the note under the link.

  5. steve on March 12, 2011 at 11:59 pm

    Regarding the answer to question 8, PDM option 18 is not even a valid PDM option. It always been 15.


    right. asleep at the wheel! -Greg

    Yup, that sounds correct being option 15… Although, now I am using RDI 7.5, instead of WDSC … <Big Smile>
    I love using a real IDE, instead of PDM/SEU Green Screen! Although, working with objects seems easier on Green Screen, only because faster…
    *corrected*

  6. steve on March 13, 2011 at 12:04 pm

    Answer to question 23 is wrong. %eof has only ever allowed a file name. This from the ILE RPG Referennce V5R4.

  7. steve on March 13, 2011 at 1:12 pm

    Answer to #28 could be system specific, but when I run this…

    DnewDate          s              8
    DnumDate          s              6s 0 inz(030111)
    DdatFmt           c                   '  /  /  '
    D myDS                                                   
                                                             
     /free
        newDate = %editw(numDate:datFmt);
        dsply newDate;
        *inlr = *on ; 
        return;
     /end-free 

    The result I see is 3/01/11 which is MDY format and only the month is zero supressed, not both month and day.

    Answer to #31 should be d. Data structure type can be S or U (col 23), S meaning it a program status data structure.
    *. 1 …+… 2 …+
    D pgmDS sds

    #33 and #34

    ADDDUR allows days as *D or *DAYS, months as *M or *MONTHS, etc.

    DdueDate s d DATFMT(*USA) INZ(*SYS)
    DresultDate s like(dueDate)

    C dueDate ADDDUR 23:*D resultDate
    C resultDate dsply
    C dueDate ADDDUR 23:*DAYS resultDate
    C resultDate dsply
    /free
    *inlr = *on ;
    return;
    /end-free

  8. JW Densmore on February 2, 2012 at 11:21 pm

    For some reason the asterisk does not show up on the correct answer for me.

  9. JW Densmore on February 3, 2012 at 5:53 pm

    I am not showing the answers on the Document.

  10. cborill on March 2, 2012 at 6:10 pm

    no answers are given for this test

Leave a Reply

Your email address will not be published. Required fields are marked. *
Comments will be approved as soon as possible.