2013 finalenpof X 2014 finalen.pdf x 2008 fina-solnspdf X algorithm what X CQues
ID: 3693511 • Letter: 2
Question
2013 finalenpof X 2014 finalen.pdf x 2008 fina-solnspdf X algorithm what X CQuestion 500 Mar G IT1121 exams 2015 x x 2015 pd C www.site u ottawa ca turcotte/teaching/it 121/examinations 2015 final-en.pdf 2015 final-en.pdf 5 3 20 ITI 1121 April 2015 Page 3 of 20 C. Consider the following array-based implementation of a stack: public class A Stack implements Stack private E elems; private int to public Array Stack (int capacity) top- (EU) new Object I capacity 1: elems 0; public E pop if (top 0) throw new java util NoSuchElementException E saved top top saved ele 1: elems LopLe null; return sav True or False. The underlined code is needed to guard against memory leaks A 4 2:13 PM E ENG 4/24/2016 m Cortana. Ask me anythingExplanation / Answer
False.
Given code implements the stack ADT using a fixed length array.
The underline statement in the given code:
elems[top]=null;
It represents the garbage collection.
The correct statement is:
elems[top--]=null;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.