A programmer has been asked to write a program that tests a variable, X, and writes out A,
B, C or D if X is 0, 1, 2 or 3 respectively and writes out E when X has none of those values.
Which of the following programs represents the best practice using IF or SELECT statements?
Answer : D
To validate the assignment in the following code, which condition should be enabled?
TEST: PROC(A, B);
DCL (A, B) CHAR (*);
A = B;
END;
Answer : C
Which of the following would NOT access the third element of A?
DCL 1 XY(5),
2 A(4) CHAR(4);
Answer : D
The following code calls an external function procedure. Which program matches the entry declaration?
DCL F FLOAT;
DCL X CHAR(1);
DCL FUN ENTRY (FIXED BIN (15), FLOAT) RETURNS (CHAR(1));
X = FUN(1, F);
Answer : A
If the physical dataset referred to by DDOUT has a record length of 200 and RECFM=F, what happens after executing the following code?
DCL DDOUT FILE RECORD OUTPUT;
DCL OUT_CHAR CHAR(200) INIT('Hello World');
WRITE FILE(DDOUT) FROM(OUT_CHAR);
Answer : B
Given the following code, what construct is equivalent?
SELECT;
WHEN (A < 1) B += 1;
WHEN (A < 2) B += 2;
WHEN (A < 3) B += 3;
OTHERWISE B = 0;
END;
Answer : A
Given the following program, the compiler will produce the warning message "The structure member A2 is declared without any data attributes. A level number may be incorrect.".
What is the best way to correct the program?
TEST: PROC OPTIONS(MAIN);
DCL -
1 A,
3 A1 FIXED BIN(31),
3 A2,
3 A3 FIXED BIN(31),
3 A4 FIXED BIN(31);
END;
Answer : D
What changes should be made, if any, to the following code?
DCL A CHAR(100) BASED(P);
DCL P PTR;
READ FILE(DDIN) INTO(A);
Answer : C
Which of the following pieces of code will result in a compiler error message?
Answer : A
What is the most appropriate declaration for the variable A?
A = 'ABCDEF';
Answer : B
What will be printed when the following subroutine is called for the third time?
A : PROC;
DCL X PIC '9' INIT(0);
X = X + 1;
PUT SKIP LIST ('THE VALUE OF X IS :'!!X);
X = X + 1;
END A;
Answer : A
Given the following piece of code, what will be output?
Answer : C
If the physical dataset referred to by DDOUT has a maximum record length of 196 and a
RECFM=V, what happens after executing the following code?
DCL DDOUT FILE RECORD OUTPUT;
DCL OUT_CHAR CHAR(500) VARYING INIT((220) ' ');
OPEN FILE(DDOUT);
WRITE FILE(DDOUT) FROM(OUT_CHAR);
Answer : D
Which is the most appropriate code to turn all of the bits in A ON?
DCL A BIT(8);
Answer : B
In which of the following situations can a subroutine be replaced by a function without any major changes to the code?
Answer : D
Have any questions or issues ? Please dont hesitate to contact us