47.
Making the push operation costly, select the code snippet which implements the pop operation.

public void pop()
{
        if(q1.size()>0)
        {
            q2.poll();
        }
        else if(q2.size()>0)
        {
            q1.poll();
        }
}

public void pop()
{
        if(q1.size()>0)
        {
            q1.poll();
        }
        else if(q2.size()>0)
        {
            q2.poll();
        }
}

public void pop()
{
        q1.poll();
	q2.poll();
}

public void pop()
{
        if(q2.size()>0)
        {
            q1.poll();
        }
        else
        {
            q2.poll();
        }
}

48.
What does the following Java code do?
public Object function()
{
	if(isEmpty())
	return -999;
	else
	{
		Object high;
		high = q[front];
		return high;
	}
}

49.
What is not a disadvantage of priority scheduling in operating systems?

50.
What is a dequeue?

Read More Section(Introduction to Data Structures)

Each Section contains maximum 100 MCQs question on Introduction to Data Structures. To get more questions visit other sections.