What would be the value of x and y in the example given below? [code]TYPE color IS (red, yellow, green, blue, purple, orange) VARIABLE

Phương Linh

New member
What would be the value of x and y in the example given below?
Code:
TYPE color IS (red, yellow, green, blue, purple, orange)
VARIABLE x,y : color;
x := color’SUCC(green);
y := color’VAL(4)
A. blue, green
B. blue, blue
C. 4, blue
D. blue, 4
 
Answer: b
Explanation: Since ‘SUCC attribute returns the succeeding value of the argument. In the argument, value green is used so the succeeding value is blue. Therefore, x will be blue. Also, ‘VAL will return the value at 4th position which is blue.
 

Tìm kiếm

Back
Top