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

Join The Discussion