What will be the value of x and y? [code]TYPE my_type IS ARRAY (15 DOWNTO 0) OF BIT; … VARIABLE x, y : INTEGER; x := my_type’LEFT; y :=

Kim Trang

New member
What will be the value of x and y?
Code:
TYPE my_type IS ARRAY (15 DOWNTO 0) OF BIT;
…
VARIABLE x, y : INTEGER;
x := my_type’LEFT;
y := my_type’HIGH;
…
A. 0, 0
B. 0, 15
C. 15, 0
D.15, 15
 
Answer: d
Explanation: Since the attribute used is for the type, so it is value type attribute. ‘LEFT will give the left bound of the type or the leftmost value which is 15. Here my_type is described as a data type which has bound 0 to 15. So, HIGH will return the upper bound which is 15. So, x and y both will be 15 in this case.
 

Tìm kiếm

Back
Top