Menu

Question Discussion & Solution

MCQ
Q.
Select the function which performs insertion at the front end of the dequeue?

a)

public void function(Object item)
{
 Node temp = new Node(item,null);
 if(isEmpty())
 {
  temp.setNext(trail);
  head.setNext(temp);
 }
 else
 {
  Node cur = head.getNext();
  temp.setNext(cur);
  head.setNext(temp);
 }
 size++;
}

b)

public void function(Object item)
{
 Node temp = new Node(item,null);
 if(isEmpty())
 {
  temp.setNext(trail);
  head.setNext(trail);
 }
 else
 {
  Node cur = head.getNext();
  temp.setNext(cur);
  head.setNext(temp);
 }
 size++;
}

c)

public void function(Object item)
{
 Node temp = new Node(item,null);
 if(isEmpty())
 {
  Node cur = head.getNext();
  temp.setNext(cur);
  head.setNext(temp);
 }
 else
 {
  temp.setNext(trail);
  head.setNext(temp);
 }
 size++;
}

d) None of the mentioned

forum Community Discussion

speaker_notes_off

No discussions yet. Be the first to start!

You must be logged in to participate in the discussion.

login Login to Discuss

auto_awesome Similar Questions

MCQ
1.
With what data structure can a priority queue be implemented?
forum Discussion
MCQ
2.
What is not a disadvantage of priority scheduling in operating systems?
forum Discussion
MCQ
3.
Which of the following is a collection of items into which items can be inserted arbitrarity and from which only the smallest item can be removed?
forum Discussion
MCQ
4.
A priority queue is used to implement a stack S that stores characters PUSH(C)is implemented as INSERT(Q,C,K)where K is an appropriate integer key chosen by the implementation.POP is implemented as DELETEMIN(Q)(Q). For a sequence of operations, the keys chosen are in
forum Discussion
MCQ
5.
Which of the following properties is associated with a queue?
forum Discussion

category More Data Structure Topics

article

Data Structure Basics

format_list_bulleted 128 MCQs
article

Abstract data types

format_list_bulleted 37 MCQs
article

Arrays

format_list_bulleted 134 MCQs
article

Lists

format_list_bulleted 166 MCQs
article

Stacks

format_list_bulleted 165 MCQs
article

Queues

format_list_bulleted 61 MCQs
article

Trees

format_list_bulleted 133 MCQs
article

Binary Trees

format_list_bulleted 120 MCQs
article

B Trees

format_list_bulleted 8 MCQs
article

Heaps

format_list_bulleted 36 MCQs
article

Hash based structures

format_list_bulleted 7 MCQs
article

Graphs

format_list_bulleted 157 MCQs
article

Mixed

format_list_bulleted 10 MCQs