VHDL Questions and Answers – Procedures – 1

This set of VHDL Multiple Choice Questions & Answers (MCQs) focuses on “Procedures – 1”.

1. Procedures are invoked as _________
a) Statements
b) Expressions
c) Values
d) Assignments
View Answer

Answer: a
Explanation: Unlike functions, procedures are invoked as a statement. Functions are always invoked as expressions as a part of the assignment statement but procedures are directly called as statements only. No assignment operator is needed.

2. Procedures are useful when _________
a) Functions are not synthesizable
b) Signals are needed to be declare
c) Multiple values are needed as a result
d) Architecture can’t contain some statement
View Answer

Answer: c
Explanation: Procedures usually returns many values, which is not possible with the case of function. So, procedures are useful when there are multiple results coming from the procedure. Note that procedure can return single value as well.

3. Which of the following is correct syntax for procedure body?
a)

advertisement
advertisement
    PROCEDURE procedure_name (parameter_list) IS
    BEGIN
    declarations;
    sequential_statements;
    END PROCEDURE;

b)

    PROCEDURE procedure_name (parameter_list) IS
    declarations;
    BEGIN
    sequential_statements;
    END procedure_name;

c)

advertisement
    PROCEDURE procedure_name (parameter_list) IS
    declarations;
    BEGIN
    sequential_statements;
    concureent_statements;
    END PROCEDURE;

d)

advertisement
    PROCEDURE procedure_name (parameter_list) IS
    declarations;
    BEGIN
    sequential_statements;
    concurrent_statements;
    END procedure_name;
View Answer
Answer: b
Explanation: The procedure definition is very similar to the function definition. It starts with the keyword PROCEDURE followed by the name of procedure and then the parameter list. Then local declarations are made within the procedure body, which are separated from the statements part by the keyword begin. Then the procedure body is ended by the keyword END followed by name of procedure.
 
 

4. Procedure doesn’t have a return type.
a) True
b) False
View Answer

Answer: a
Explanation: Functions always have a return type which specifies the type of value which is returned by the function. But, procedures return multiple values; therefore, it is not possible to use a single return type. So, There is no return type for a procedure.

5. Which of the following could be the objects in the parameter list of a procedure?
a) CONSTANTS, VARIABLES
b) VARIABLES, SIGNALS
c) CONSTANTS, SIGNALS
d) CONSTANT, SIGNALS, VARIABLES
View Answer

Answer: d
Explanation: A procedure may have any of three objects in its parameter list. A SIGNAL, CONSTANT as well as a VARIABLE can be used as a parameter to a procedure. In functions, only signals and constants can be parameters.

6. A procedure can’t contain a _______ statement.
a) WAIT
b) IF
c) RETURN
d) CASE
View Answer

Answer: c
Explanation: A procedure, unlike functions, may contain WAIT statement but it doesn’t include any return statement. The assignments made in the procedure are considered as the values which are needed to be returned to the main code.

7. The parameter of a procedure can have any of the three modes.
a) True
b) False
View Answer

Answer: a
Explanation: A procedure can have any number of IN, OUT or INOUT parameters which can be signals, constants or variables. There is no restriction on the mode of the signal It may be any of the three modes which are IN, OUT or INOUT.

8. Which of the following is the default class of any parameter with its mode as IN?
a) SIGNAL
b) CONSTANT
c) VARIABLE
d) SIGNAL or VARIABLE
View Answer

Answer: b
Explanation: The default class for any IN mode parameter is CONSTANT. It means that if no mode is specified the parameters of mode IN are interpreted as class CONSTANT.

9. Which of the following is the default mode of a parameter of procedure?
a) IN
b) OUT
c) INOUT
d) IN or INOUT
View Answer

Answer: a
Explanation: If no mode is specified in the front of a parameter, then it is considered as an input signal or of a mode IN. So, The default mode for a parameter of a procedure is IN mode which is similar to the functions.

10. It is given that the mode of a parameter is OUT mode but its class is not specified by the user. To which class does it belong?
a) INTEGER
b) CONSTANT
c) VARIABLE
d) SIGNAL
View Answer

Answer: c
Explanation: The CONSTANT is the default class for the parameters of mode IN only. For other parameters that have their mode either as OUT or as INOUT the default class is considered as VARIABLE class.

Sanfoundry Global Education & Learning Series – VHDL.

To practice all areas of VHDL, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.