91.
How do you insert an element at the beginning of the list?

public void insertBegin(Node node)
{
	node.setNext(head);
	head = node;
	size++;
}

public void insertBegin(Node node)
{
	head = node;
	node.setNext(head);
	size++;
}

public void insertBegin(Node node)
{
	Node temp = head.getNext()
	node.setNext(temp);
	head = node;
	size++;
}

public void insertBegin(Node node)
{
	Node temp = head.getNext()
	node.setNext(temp);
	node = head;
	size++;
}

96.
In linked list implementation of queue, if only front pointer is maintained, which of the following operation take worst case linear time?

97.
What is the output of the following Java code?
public class array
{
	public static void main(String args[])
	{
		int []arr = {1,2,3,4,5};
		System.out.println(arr[2]);
		System.out.println(arr[4]);
	}
}

98.
Which of the following is not a disadvantage to the usage of array?

99.
Convert the following infix expressions into its equivalent postfix expressions.
(A + B ⋀D)/(E – F)+G

100.
What is the output of following function for start pointing to first node of following linked list?
1->2->3->4->5->6
void fun(struct node* start)
{
    if(start == NULL)
    return;
    printf("%d  ", start->data); 
    if(start->next != NULL )
    fun(start->next->next);
    printf("%d  ", start->data);
}

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.