CORRECT TEXT
What happens after end of file has been reached in the following code, assuming the input file has
more than 100 records?
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;
ALLOC INFIELD;
INFIELD = 'EOF REACHED';
END;
OPEN FILE(INF);
READ FILE(INF) SET(P);
DO WHILE(^EOF);
READ FILE(INF) SET(P);
EOF = '1'B;
END;
A. INFIELD will have a value 'EOF REACHED' and the program ends
B. Runtime error because there is no CLOSE statement
C. Infinite loop
D. End of file will never be reached
正解:D
質問 2:
CORRECT TEXT
What is the most appropriate declaration for the variable A?
A = '10010001'B;
A. OCL A CHAR(2);
B. OCL A BIN FIXED(15);
C. OCL A PlC '9999999';
D. OCL A BIT(8);
正解:D
質問 3:
CORRECT TEXT
What is the result of executing the following code?
DCLA CHAR(6) INIT('100.50');
DCL B BIN FIXED(15) INIT(50);
B = A + B;
A. The value of B is 150.50.
B. The value of B is 150.
C. CONVERSION would be raised.
D. The value of B is 101.
正解:B
質問 4:
CORRECT TEXT
What will be the output of the following program?
MAIN: PROC OPTIONS(MAIN);
DCL A CONTROLLED FIXED BIN(31);
DCL B CONTROLLED FIXED B IN(31);
DCL JX FIXED BIN(31);
DO JX= 1 TO 4;
ALLOC A;
A = JX;
END;
DO WHILE( ALLOCN(A)> 0);
ALLOC B;
B = A;
FREE A; END;
DO WHILE( ALLOCN(B) > 0);
PUT SKIP LIST( B);
FREE B;
END;
END;
A. 4321
B. 1234
C. 4444
D. 1111
正解:B
質問 5:
CORRECT TEXT
What is the result, if any, of executing the following code?
DCL B DEC FIXED(15,3) INIT(12345.12);
DCL C PlC '9999999999' INIT (0);
C = B;
A. The result in C is 1234512 with 3 leading zeroes.
B. There is no result, because DEC FIXED cannot be assigned to PlC.
C. The result in C is
12345 with 5 leading zeroes.
D. There is no result, because B contains a decimal point.
正解:C
質問 6:
CORRECT TEXT
What value is output by the following program?
TEST: PACKAGE;
D
CL N EXT FIXED BIN(31) INIT(10);
DCLC(N) EXT CONTROLLED FIXED BIN(31);
MAIN: PROC OPTIONS(MAIN);
ALLOC C;
ALLOC C(20);
N = 30;
CALL UPGM;
END;
UPGM: PROC;
ALLOC C;
N = 40;
PUT SKIP LIST( DIM(C));
END;
END;
A. 40
B. 20
C. 10
D. 30
正解:D
質問 7:
CORRECT TEXT
When the following program is executed, the compiler will produce this warning message: "FIXED
DEC(7,2) operand will be converted to FIXED OIN(25,7).
Significant digits may be lost."
The best way to fix this problem and have the output value be 29.20 is to change the last
assignment statement to which of the following?
TEST: PROC;
DCL
1 REC_OUT,
03 AVAIL FIXED BIN(31),
03 TOTAL_SPARE FIXED DECIMAL(7,2),
03 WORK_TOTAL FIXED DECIMAL(7,2);
AVAIL= 17;
WORK_TOTAL = 12.2;
TOTAL_SPARE = AVAIL + WORK_TOTAL
PUT SKIP LIST( TOTAL_SPARE); END;
A. TOTAL_SPARE = DEC( AV AIL + WORK_TOTAL);
B. TOTAL_SPARE = AVAIL + BIN( WORK_TOTAL);
C. TOTAL_SPARE = DEC(AVAIL) + WORK_TOTAL;
D. TOTAL_SPARE = BIN( AVAIL + WORK_TOTAL);
正解:C
竹乃** -
これから始めたい方にも良さそうです。また、資格勉強のためだけでなくC9050-041がどんなものか知りたい方にもおすすめできます。