Q101
Open questionSelect an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
210
Questions
6/11
Page
Pick an option on a question to see the right answer and solution.
Q101
Open questionSelect an option to see the answer and solution.
Q102
Open questionSelect an option to see the answer and solution.
Q103
Open questionOptions are not available for this question.
Select an option to see the answer and solution.
Q104
Open questionSelect an option to see the answer and solution.
Q105
Open questionSelect an option to see the answer and solution.
Q106
Open questionSelect an option to see the answer and solution.
Q107
Open questionSelect an option to see the answer and solution.
Q108
Open questionSelect an option to see the answer and solution.
Q109
Open questionpublic class Node
{
protected int data;
protected Node prev;
protected Node next;
public Node(int data)
{
this.data = data;
prev = null;
next = null;
}
public Node(int data, Node prev, Node next)
{
this.data = data;
this.prev = prev;
this.next = next;
}
public int getData()
{
return data;
}
public void setData(int data)
{
this.data = data;
}
public Node getPrev()
{
return prev;
}
public void setPrev(Node prev)
{
this.prev = prev;
}
public Node getNext
{
return next;
}
public void setNext(Node next)
{
this.next = next;
}
}
public class DLL
{
protected Node head;
protected Node tail;
int length;
public DLL()
{
head = new Node(Integer.MIN_VALUE,null,null);
tail = new Node(Integer.MIN_VALUE,null,null);
head.setNext(tail);
length = 0;
}
}Options are not available for this question.
Select an option to see the answer and solution.
Q110
Open questionSelect an option to see the answer and solution.
Q111
Open questionSelect an option to see the answer and solution.
Q112
Open questionpublic void function(int data)
{
int flag = 0;
if( head != null)
{
Node temp = head.getNext();
while((temp != head) && (!(temp.getItem() == data)))
{
temp = temp.getNext();
flag = 1;
break;
}
}
if(flag)
System.out.println("success");
else
System.out.println("fail");
}Select an option to see the answer and solution.
Q113
Open questionSelect an option to see the answer and solution.
Q114
Open questionSelect an option to see the answer and solution.
Q115
Open questionpublic class CircularQueue
{
protected static final int CAPACITY = 100;
protected int size,front,rear;
protected Object q[];
int count = 0;
public CircularQueue()
{
this(CAPACITY);
}
public CircularQueue (int n)
{
size = n;
front = 0;
rear = 0;
q = new Object[size];
}
public void enqueue(Object item)
{
if(count == size)
{
System.out.println("Queue overflow");
return;
}
else
{
q[rear] = item;
rear = (rear+1)%size;
count++;
}
}
public Object dequeue()
{
if(count == 0)
{
System.out.println("Queue underflow");
return 0;
}
else
{
Object ele = q[front];
q[front] = null;
front = (front+1)%size;
count--;
return ele;
}
}
public Object frontElement()
{
if(count == 0)
return -999;
else
{
Object high;
high = q[front];
return high;
}
}
public Object rearElement()
{
if(count == 0)
return -999;
else
{
Object low;
rear = (rear-1)%size;
low = q[rear];
rear = (rear+1)%size;
return low;
}
}
}
public class CircularQueueDemo
{
public static void main(String args[])
{
Object var;
CircularQueue myQ = new CircularQueue();
myQ.enqueue(10);
myQ.enqueue(3);
var = myQ.rearElement();
myQ.dequeue();
myQ.enqueue(6);
var = mQ.frontElement();
System.out.println(var+" "+var);
}
}Select an option to see the answer and solution.
Q116
Open questionSelect an option to see the answer and solution.
Q117
Open questionSelect an option to see the answer and solution.
Q118
Open questionSelect an option to see the answer and solution.
Q119
Open questionSelect an option to see the answer and solution.
Q120
Open questionSelect an option to see the answer and solution.