Which of the following is a wrong declaration for a new data type?

Vy Bùi

New member
Which of the following is a wrong declaration for a new data type?
A. TYPE my_logic IS RANGE 0 to 100;
B. TYPE my_logic IS (‘0’, ‘1’, ‘2’);
C. TYPE my_logic IS ARRAY (0 TO 3) OF BIT;
D. TYPE my_logic IS <0 TO 20 >
 
Answer: d
Explanation: TYPE can be used in three forms as shown above. For defining range, there are two methods as illustrated in option TYPE my_logic IS RANGE 0 to 100; and option TYPE my_logic IS (‘0’, ‘1’, ‘2’);. If we want to define a user defined array then the sytanx like option TYPE my_logic IS ARRAY (0 TO 3) OF BIT; follows. But, we can’t define range by using <> sign.
 

Tìm kiếm

Back
Top