题目
SWEN90010_2025_SM1 Practice Exam
多重下拉选择题
Consider the following Ada program. procedure Pointers is X : access Integer := new Integer'(5); Y : access Integer := X; begin Y.all := 10; end Pointers; Variable Y is called an [ Select ] reference alias duplicate pointer for X because [ Select ] because X and Y both refer to the same memory location because X and Y refer to distinct (separate) memory locations because Y refers to the memory that holds the pointer X because X and Y are both pointers . After this program finishes executing, the statement "X.all = 5" is false
查看解析
标准答案
Please login to view
思路分析
The question asks to fill in two blanks about what Y is relative to X, and then to assess the truth of X.all = 5 after the program runs.
Option 1 (Y is called an ...):
- alias: This is the correct conceptual idea here. In Ada, Y is declared as an access value (a pointer) that designates the same underlying storage as X. Saying Y is an alias conveys that Y refers to the same object as X rather than a separate separate object. Other possible terms like reference or duplicate do not align with Ada terminology for an access value that designates the same storage.
- reference: This would be misleading in Ada terminology since the......Login to view full explanation登录即可查看完整答案
我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。
类似问题
Which operator is used to get the address of a variable?
What is a pointer to a pointer?
What operator is used to access members of a structure through a pointer?
Consider the following Ada program. procedure Pointers is X : access Integer := new Integer'(5); Y : access Integer := X; begin Y.all := 10; end Pointers; Variable Y is called an [ Select ] reference alias duplicate pointer for X because [ Select ] because X and Y both refer to the same memory location because X and Y refer to distinct (separate) memory locations because Y refers to the memory that holds the pointer X because X and Y are both pointers . After this program finishes executing, the statement "X.all = 5" is [ Select ] true false
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!