Consider a class that uses the following variables to implement an array-based stack:

```
String [] s = new String[100];
int top = 0;

```
A)
if (top == 0)
throw new RuntimeException("Underflow");
top--;
String temp = s[top];
s[top] = null;
return temp;

B)
if (top == 0)
throw new RuntimeException("Underflow");
String temp = s[top];
top--;
s[top] = null;
return temp;

C)
if (top == 0)
throw new RuntimeException("Underflow");
return s[top-1];
top--;
s[top] = null;

D)
top--;
return s[top];


A)
if (top == 0)
throw new RuntimeException("Underflow");
top--;
String temp = s[top];
s[top] = null;
return temp;

Computer Science & Information Technology

You might also like to view...

A(n) ________ program continues to operate when there is a problem, although its efficiency may be degraded.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

If a processor needs to be replaced, it may be more cost-effective to buy a new computer

Indicate whether the statement is true or false

Computer Science & Information Technology

The ____________________ keyword identifies the start of an exception handling block of code.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Which of the following is not a valid Zoom percentage in Excel?

A) 10 B) 100 C) 300 D) 500

Computer Science & Information Technology