Compiler Design MCQ Questions And Answers - Run-Time Environment
This section focuses on "Run-Time Environment" in Compiler Design. These Multiple Choice Questions (MCQs) should be practiced to improve the Compiler Design skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. Which of the following known as the text part of a program that does not change at runtime. Its memory requirements are known at the compile time?
A. Code
B. Procedures
C. Variables
D. All of the above
View Answer
Ans : A
Explanation: Code : It is known as the text part of a program that does not change at runtime. Its memory requirements are known at the compile time.
2. A procedure has a start and an end delimiter and everything inside it is called the body of the procedure.
A. TRUE
B. FALSE
C. A procedure has a start with delimiter but not end with delimiter.
D. A procedure has a not start with delimiter but end with delimiter.
View Answer
Ans : A
Explanation: A procedure has a start and an end delimiter and everything inside it is called the body of the procedure.
3. In activation record, Which of the following Stores the address of activation record of the caller procedure?
A. Access Link
B. Actual Parameters
C. Control Link
D. Temporaries
View Answer
Ans : C
Explanation: Control link : Stores the address of activation record of the caller procedure.
4. Whenever a procedure is executed, its activation record is stored on the stack, also known as?
A. Access Stack
B. Control stack
C. Formal Stack
D. Return Stack
View Answer
Ans : B
Explanation: Whenever a procedure is executed, its activation record is stored on the stack, also known as control stack
5. _________ are known at the runtime only, unless they are global or constant.
A. values
B. Object
C. Variables
D. All of the above
View Answer
Ans : C
Explanation: Variables are known at the runtime only, unless they are global or constant. Heap memory allocation scheme is used for managing allocation and de-allocation of memory for variables in runtime.
6. The location of memory (address) where an expression is stored is known?
A. r-value
B. k-value
C. l-value
D. t-value
View Answer
Ans : C
Explanation: The location of memory (address) where an expression is stored is known as the l-value of that expression.
7. What is true about Formal Parameters?
A. These variables are declared in the definition of the called function.
B. These variables are specified in the function call as arguments.
C. Variables whose values or addresses are being passed to the called procedure are called Formal Parameter.
D. All of the above
View Answer
Ans : A
Explanation: Variables that take the information passed by the caller procedure are called formal parameters. These variables are declared in the definition of the called function.
8. In which mechanism, the calling procedure passes the r-value of actual parameters and the compiler puts that into the called procedure’s activation record?
A. Pass by Reference
B. Pass by Name
C. Pass by Copy-restore
D. Pass by Value
View Answer
Ans : D
Explanation: Pass by Value : In pass by value mechanism, the calling procedure passes the r-value of actual parameters and the compiler puts that into the called procedure’s activation record.
9. In which mechanism, the name of the procedure being called is replaced by its actual body?
A. Pass by Reference
B. Pass by Name
C. Pass by Copy-restore
D. Pass by Object
View Answer
Ans : B
Explanation: In pass by name mechanism, the name of the procedure being called is replaced by its actual body. Pass-by-name textually substitutes the argument expressions in a procedure call for the corresponding parameters in the body of the procedure so that it can now work on actual parameters, much like pass-by-reference.
10. What will be error?
7 = x + y;
A. l-value error
B. r-value error
C. Infinite loop
D. Both A and B
View Answer
Ans : A
Explanation: An l-value error, as the constant 7 does not represent any memory location.
Discussion