Which of the following is not an advantage of a priority queue?
A. Easy to implement
B. Processes with different priority can be efficiently handled
C. Applications with differing requirements
D. Easy to delete elements in any case
Select an option to see the answer and solution.
You have two jars, one jar which has 10 rings and the other has none. They are placed one above the other. You want to remove the last ring in the jar. And the second jar is weak and cannot be used to store rings for a long time.
A. Empty the first jar by removing it one by one from the first jar and placing it into the second jar
B. Empty the first jar by removing it one by one from the first jar and placing it into the second jar and empty the second jar by placing all the rings into the first jar one by one
C. There exists no possible way to do this
D. Break the jar and remove the last one
Select an option to see the answer and solution.
The essential condition which is checked before deletion in a linked queue is?
A. Underflow
B. Overflow
C. Front value
D. Rear value
Select an option to see the answer and solution.
If the elements "A", "B", "C" and "D" are placed in a queue and are deleted one at a time, in what order will they be removed?
Select an option to see the answer and solution.
You are asked to perform a queue operation using a stack. Assume the size of the stack is some value 'n' and there are 'm' number of variables in this stack. The time complexity of performing deQueue operation is (Using only stack operations like push and pop)(Tightly bound).
A. O(m)
B. O(n)
C. O(m*n)
D. Data is insufficient
Select an option to see the answer and solution.
Linked list data structure offers considerable saving in . . . . . . . .
A. Computational Time
B. Space Utilization
C. Space Utilization and Computational Time
D. Speed Utilization
Select an option to see the answer and solution.
Consider these functions:
push() : push an element into the stack
pop() : pop the top-of-the-stack element
top() : returns the item stored in top-of-the-stack-node
What will be the output after performing these sequence of operations.
push(20);
push(4);
top();
pop();
pop();
push(5);
top();A. 20
B. 4
C. stack underflow
D. 5
Select an option to see the answer and solution.
What is the space complexity of a linear queue having n elements?
A. O(n)
B. O(nlogn)
C. O(logn)
D. O(1)
Select an option to see the answer and solution.
What is the functionality of the following piece of code?
public int function(int data)
{
Node temp = head;
int var = 0;
while(temp != null)
{
if(temp.getData() == data)
{
return var;
}
var = var+1;
temp = temp.getNext();
}
return Integer.MIN_VALUE;
}A. Find and delete a given element in the list
B. Find and return the given element in the list
C. Find and return the position of the given element in the list
D. Find and insert a new element in the list
Select an option to see the answer and solution.
What is the time complexity of enqueue operation?
A. O(logn)
B. O(nlogn)
C. O(n)
D. O(1)
Select an option to see the answer and solution.
What is the functionality of the following piece of Java code?
Assume: 'a' is a non empty array of integers, the Stack class creates an array of specified size and provides a top pointer indicating TOS(top of stack), push and pop have normal meaning.
public void some_function(int[] a)
{
Stack S=new Stack(a.length);
int[] b=new int[a.length];
for(int i=0;i<a.length;i++)
{
S.push(a[i]);
}
for(int i=0;i<a.length;i++)
{
b[i]=(int)(S.pop());
}
System.out.println("output :");
for(int i=0;i<b.length;i++)
{
System.out.println(b[i]);
}
}A. print alternate elements of array
B. duplicate the given array
C. parentheses matching
D. reverse the array
Select an option to see the answer and solution.
Select the code snippet which return true if the stack is empty, false otherwise.
Options are not available for this question.
Select an option to see the answer and solution.
What is the time complexity to insert a node based on key in a priority queue?
A. O(nlogn)
B. O(logn)
C. O(n)
D. O(n2 )
Select an option to see the answer and solution.
What happens when you pop from an empty stack while implementing using the Stack ADT in Java?
A. Undefined error
B. Compiler displays a warning
C. EmptyStackException is thrown
D. NoStackException is thrown
Select an option to see the answer and solution.
What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?
A. O(1)
B. O(n)
C. θ(n)
D. Both O(n) and θ(n)
Select an option to see the answer and solution.
The data structure required to check whether an expression contains a balanced parenthesis is?
A. Stack
B. Queue
C. Array
D. Tree
Select an option to see the answer and solution.
Which of these best describes an array?
A. A data structure that shows a hierarchical behavior
B. Container of objects of similar types
C. Arrays are immutable once initialised
D. Array is not a data structure
Select an option to see the answer and solution.
Given only a single array of size 10 and no other memory is available. Which of the following operation is not feasible to implement (Given only push and pop operation)?
A. Push
B. Pop
C. Enqueue
D. Returntop
Select an option to see the answer and solution.
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is?
A. log 2 n
B. n /2
C. log 2 n - 1
D. n
Select an option to see the answer and solution.
Which of the following is false about a doubly linked list?
A. We can navigate in both the directions
B. It requires more space than a singly linked list
C. The insertion and deletion of a node take a bit longer
D. Implementing a doubly linked list is easier than singly linked list
Select an option to see the answer and solution.