Which of the following is NOT a valid way to set a pointer P to zero?
Answer : D
Given the following piece of code, what will be the output of the preprocessor?
%F: PROC(S) RETURNS(CHAR);
DCL S CHAR;
RETURN (SUBSTR(S, 1, 1));
%END;
PUT (F(ABC));
%ACTIVATE F;
PUT (F(ABC));
Answer : A
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 INPUT;
DCL P PTR;
DCL 1 INSTR BASED(P),
2 A CHAR(100),
2 B CHAR(100);
ALLOCATE INSTR;
OPEN FILE(DDIN);
READ FILE(DDIN) INTO(INSTR);
Answer : B
Given the following code, what declaration of I will cause an infinite loop under default condition enablement?
DO I = 1 TO 99;
Answer : C
In which of the following cases is it possible to change the value of a variable in a routine when it is passed to the routine as an argument?
Answer : C
What is the result, if any, of executing the following code?
DCL A BIT(1) INIT('0'B);
DCL B BIT(1) INIT('0'B);
DCL C BIT(1) INIT('1'B);
A = B ! C;
Answer : B
What is the most appropriate way to assign a value to variable A?
DCL A BIN FIXED(15);
Answer : D
Given the following code, what procedure will be accepted by the compiler?
DCL A DIM (10) CHAR (100) VAR BASED (P);
DCL P PTR;
ALLOCATE A;
CALL SUB (P);
Answer : A
What is the value of A after executing the following code?
DCL A CHAR(6) INIT ('ABCDEF');
DCL B CHAR(10) INIT ('0123456789');
A = SUBSTR(B,5,3);
Answer : A
Given the following code, with what attribute should the variable EOF be declared?
DO WHILE(^EOF);
Answer : B
What will be output by the following program?
TEST: PROC OPTIONS(MAIN);
DCL A CONTROLLED FIXED BIN(31);
ALLOC A;
ALLOC A;
CALL SUB(A);
PUT SKIP LIST( ALLOCN(A) );
SUB: PROC( B );
DCL B CONTROLLED FIXED BIN(31);
FREE B;
ALLOC B;
ALLOC B;
FREE B;
ALLOC B;
END;
END;
Answer : B
Which of the following is a restriction using the BYVALUE attribute?
Answer : D
What is the value of B after executing the following code?
DCL A CHAR(10) INIT('12A4BABCAB');
DCL B BIN FIXED(31) INIT(0);
B = INDEX(A,'AB');
A. 2 -
B. 3 -
C. 6 -
D. 9 -
Answer : C Topic 2, B B
Given the following code, what will happen if the variable MAX has a value larger than
32767?
DCL I FIXED BIN (15);
DCL MAX FIXED BIN (31);
DO I = 1 TO MAX;
Answer : D
If the physical dataset referred to by DDOUT has a maximum record length of 4096 and a
RECFM=V, what happens after executing the following code?
DCL DDOUT FILE RECORD OUTPUT;
DCL OUT_CHAR CHAR(500) VARYING INIT('This is a varchar test');
OPEN FILE(DDOUT);
WRITE FILE(DDOUT) FROM(OUT_CHAR);
Answer : A