πŸ§ͺ VHDL MCQ Quiz Hub

VHDL Mcq – Data Objects and Types

Choose a topic to test your knowledge and improve your VHDL skills

1. SIGNED and UNSIGNED data types are defined in which package?




2. What is the correct method to declare a SIGNED type signal β€˜x’?




3. What will be the value of x in the following code? SIGNAL x : IN UNSIGNED (3 DOWNTO 0 ); x <= β€œ1101”;




4. What will be the value of x in the following code? SIGNAL x : IN UNSIGNED (3 DOWNTO 0 ); x <= β€œ1101”;




5. Which of the following option is completely legal, given that a and b are two UNSIGNED type signals?




6. If a and b are two STD_LOGIC_VECTOR input signals, then legal assignment for a and b is?




7. What do we call the data type used for representing distance, current, voltage, time, etc?




8. What is the meaning of the base unit?




9. Which of the following is only predefined physical literal in VHDL?




10. SIGNAL a : REAL; which of the following is illegal assignment for a?




11. RECORD in VHDL is similar to________ in C.




12. What is the difference between SIGNAL and VARIABLE?




13. Access types are similar to _________ in traditional programming languages.




14. How the keyword β€œTYPE” is used?




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




16. A SUBTYPE can be defined as _________




17. Which of the following is the correct syntax for declaring a SUBTYPE?




18. Which of the following can’t be the value of x? Refer to the VHDL code given below. TYPE color IS (red, green, blue, black, white, gray); SUBTYPE primary IS color RANGE red to blue; VARIABLE x: primary;




19. Look at the following declarations: TYPE array1 IS ARRAY ( 0 TO 3 ) OF BIT_VECTOR (3 DOWNTO 0 ); TYPE array 2 IS ARRAY ( 0 TO 3 ) OF array1; How many total bits can be stored in these arrays?




20. Refer to the four declarations below, which of the following is not a 2 dimensional array? TYPE array1 IS ARRAY ( 3 DOWNTO 0, 1 DOWNTO 0 ) OF STD_LOGIC; TYPE array2 IS ARRAY (3 DOWNTO 0 ) OF STD_LOGIC_VECTOR( 3 DOWNTO 0 ); TYPE array3 IS ARRAY (2 DOWNTO 0 ) OF array2; TYPE array4 IS ARRAY ( 0 TO 3, 3 DOWNTO 0 ) OF BIT;




21. Which of the following is a SUBTYPE of INTEGER?




22. Refer to the VHDL code given below, which of the following line has error? Line 1: SUBTYPE my_logic IS STD_LOGIC RANGE β€˜0’ TO β€˜1’; Line 2: SIGNAL a: BIT; Line 3: SIGNAL b: STD_LOGIC; Line 4: SIGNAL c: my_logic; Line 5: b<=a; Line 6: b<=c;




23. In the VHDL code given below, what will be the error at the time of compilation? TYPE my_int IS INTEGER RANGE -32 TO 32; TYPE other_int IS INTEGER RANGE 0 TO 100; SIGNAL x : my_int; SIGNAL y : other_int; y <= x + 2;




24. Which of the following package of IEEE contains most of the data conversion functions?




25. If we are using conv_integer(p) function, then which of the following cannot be the type of parameter β€˜p’?




26. In the function conv_unsigned(p, b), what does p and b refers to?




27. Which of the following is the correct syntax to convert INTEGER β€˜p’ into SIGNED number of β€˜b’ bits?




28. The function conv_std_logic_vector(p,b) is used for_______




29. What will be the value of y after the execution of the following VHDL code? Library ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; … SIGNAL m : UNSIGNED (3 DOWNTO 0); SIGNAL n : UNSIGNED (3 DOWNTO 0); SIGNAL y : STD_LOGIC_VECTOR (7 DOWNTO 0); y <=CONV_STD_LOGIC_VECTOR ((m+n), 8);




30. Which of the following is not an assignment operator?




31. A VARIABLE y is declared of STD_LOGIC_VECTOR type of 4 bits, if you want to assign 1001 to y, then what is the write assignment statement?




32. Which of the following logical operator has the highest precedence?




33. . In the following statements, y and z are equivalent to________ y <= NOT a AND b; z <= NOT (a AND b);




34. Which of the following VHDL statement is equivalent to NAND operation, if y, a and b are SIGNALS?




35. _____ operator is unary as well as binary operator. a)




36. The operator β€˜&’ is called the_____ operator.




37. What is the type of result of MOD operator?




38. The operators like =, /=, <, >, >= are called _________




39. What is the type of result for comparison operators?




40. ABS operator is used to _________




41. Which of the following is exponentiation operator?




42. SIGNAL x : STD_LOGIC; In this statement x is ______




43. What is the β€œSLL” operator?




44. What is the β€œSLL” operator?




45. The correct syntax for any logical shift operator like SLL and SRL is_____




46. In the following VHDL code, the values of y and z are _____ VARIABLE x : BIT_VECTOR(3 DOWNTO 0) := 1001; VARIABLE y : BIT_VECTOR(3 DOWNTO 0) := 0000; VARIABLE z : BIT_VECTOR(3 DOWNTO 0) := 0000; … y := x SRA 2; z := y SLA 2; …




47. SLL operation is equivalent to which of the following operations?




48. Which of the following is equivalent division by 2 operator?




49. . In the VHDL code given below, what will be the values of y and z? VARIABLE x : BIT_VECTOR(3 DOWNTO 0) := 1001; VARIABLE y : BIT_VECTOR(3 DOWNTO 0) := 0000; VARIABLE z : BIT_VECTOR(3 DOWNTO 0) := 0000; … y := x ROR 2; z := y ROL 2; …




50. In a statement containing two or more operators of same precedence, how the expression will be solved?




51. What will be the values of the following variables after MOD operations? x = 5 MOD 3; y = -5 MOD 3; z = 5 MOD -3;




52. What will be the values of following variables after REM operations? x = 5 REM 3; y = -5 REM 3; z = 5 REM -3;