What will x’BASE and y’BASE return in the code given below? [code]TYPE color IS (red, blue, green, yellow, brown) SUBTYPE color_gun IS

What will x’BASE and y’BASE return in the code given below?
Code:
TYPE color IS (red, blue, green, yellow, brown)
SUBTYPE color_gun IS color RANGE red TO green
VARIABLE x : color;
VARIABLE y : color_gun;
A. color, color_gun
B. color_gun, color
C. color, color
D. red, color
 
Answer: c
Explanation: As specified before, ‘BASE attribute will return the base type of any type or subtype. Here x is of the type color so x’BASE will return color. Similarly, y’BASE is of type color_gun which is a subtype with its base type color. So, y’BASE will also return color.
 

Tìm kiếm

Back
Top