試卷名稱:109年 - 108 國立中山大學_碩士班招生考試_電機系(丙組):資料結構#124087
年份:109年
科目:中山◆電機◆電磁學
5. Suppose a stack is implemented by a variable top and an array B[4]. Note that top denotes the index of the last element pushed. Initially, the stack is empty. Then the following operations are performed in order:
push(1), push(2), pop(), push(3), push(4), pop(), getTop(), push(5), pop(), push(6).
Which of the following is true in the end?
(A) B[0] = 3;
(B) B contains 4 integers available;
(C) An overflow occurred, so the operations could not be completely done;
(D) top is 2.