Discussion
Arrange the actions taken when a compiler enters and leaves a nested block.
1. resolve uses within the block against the scope chain
2. create or push a new scope on entering the block
3. discard or pop the scope on leaving the block
4. install the declarations found in the block into that scope
Answer: C
Correct answer: 2 - 4 - 1 - 3
The scope must exist before anything can be installed in it, and the declarations must be installed before uses can be resolved against them. Discarding comes last, when the block ends and its names go out of scope. Resolving before installing would fail on any name declared in the block itself.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development