1. 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 initialized

D. Array is not a data structure

2. How do you initialize an array in C?

A. int arr[3] = (1,2,3);

B. int arr(3) = {1,2,3};

C. int arr[3] = {1,2,3};

D. int arr(3) = (1,2,3);

3. How do you instantiate an array in Java?

A. int arr[] = new int(3);

B. int arr[];

C. int arr[] = new int[3];

D. int arr() = new int(3);

4. Which of the following is the correct way to declare a multidimensional array in Java?

A. int[] arr;

B. int arr[[]];

C. int[][]arr;

D. int[[]] arr;

5. 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

6. 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[5]); } }

A. 4

B. 5

C. ArrayIndexOutOfBoundsException

D. InavlidInputException

7. When does the ArrayIndexOutOfBoundsException occur?

A. Compile-time

B. Run-time

C. Not an error

D. Not an exception at all

8. Which of the following concepts make extensive use of arrays?

A. Binary trees

B. Scheduling of processes

C. Caching

D. Spatial locality

9. What are the advantages of arrays?

A. Objects of mixed data types can be stored

B. Elements in an array cannot be sorted

C. Index of the first element of an array is 1

D. Easier to store elements of the same data type

10. What are the disadvantages of arrays?

A. Data structures like queue or stack cannot be implemented

B. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

C. Index value of an array can be negative

D. Elements are sequentially accessed

11. Assuming int is of 4bytes, what is the size of int arr[15];?

A. 15

B. 19

C. 11

D. 60

12. In general, the index of the first element in an array is __________

A. 0

B. -1

C. 2

D. 1

13. Elements in an array are accessed _____________

A. randomly

B. sequentially

C. exponentially

D. logarithmically

1. Process of inserting an element in stack is called ____________

A. Create

B. Push

C. Evaluation

D. Pop

2. Process of removing an element from stack is called __________

A. Create

B. Push

C. Evaluation

D. Pop

3. In a stack, if a user tries to remove an element from an empty stack it is called _________

A. Underflow

B. Empty collection

C. Overflow

D. Garbage Collection

4. Pushing an element into a stack already having five elements and stack size of 5, then the stack becomes ___________

A. Overflow

B. Crash

C. Underflow

D. User flow

5. Entries in a stack are “ordered”. What is the meaning of this statement?

A. A collection of stacks is sortable

B. Stack entries may be compared with the ‘<‘ operation

C. The entries are stored in a linked list

D. There is a Sequential entry that is one by one

6. Which of the following is not the application of stack?

A. A parentheses balancing program

B. Tracking of local variables at run time

C. Compiler Syntax Analyzer

D. Data Transfer between two asynchronous process

7. 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: (()(())(()))?

A. 1

B. 2

C. 3

D. 4 or more

8. Consider the usual algorithm for determining whether a sequence of parentheses is balanced. Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right parentheses (in some order). The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the computation?

A. 1

B. 2

C. 3

D. 4 or more

9. What is the value of the postfix expression 6 3 2 4 + – *?

A. 1

B. 40

C. 74

D. -18

10. Here is an infix expression: 4 + 3*(6*3-12). Suppose that we are using the usual stack algorithm to convert the expression from infix to postfix notation. The maximum number of symbols that will appear on the stack AT ONE TIME during the conversion of this expression?

A. 1

B. 2

C. 3

D. 4

1. The postfix form of the expression (A+ B.*(C*D- E)*F / G is?

A. AB+ CD*E – FG /**

B. AB + CD* E – F **G /

C. AB + CD* E – *F *G /

D. AB + CDE * – * F *G /

2. The data structure required to check whether an expression contains a balanced parenthesis is?

A. Stack

B. Queue

C. Array

D. Tree

3. What data structure would you most likely see in the non-recursive implementation of a recursive algorithm?

A. Linked List

B. Stack

C. Queue

D. Tree

4. 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

5. The postfix form of A*B+C/D is?

A. *AB/CD+

B. AB*CD/+

C. A*BC+/D

D. ABCD+/*

6. Which data structure is needed to convert infix notation to postfix notation?

A. Branch

B. Tree

C. Queue

D. Stack

7. The prefix form of A-B/ (C * D ^ E) is?

A. -/*^ACBDE

B. -ABCD*^DE

C. -A/B*C^DE

D. -A/BC*^DE

8. What is the result of the following operation?

Top (Push (S, X))

A. X

B. X+S

C. S

D. XS

9. The prefix form of an infix expression (p + q) – (r * t) is?

A. + pq – *rt

B. – +pqr * t

C. – +pq * rt

D. – + * pqrt

10. Which data structure is used for implementing recursion?

A. Queue

B. Stack

C. Array

D. List

1. The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?

A. 600

B. 350

C. 650

D. 588

2. Convert the following infix expressions into their 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 +)

3. Convert the following Infix expression to Postfix form using a stack.

x + y * z + (p * q + r) * s, Follow usual precedence rule and assume that the expression is legal.

A. xyz*+pq*r+s*+

B. xyz*+pq*r+s+*

C. xyz+*pq*r+s*+

D. xyzp+**qr+s*+

4. Which of the following statement(s) about stack data structure is/are NOT correct?

A. Linked List is used for implementing Stacks

B. Top of the Stack always contains the new node

C. Stack is the FIFO data structure

D. Null link is present in the last node at the bottom of the stack

5. Consider the following operation performed on a stack of size 5.

Push(1); Pop(); Push(2); Push(3); Pop(); Push(4); Pop(); Pop(); Push(5);

After the completion of all operations, the number of elements present in the stack is?

A. 1

B. 2

C. 3

D. 4

6. Which of the following is not an inherent application of stack?

A. Reversing a string

B. Evaluation of postfix expression

C. Implementation of recursion

D. Job scheduling

7. The type of expression in which the operator succeeds its operands is?

A. Infix Expression

B. Prefix Expression

C. Postfix Expression

D. Both Prefix and Postfix Expressions

8. Assume that the operators +,-, and X is left-associative and ^ are right-associative. The order of precedence (from highest to lowest) is ^, X, +, -. The postfix expression for the infix expression a + b X c – d ^ e ^ f is?

A. abc X+ def ^^ –

B. abc X+ de^f^ –

C. ab+c Xd – e ^f^

D. -+aXbc^ ^def

9. If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, what is the order of removal?

A. ABCD

B. DCBA

C. DCAB

D. ABDC

1. A linear collection of data elements where the linear node is given by means of the pointer is called?

A. Linked list

B. Node list

C. Primitive list

D. Unordered list

2. Consider an implementation of an unsorted singly linked list. Suppose it has its representation with a head pointer only. Given the representation, which of the following operation can be implemented in O(1) time?

i) Insertion at the front of the linked list

ii) Insertion at the end of the linked list

iii) Deletion of the front node of the linked list

iv) Deletion of the last node of the linked list

A. I and II

B. I and III

C. I, II, and III

D. I, II, and IV

3. In the linked list each node contains a minimum of two fields. One field is a data field to store the data second field is?

A. Pointer to character

B. Pointer to integer

C. Pointer to node

D. Node

4. What would be the asymptotic time complexity to add a node at the end of a singly linked list, if the pointer is initially pointing to the head of the list?

A. O(1)

B. O(n)

C. θ(n)

D. θ(1)

5. 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(n^{2})

D. O(n^{3})

6. What would be the asymptotic time complexity to find an element in the linked list?

A. O(1)

B. O(n)

C. O(n^{2})

D. O(n^{4})

7. What would be the asymptotic time complexity to insert an element at the second position in the linked list?

A. O(1)

B. O(n)

C. O(n^{2})

D. O(n^{3})

8. The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used?

A. Singly linked list

B. Doubly linked list

C. Circular doubly linked list

D. Array implementation of list

9. Consider the following definition in the c programming language.

struct node { int data; struct node * next; } typedef struct node NODE; NODE *ptr;

Which of the following c code is used to create a new node?

A. ptr = (NODE*)malloc(sizeof(NODE));

B. ptr = (NODE*)malloc(NODE);

C. ptr = (NODE*)malloc(sizeof(NODE*));

D. ptr = (NODE)malloc(sizeof(NODE));

1. What kind of linked list is best to answer questions like “What is the item at position n?”

A. Singly linked list

B. Doubly linked list

C. Circular linked list

D. Array implementation of linked list

2. Linked lists are not suitable for the implementation of ___________

A. Insertion sort

B. Radix sort

C. Polynomial manipulation

D. Binary search

3. Linked list is considered as an example of ___________ type of memory allocation.

A. Dynamic

B. Static

C. Compile time

D. Heap

4. In Linked List implementation, a node carries information regarding ___________

A. Data

B. Link

C. Data and Link

D. Node

5. Linked list data structure offers considerable saving in _____________

A. Computational Time

B. Space Utilization

C. Space Utilization and Computational Time

D. Speed Utilization

6. Which of the following points is/are not true about Linked List data structure when it is compared with an array?

A. Arrays have better cache locality which can make them better in terms of performance

B. It is easy to insert and delete elements on Linked List

C. Random access is not allowed in a typical implementation of Linked Lists

D. Access to elements in a linked list takes less time than compared arrays

7. What does the following function do for a given Linked List with the first node as the head?

void fun1(struct node* heaD. { if(head == NULL) return; fun1(head->next); printf("%d ", head->datA.; }

A. Prints all nodes of linked lists

B. Prints all nodes of the linked list in reverse order

C. Prints alternate nodes of Linked List

D. Prints alternate nodes in reverse order

8. Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?

A. Insertion Sort

B. Quick Sort

C. Heap Sort

D. Merge Sort

1. The following function reverse() is supposed to reverse a singly linked list. There is one line missing at the end of the function.

/* Link list node */ struct node { int data; struct node* next; }; /* head_ref is a double pointer which points to head (or start) pointer of linked list */ static void reverse(struct node** head_ref) { struct node* prev = NULL; struct node* current = *head_ref; struct node* next; while (current != NULL) { next = current->next; current->next = prev; prev = current; current = next; } /*ADD A STATEMENT HERE*/ }

What should be added in place of “/*ADD A STATEMENT HERE*/”, so that the function correctly reverses a linked list?

A. *head_ref = prev;

B. *head_ref = current;

C. *head_ref = next;

D. *head_ref = NULL;

2. What is the output of the following function for start pointing to the first node of the 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

3. The following C function takes a simply-linked list as an input argument. It modifies the list by moving the last element to the front of the list and returns the modified list. Some part of the code is left blank. Choose the correct alternative to replace the blank line.

typedef struct node { int value; struct node *next; }Node; Node *move_to_front(Node *heaD. { Node *p, *q; if ((head == NULL: || (head->next == NULL)) return head; q = NULL; p = head; while (p-> next !=NULL) { q = p; p = p->next; } _______________________________ return head; }

A. q = NULL; p->next = head; head = p;

B. q->next = NULL; head = p; p->next = head;

C. head = p; p->next = q; q->next = NULL;

D. q->next = NULL; p->next = head; head = p;

4. The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the list containing the integers 1, 2, 3, 4, 5, 6, and 7 in the given order. What will be the contents of the list after the function completes execution?

struct node { int value; struct node *next; }; void rearrange(struct node *list) { struct node *p, * q; int temp; if ((!list) || !list->next) return; p = list; q = list->next; while(q) { temp = p->value; p->value = q->value; q->value = temp; p = q->next; q = p?p->next:0; } }

A. 1, 2, 3, 4, 5, 6, 7

B. 2, 1, 4, 3, 6, 5, 7

C. 1, 3, 2, 5, 4, 7, 6

D. 2, 3, 4, 5, 6, 7, 1

5. 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

6. Given a pointer to a node X in a singly linked list. Only one pointer is given, and a pointer to the head node is not given, can we delete node X from the given linked list?

A. Possible if X is not the last node

B. Possible if the size of the linked list is even

C. Possible if the size of the linked list is odd

D. Possible if X is not the first node

7. You are given pointers to the first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list?

A. Delete the first element

B. Insert a new element as a first element

C. Delete the last element of the list

D. Add a new element at the end of the list

8. In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is?

A. log2 n

B. n⁄2

C. log_{2} n – 1

D. n

1. Which of the following is not a disadvantage to the usage of an 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

2. What is the time complexity of inserting at the end in dynamic arrays?

A. O(1)

B. O(n)

C. O(log_{n})

D. Either O(1) or O(n)

3. What is the time complexity to count the number of elements in the linked list?

A. O(1)

B. O(n)

C. O(logn)

D. O(n2)

6. What is the space complexity for deleting a linked list?

A. O(1)

B. O(n)

C. Either O(1) or O(n)

D. O(logn)

8. Which of these is not an application of a linked list?

A. To implement file systems

B. For separate chaining in hash-tables

C. To implement non-binary trees

D. Random Access to elements

1. 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 a singly linked list

3. What is a memory-efficient double-linked list?

A. Each node has only one pointer to traverse the list back and forth

B. The list has breakpoints for faster traversal

C. An auxiliary singly linked list acts as a helper list to traverse through the doubly linked list

D. A doubly linked list that uses a bitwise AND operator for storing addresses

5. How do you calculate the pointer difference in a memory-efficient double-linked list?

A. head or tail

B. pointer to previous node xor pointer to next node

C. pointer to previous node – pointer to next node

D. pointer to next node – pointer to the previous node

6. 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)

Consider the following doubly linked list: head-1-2-3-4-5-tail. What will be the list after performing the given sequence of operations?

Node temp = new Node(6,head,head.getNext()); Node temp1 = new Node(0,tail.getPrev(),tail); head.setNext(temp); temp.getNext().setPrev(temp); tail.setPrev(temp1); temp1.getPrev().setNext(temp1);

A. head-0-1-2-3-4-5-6-tail

B. head-1-2-3-4-5-6-tail

C. head-6-1-2-3-4-5-0-tail

D. head-0-1-2-3-4-5-tail

9. What is the functionality of the following piece of code?

public int function() { Node temp = tail.getPrev(); tail.setPrev(temp.getPrev()); temp.getPrev().setNext(tail); size--; return temp.getItem(); }

A. Return the element at the tail of the list but do not remove it

B. Return the element at the tail of the list and remove it from the list

C. Return the last but one element from the list but do not remove it

D. Return the last but one element at the tail of the list and remove it from the list

10. Consider the following doubly linked list: head-1-2-3-4-5-tail. What will be the list after performing the given sequence of operations?

Node temp = new Node(6,head,head.getNext()); head.setNext(temp); temp.getNext().setPrev(temp); Node temp1 = tail.getPrev(); tail.setPrev(temp1.getPrev()); temp1.getPrev().setNext(tail);

A. head-6-1-2-3-4-5-tail

B. head-6-1-2-3-4-tail

C. head-1-2-3-4-5-6-tail

D. head-1-2-3-4-5-tail

1. What differentiates a circular linked list from a normal linked list?

A. You cannot have the ‘next’ pointer point to null in a circular linked list

B. It is faster to traverse the circular linked list

C. You may or may not have the ‘next’ pointer point to null in a circular linked list

D. Head node is known in a circular linked list

3. What is the functionality of the following piece of code? Select the most appropriate.

public 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"); }

A. Print success if a particular element is not found

B. Print fails if a particular element is not found

C. Print success if a particular element is equal to 1

D. Print fail if the list is empty

4. What is the time complexity of searching for an element in a circular linked list?

A. O(n)

B. O(nlogn)

C. O(1)

D. O(n2)

5. Which of the following application makes use of a circular linked list?

A. Undo operation in a text editor

B. Recursive function calls

C. Allocating CPU to resources

D. Implement Hash Tables

9. Which of the following is false about a circular linked list?

A. Every node has a successor

B. Time complexity of inserting a new node at the head of the list is O(1)

C. Time complexity for deleting the last node is O(n)

D. We can traverse the whole circular linked list by starting from any point

10. Consider a small circular linked list. How to detect the presence of cycles in this list effectively?

A. Keep one node as head and traverse another temp node till the end to check if its ‘next points to head

B. Have fast and slow pointers with the fast pointer advancing two nodes at a time and the slow pointer advancing by one node at a time

C. Cannot determine, you have to pre-define if the list contains cycles

D. Circular linked list itself represents a cycle. So no new cycles cannot be generated

1. Which of the following real-world scenarios would you associate with a stack data structure?

A. piling up of chairs one above the other

B. people standing in a line to be serviced at a counter

C. offer services based on the priority of the customer

D. tatkal Ticket Booking in IRCTC

3. 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

5. What is the time complexity of pop() operation when the stack is implemented using an array?

A. O(1)

B. O(n)

C. O(logn)

D. O(nlogn)

6. Which of the following array position will be occupied by a new element being pushed for a stack of size N elements(capacity of stack > N)?

A. S[N-1]

B. S[N]

C. S[1]

D. S[0]

7. 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

8. 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 a specified size and provides a top pointer indicating TOS(top of stack), push, and pop have the 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 the array

B. duplicate the given array

C. parentheses matching

D. reverse the array

9. Array implementation of Stack is not dynamic, which of the following statements supports this argument?

A. space allocation for the array is fixed and cannot be changed during run-time

B. user unable to give the input for stack operations

C. a runtime exception halts execution

D. improper program compilation

10. Which of the following array element will return the top-of-the-stack-element for a stack of size N elements(capacity of stack > N)?

A. S[N-1]

B. S[N]

C. S[N-2]

D. S[N+1]

1. What is the best case time complexity of deleting a node in a Singly Linked list?

A. O(n)

B. O(n^{2})

C. O(nlogn)

D. O (1)

2. Which of the following statements are not correct with respect to the 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 in DLL

6. What does ‘stack overflow’ 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

8. 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(); pop(); push(5); top();

A. 20

B. 4

C. stack underflow

D. 5

9. Which of the following data structures can be used for parentheses matching?

A. n-ary tree

B. queue

C. priority queue

D. stack

10. Minimum number of queues to implement stack is ___________

A. 3

B. 4

C. 1

D. 2

1. Which of the following properties is associated with a queue?

A. First In Last Out

B. First In First Out

C. Last In First Out

D. Last In Last Out

2. 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–

3. What is the term for inserting into a full queue known as?

A. overflow

B. underflow

C. null pointer exception

D. program won’t be compiled

4. What is the time complexity of enqueue operation?

A. O(logn)

B. O(nlogn)

C. O(n)

D. O(1)

6. What is the need for a circular queue?

A. effective usage of memory

B. easier computations

C. to delete elements based on priority

D. implement the LIFO principle in queues

9. What is the space complexity of a linear queue having n elements?

A. O(n)

B. O(nlogn)

C. O(logn)

D. O(1)

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

A. Insertion

B. Deletion

C. To empty a queue

D. Both Insertion and To empty a queue

2. In linked list implementation of a queue, where does a new element be inserted?

A. At the head of the link list

B. At the center position in the link list

C. At the tail of the link list

D. At any position in the linked list

3. In linked list implementation of a queue, front and rear pointers are tracked. Which of these pointers will change during an insertion into a NONEMPTY queue?

A. Only front pointer

B. Only rear pointer

C. Both front and rear pointer

D. No pointer will be changed

4. In linked list implementation of a queue, front and rear pointers are tracked. Which of these pointers will change during an insertion into the EMPTY queue?

A. Only front pointer

B. Only rear pointer

C. Both front and rear pointer

D. No pointer will be changed

5. In case of insertion into a linked queue, a node borrowed from the __________ list is inserted in the queue.

A. AVAIL

B. FRONT

C. REAR

D. NULL

6. In linked list implementation of a queue, from where is the item deleted?

A. At the head of the link list

B. At the center position in the link list

C. At the tail of the link list

D. Node before the tail

7. In linked list implementation of a queue, the important condition for a queue to be empty is?

A. FRONT is null

B. REAR is null

C. LINK is empty

D. FRONT==REAR-1

8. The essential condition which is checked before insertion in a linked queue is?

A. Underflow

B. Overflow

C. Front value

D. Rear value

9. The essential condition which is checked before deletion in a linked queue is?

A. Underflow

B. Overflow

C. Front value

D. Rear value

10. Which of the following is true about linked list implementation of the queue?

A. In a push operation, if new nodes are inserted at the beginning of the linked list, then in a pop operation, nodes must be removed from the end

B. In a push operation, if new nodes are inserted at the beginning, then in a pop operation, nodes must be removed from the beginning

C. In a push operation, if new nodes are inserted at the end, then in a pop operation, nodes must be removed from the end

D. In a push operation, if new nodes are inserted at the end, then in a pop operation, nodes must be removed from the beginning

1. With what data structure can a priority queue be implemented?

A. Array

B. List

C. Heap

D. Tree

2. Which of the following is not an application of priority queue?

A. Huffman codes

B. Interrupt handling in the operating system

C. Undo operation in text editors

D. Bayesian spam filter

4. What is the time complexity to insert a node based on a key in a priority queue?

A. O(nlogn)

B. O(logn)

C. O(n)

D. O(n2)

6. What is not a disadvantage of priority scheduling in operating systems?

A. A low-priority process might have to wait indefinitely for the CPU

B. If the system crashes, the low-priority systems may be lost permanently

C. Interrupt handling

D. Indefinite blocking

7. Which of the following is not an advantage of a priority queue?

A. Easy to implement

B. Processes with different priorities can be efficiently handled

C. Applications with differing requirements

D. Easy to delete elements in any case

8. What is the time complexity to insert a node based on position in a priority queue?

A. O(nlogn)

B. O(logn)

C. O(n)

D. O(n2)

1. What is a dequeue?

A. A queue with an insert/delete defined for both front and rear ends of the queue

B. A queue implemented with a doubly linked list

C. A queue implemented with both singly and doubly linked lists

D. A queue with insert/delete defined for the front side of the queue

4. What are the applications of dequeue?

A. A-Steal job scheduling algorithm

B. Can be used as both stack and queue

C. To find the maximum of all sub-arrays of size k

D. To avoid collision in hash tables

1. A Double-ended queue supports operations such as adding and removing items from both sides of the queue. They support four operations like addFront(adding item to the top of the queue), addRear(adding item to the bottom of the queue), remove front(removing the item from the top of the queue), and removeRear(removing the item from the bottom of the queue). You are given only stacks to implement this data structure. You can implement only push and pop operations. What is the total number of stacks required for this operation? (you can reuse the stack)

A. 1

B. 2

C. 3

D. 4

2. 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 the 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

3. Consider you have an array of some random size. You need to perform a dequeue operation. You can perform it using stack operation (push and pop) or using queue operations themselves (enQueue and Dequeue). The output is guaranteed to be the 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

4. Consider you have a stack whose elements in it are as follows.

5 4 3 2 << top

Where the top element is 2.

You need to get the following stack

6 5 4 3 2 << top

The operations that needed to be performed are (You can perform only push and pop):

A. Push(pop()), push(6), push(pop())

B. Push(pop()), push(6)

C. Push(pop()), push(pop()), push(6)

D. Push(6)

5. A double-ended queue supports operations like adding and removing items from both sides of the queue. They support four operations like addFront(adding item to the top of the queue), addRear(adding item to the bottom of the queue), removeFront(removing item from the top of the queue), and removeRear(removing the item from the bottom of the queue). You are given only stacks to implement this data structure. You can implement only push and pop operations. What’s the time complexity of performing addFront and addRear? (Assume ‘m’ to be the size of the stack and ‘n’ to be the number of elements)

A. O(m) and O(n)

B. O(1) and O(n)

C. O(n) and O(1)

D. O(n) and O(m)

6. Why is the implementation of stack operations on queues not feasible for a large dataset (Assume 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

7. Consider yourself to be on a planet where the computational power of chips is slow. You have an array of sizes 10. You want to perform enqueue some elements into this array. But you can perform only push and pop operations. Push and pop operation both take 1 sec respectively. The total time required to perform enQueue operation is?

A. 20

B. 40

C. 42

D. 43

8. 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

9. 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

10. Given an array of size n, let’s assume an element is ‘touched’ if and only if some operation is performed on it(for example, for performing a pop operation the top element is ‘touched’). Now you need to perform a Dequeue operation. Each element in the array is touched at least?

A. Once

B. Twice

C. Thrice

D. Four times

1. To implement a stack using queue(with only enqueue and dequeue operations), how many queues will you need?

A. 1

B. 2

C. 3

D. 4