1.
What is the value of A in PROC1 after calling PROC2?
PROC1: PROC;
DCL A BIN FIXED(15) INIT(0);
CALL PROC2(A);
END;
PROC2: PROC(A);
DCL A BIN FIXED(15);
A = A + 1;
END;
2.
What is the value of A after executing the following code?
DCL A CHAR(7) INIT (ABCDEFG);
DCL B CHAR(10) INIT (0123456789);
SUBSTR(A,4) = SUBSTR(B,5,3);
3.
Given the following external subroutine, what ENTRY declaration must NOT be used in a program that calls the subroutine?
SR1: PROC (STR);
DCL SUBSTR BUILTIN;
DCL
1 STR,
3 V1 DEC FIXED (3),
3 V2 BIN FIXED (31),
3 V3 CHARACTER (3);
STR.V1 = STR.V1 + 1;
STR.V2 = STR.V2 + 1;
STR.V3 = SUBSTR(STR.V3,1,1) !! ;
END SR1;
4.
Which of the following statements, if any, needs to be executed before the variable A can be used?
DCL A CHAR(5) CONTROLLED;
5.
What is the difference between the following two DECLARE statements, if any?
XX: PROC;
DCL A BIN FIXED(31) STATIC INIT(0);
DCL B BIN FIXED(31) AUTOMATIC INIT(0);
END;
6.
Given the following code, how many times is the loop executed?
DCL NEGATIVE BIT (1) INIT (0B);
DCL I FIXED BIN (31) INIT (10);
DO WHILE (^NEGATIVE);
PUT (I);
I += 1;
IF I >= 0 THEN
NEGATIVE = '0'B;

ELSE
NEGATIVE = '1'B;
END;
7.
What is the value of X after executing the following code?
DCL X BIT(16) INIT(10B);
8.
Given the following code, how many times is the loop executed?

DCL A(11) FIXED DEC(15,3);
DCL I FIXED BIN (31);
DO I = 1 TO 11;
A(I) = 0;
I = I+1;
END;
9.
Given the following code, which code is NOT equivalent?
DCL A CHAR (1);
...
SELECT (A);
WHEN (A) PUT (1);
WHEN (B) PUT (2);
WHEN (C) PUT (3);
OTHER;
END;
10.
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;