IBM C9050-041 - Programming with IBM Enterprise PL/I Exam
Page: 2 / 30
Total 146 questions
Question #6 (Topic: Topic 1)
What happens to the STATIC variables in the program U, if anything, after executing the
following code?
FETCH U;
CALL U;
RELEASE U;
FETCH U;
following code?
FETCH U;
CALL U;
RELEASE U;
FETCH U;
A. STATIC variables cannot be used in program U.
B. STATIC variables will have the values from the last time U was called.
C. STATIC variables will have their INITIAL values.
D. Nothing because there is a syntax error.
Answer: C
Question #7 (Topic: Topic 1)
What is the result of executing the following code?
DCL A CHARACTER (4) INIT('10.5');
DCL B DEC FIXED(7,1) INIT(10.5);
B = A + B;
DCL A CHARACTER (4) INIT('10.5');
DCL B DEC FIXED(7,1) INIT(10.5);
B = A + B;
A. CONVERSION is raised.
B. ERROR is raised.
C. No condition is raised and the value of B is 21.
D. No condition is raised and the value of B is 20.5
Answer: D
Question #8 (Topic: Topic 1)
What code must be added after EOF = '1'B, if any, to print 'EOF REACHED'?
DCL INF FILE RECORD INPUT;
DCL INFIELD CHAR(100) BASED(P);
DCL P PTR;
DCL EOF BIT(1) INIT('0'B);
ON ENDFILE(INF) BEGIN;
EOF = '1'B;
PUT SKIP LIST(INFIELD);
END;
OPEN FILE(INF);
READ FILE(INF) SET(P);
DO WHILE(^EOF);
READ FILE(INF) SET(P);
END;
DCL INF FILE RECORD INPUT;
DCL INFIELD CHAR(100) BASED(P);
DCL P PTR;
DCL EOF BIT(1) INIT('0'B);
ON ENDFILE(INF) BEGIN;
EOF = '1'B;
PUT SKIP LIST(INFIELD);
END;
OPEN FILE(INF);
READ FILE(INF) SET(P);
DO WHILE(^EOF);
READ FILE(INF) SET(P);
END;
A. ALLOC INFIELD; INFIELD = 'EOF REACHED';
B. INFIELD = 'EOF REACHED';
C. It cannot be printed, as it is not sure if INFIELD contains the last record
D. There is a syntax error.
Answer: A
Question #9 (Topic: Topic 1)
Given the following piece of code, how many times is the loop executed?
DCL I FIXED BIN (31);
I = 20;
DO UNTIL (I = 0);
PUT (I);
I = I - 3;
END;
DCL I FIXED BIN (31);
I = 20;
DO UNTIL (I = 0);
PUT (I);
I = I - 3;
END;
A. less than 6 times
B. 6
C. 7
D. more than 7 times
Answer: D
Question #10 (Topic: Topic 1)
Which is the impact, if any, of LIKE in the following code?
DCL
1 XY,
2 A CHAR(4),
2 B BIN FIXED(31);
DCL 1 YZ LIKE XY;
DCL
1 XY,
2 A CHAR(4),
2 B BIN FIXED(31);
DCL 1 YZ LIKE XY;
A. XY.A is always the same as YZ.A.
B. YZ is exactly the same structure as XY but with its own storage.
C. YZ is based on the structure XY.
D. There is no impact, because LIKE is a syntax error.
Answer: B