Free C9050-041 Exam Braindumps (page: 9)

Page 8 of 52

Answer(s): C
QUESTION: 20
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?

A. SUB1: PROC( X );DCL X FIXED UNSIGNED;IF X = 0 THENPUT SKIP LIST ( 'A');ELSEIF X
= 1 THENPUT SKIP LIST ( 'B');ELSEIF X = 2 THENPUT SKIP LIST ( 'C');ELSEIF X = 3
THENPUT SKIP LIST ( 'D');ELSEPUT SKIP LIST ( 'E');END;
B. SUB2: PROC ( X );DCL X FIXED UNSIGNED;IF X < 2 THENIF X = 0 THENPUT SKIP LIST (
'A');ELSEPUT SKIP LIST ( 'B');ELSEIF X = 2 THENPUT SKIP LIST ( 'C');ELSEIF X = 3
THENPUT SKIP LIST ( 'D');ELSEPUT SKIP LIST ( 'E');END;
C. SUB3: PROC( X ); DCL X FIXED UNSIGNED;SELECT;WHEN ( X = 0 )PUT SKIP LIST (
'A');WHEN( X = 1 )PUT SKIP LIST ( 'B');WHEN( X = 2 )PUT SKIP LIST ( 'C');WHEN( X = 3
)PUT SKIP LIST ( 'D');OTHERWISEPUT SKIP LIST ( 'E');END;END;
D. SUB4: PROC( X ); DCL X FIXED UNSIGNED;SELECT ( X );WHEN ( 0 )PUT SKIP LIST (
'A');WHEN ( 1 )PUT SKIP LIST ( 'B');WHEN ( 2 )PUT SKIP LIST ( 'C');WHEN ( 3 )PUT SKIP
LIST ( 'D');OTHERWISEPUT SKIP LIST ( 'E');END;END;

Answer(s): D
QUESTION: 21
Given the following code, the compiler wil issue the message "RULES(NOLAXIF) requires
BIT(1) expressions in IF, WHILE, etc." under the option RULES(NOLAXIF).
In order to fix this problem, the IF statement should be changed to:

A. PROC( RC );
DCL RC FIXED BIN(31);
IF RC = 0 ! 4 THEN
B. IF RC = (0 ! 4) THEN
C. IF RC = 0 ! RC = 4 THEN
D. IF BIT(RC = 0 ! 4 ) THEN
E. IF BOOL(RC = 0, 4, '0111'B) THEN

Answer(s): B
QUESTION: 22
What happens after executing the following code?

DCL A BIN FIXED(15);
A = 1_000;

A. The value of A is 1000.
B. The value of A is 8.
C. The value of A is 1.
D. There is a syntax error.



Post your Comments and Discuss IBM C9050-041 exam with other Community members: