IBM Programming with IBM Enterprise PL/I Sample Questions:
1. CORRECT TEXT
Given the following code, what will be output?
PGM1: PROC OPTIONS(MAIN);
DCL (K,L) BIN FIXED (15);
I,J,K,L= 1;
CALL SRI;
CALL SRJ;
CALL SRK;
CALL SRL;
PUT SKIP LIST(I*J*K*L);
SRI: PROC;I = 2; END;
SRJ: PROC; DCL J BIN FIXED(15); J = 3; END;
SRK: PROC;K = 5; END;
SRL: PROC; DCL L BIN FIXED(15); L = 7; END;
END;
A) 10
B) 1
C) 21
D) 210
2. CORRECT TEXT
Which of the following is the best way to force end of file of file DDIN before the actual end of file is reached?
DCL DDIN FILE RECORD INPUT;
A) SIGNAL ENDPAGE(DDIN);
B) End of file cannot be forced.
C) SIGNAL ENDFILE(DDIN);
D) CLOSE ENDFILE(DDIN);
3. CORRECT TEXT
If the physical dataset referred to by DDIN has a record length of 200 and a RECFM of F, what happens after executing the following code?
DCL DDIN FILE RECORD lNPUT
DCL 1 INSTR,
2 A CHAR(150),
2 B CHAR(150);
OPEN FILE(DDIN);
READ FILE(DDIN) INTO(INSTR);
A) At runtime, an error will occur because of mismatch of record length.
B) When executed,
nothing will be read into the buffer.
C) At compile time, an error will occur because of mismatch of record length.
D) When executed, one record will be read into buffer.
4. CORRECT TEXT
What is the value of A after executing the following code?
DCL A CHAR(6) INIT ('ABCDEF);
DCL B CHAR(10) NIT ('0123456789');
A = SUBSTR(B,5,3);
A) 'ABC456'
B) '456DEF'
C) ' 456'
D) '456 '
5. CORRECT TEXT
Which message will be displayed, if any, when the following code is executed with the Enterprise
PL/I compiler using default compiler options?
DCL 1 STRUCTURE,
2 A CHAR(4),
2 P PTR;
STRUCTURE = ";
SELECT (P);
WHEN (NULL()) PUT LIST ('P IS NULL');
WHEN (SYSNULLO) PUT LIST ('P IS SYSNULL'); OTHERWISE PUT LIST ('P is something else'); END;
A) The compiler will generate an error for the assignment statement. Forcing execution will
produce unpredictable results.
B) P NULL
C) P is something else
D) P is SYSNULL
Solutions:
| Question # 1 Answer: A | Question # 2 Answer: C | Question # 3 Answer: A | Question # 4 Answer: D | Question # 5 Answer: C |

We're so confident of our products that we provide no hassle product exchange.


By Beatrice


