Solved

Given the ArrayStack Class Implementation Discussed in Section 16

Question 75

Multiple Choice

Given the ArrayStack class implementation discussed in section 16.3 (partially shown below) , select the statements needed to complete the push method. public class ArrayStack
{
Private Object[] elements;
Private int currentSize;
Public ArrayStack()
{
Final int INITIAL_SIZE = 10;
Elements = new Object[INITIAL_SIZE];
CurrentSize = 0;
}
Public void push(Object element)
{
GrowIfNecessary() ;
________________
________________
}
}


A) elements[currentSize] = element;
CurrentSize++;
B) currentSize++;
Elements[currentSize] = element;
C) elements[currentSize - 1] = element;
CurrentSize++;
D) elements[currentSize + 1] = element;
CurrentSize++;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents