Select the code snippet which return true if the stack is empty, false otherwise.
A.
public boolean empty()
{
return q2.isEmpty();
}B.
public boolean empty()
{
return q1.isEmpty() || q2.isEmpty();
}C.
public boolean empty()
{
return q1.isEmpty();
}D.
public boolean empty()
{
return q1.isEmpty() & q2.isEmpty();
}Answer: Option B
Related Questions on Introduction to Data Structures
A. A collection of data values
B. A programming language
C. A set of algorithms
D. A way of organizing and storing data

Join The Discussion