Consider the usual algorithm for determining whether a sequence of parentheses is balanced. The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the algorithm analyzes: (()(())(()))?
Select an option to see the answer and solution.
A queue follows . . . . . . . .
A. FIFO (First In First Out) principle
B. LIFO (Last In First Out) principle
C. Ordered array
D. Linear tree
Select an option to see the answer and solution.
Consider you have an array of some random size. You need to perform dequeue operation. You can perform it using stack operation (push and pop) or using queue operations itself (enQueue and Dequeue). The output is guaranteed to be same. Find some differences?
A. They will have different time complexities
B. The memory used will not be different
C. There are chances that output might be different
D. No differences
Select an option to see the answer and solution.
Why is implementation of stack operations on queues not feasible for a large dataset (Asssume the number of elements in the stack to be n)?
A. Because of its time complexity O(n)
B. Because of its time complexity O(log(n))
C. Extra memory is not required
D. There are no problems
Select an option to see the answer and solution.
Which of the following statements are not correct with respect to Singly Linked List(SLL) and Doubly Linked List(DLL)?
A. Complexity of Insertion and Deletion at known position is O(n) in SLL and O(1) in DLL
B. SLL uses lesser memory per node than DLL
C. DLL has more searching power than SLL
D. Number of node fields in SLL is more than DLL
Select an option to see the answer and solution.
In a circular queue, how do you increment the rear end of the queue?
A. rear++
B. (rear+1) % CAPACITY
C. (rear % CAPACITY)+1
D. rear-
Select an option to see the answer and solution.
Select the code snippet which returns the top of the stack.
Options are not available for this question.
Select an option to see the answer and solution.
Given below is the Node class to perform basic list operations and a Stack class with a no arg constructor. Select from the options the appropriate push() operation that can be included in the Stack class. Also 'first' is the top-of-the-stack.
class Node
{
protected Node next;
protected Object ele;
Node()
{
this(null,null);
}
Node(Object e,Node n)
{
ele=e;
next=n;
}
public void setNext(Node n)
{
next=n;
}
public void setEle(Object e)
{
ele=e;
}
public Node getNext()
{
return next;
}
public Object getEle()
{
return ele;
}
}
class Stack
{
Node first;
int size=0;
Stack()
{
first=null;
}
}
Options are not available for this question.
Select an option to see the answer and solution.
The process of accessing data stored in a serial access memory is similar to manipulating data on a . . . . . . . .
A. Heap
B. Binary Tree
C. Array
D. Stack
Select an option to see the answer and solution.
Linked list is considered as an example of . . . . . . . . type of memory allocation.
A. Dynamic
B. Static
C. Compile time
D. Heap
Select an option to see the answer and solution.
How do you insert an element at the beginning of the list?
Options are not available for this question.
Select an option to see the answer and solution.
What would be the asymptotic time complexity to find an element in the linked list?
A. O(1)
B. O(n)
C. O(n2 )
D. O(n4 )
Select an option to see the answer and solution.
What is the worst case time complexity of inserting a node in a doubly linked list?
A. O(nlogn)
B. O(logn)
C. O(n)
D. O(1)
Select an option to see the answer and solution.
What would be the asymptotic time complexity to insert an element at the front of the linked list (head is known)?
A. O(1)
B. O(n)
C. O(n2 )
D. O(n3 )
Select an option to see the answer and solution.
What does 'stack underflow' refer to?
A. accessing item from an undefined stack
B. adding items to a full stack
C. removing items from an empty stack
D. index out of bounds exception
Select an option to see the answer and solution.
In linked list implementation of queue, if only front pointer is maintained, which of the following operation take worst case linear time?
A. Insertion
B. Deletion
C. To empty a queue
D. Both Insertion and To empty a queue
Select an option to see the answer and solution.
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]);
}
}A. 3 and 5
B. 5 and 3
C. 2 and 4
D. 4 and 2
Select an option to see the answer and solution.
Which of the following is not a disadvantage to the usage of array?
A. Fixed size
B. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size
C. Insertion based on position
D. Accessing elements at specified positions
Select an option to see the answer and solution.
Convert the following infix expressions into its equivalent postfix expressions.
(A + B ⋀D)/(E – F)+G
A. (A B D ⋀ + E F – / G +)
B. (A B D +⋀ E F – / G +)
C. (A B D ⋀ + E F/- G +)
D. (A B D E F + ⋀ / – G +)
Select an option to see the answer and solution.
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);
}A. 1 4 6 6 4 1
B. 1 3 5 1 3 5
C. 1 2 3 5
D. 1 3 5 5 3 1
Select an option to see the answer and solution.