Which if any of the following code segments correctly implements the constructor
ID: 3817797 • Letter: W
Question
Which if any of the following code segments correctly implements the constructor for Stack? A) stack:: Stack () (data = new int [MAXSIZE]; top = -1;} B) Stack:: Stack () (int to = -1;} C) stack:: stack () {top = -1;} D) void stack:: Stack () (top = 0;} E) None of the answers provided Which if any of the following code segments correctly implements the method Push ? A) void stack:: push (int n) {if (top = MAXSIZE-1) throw stackFull (); else} data[n] = top; top^++;}} B) void stack:: Push (int n) {if (IsFull (); else {top^++; data [top] = n;}} C) void stack:: Push(int n) {if (IsEmpty ()) throw stackEmpty (); else (data [top] = n; top^++;}} D) void stack:: Push (int n) {if (top = = MAXSIZE-1) throw stackfull (); else {data [top] = n; top^++;}} E) None of the answers provided Which if any of the following code segments correctly implements the method Available? A) void stack:: Available () const {return MAXSIZE;} B) int stack:: Available () coExplanation / Answer
8) answer is D
void Stack :: Stack ()
{
top = 0;
}
9) answer is B
void Stack : : Push( int n)
{
if IsFull())
throw StackFull();
else
{
top++;
data[top] = n;
}
}
10) answer is B
int Stack :: Available() const
{
return top - MAXSIZE;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.