quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryعلوم الحاسوب وتقنية المعلومات schoolبكالوريوس event_available2026-07-14

السؤال

Transcribed Image Text:

1 static myClass A; 2 3 int main() 4 { 5 myClass B = foo(); 6 7 delete B; 8 return 0; 9} 10 11 12 13 14 15 myClass* foo () { 16 } myClass C = new myClass (); myClass D; return C; a) (4pt) What is the storage allocation (static/stack/heap) for the objects associated with A, C and D? How about the storage for the pointer B? b) (6pt) Consider one execution of the program above. The execution trace, a sequence of program state- ments executed at run time, of this program is 5 13 14 15 6 7 8 For each object associated with A, C, and D, write down its lifetime (use a subset of execution trace, e.g., 13 14 15 to represent the lifetime).

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top