Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Test  >  Question Bank for GATE Computer Science Engineering  >  Test: Arrays, Stack, Queues & Linked List- 3 - Computer Science Engineering (CSE) MCQ

Arrays, Stack, Queues & Linked List- 3 - Free MCQ Practice Test with solutions,


MCQ Practice Test & Solutions: Test: Arrays, Stack, Queues & Linked List- 3 (20 Questions)

You can prepare effectively for Computer Science Engineering (CSE) Question Bank for GATE Computer Science Engineering with this dedicated MCQ Practice Test (available with solutions) on the important topic of "Test: Arrays, Stack, Queues & Linked List- 3". These 20 questions have been designed by the experts with the latest curriculum of Computer Science Engineering (CSE) 2026, to help you master the concept.

Test Highlights:

  • - Format: Multiple Choice Questions (MCQ)
  • - Duration: 60 minutes
  • - Number of Questions: 20

Sign up on EduRev for free to attempt this test and track your preparation progress.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 1

A program P reads in 500 integers in the range (0,100) representing the scores of 500 students.If prints the frequency of each score above 50, what would be the best way for P to store the frequencies?

Detailed Solution: Question 1

There are 500 students the score range is 0 to 100. Print the frequency of those student whose score above 50. So frequency range contains score from 50 to 100, so an array of 50 numbers is suitable for representing the frequency.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 2

Let A be a square matrix of size nxn. Consider the following pseudocode. What is the expected output?

Detailed Solution: Question 2


Test: Arrays, Stack, Queues & Linked List- 3 - Question 3

The following sequence of operations is performed on a stack:
PUSH (10), PUSH (20), POP, PUSH (10), PUSH (20), POP, POP, POP, PUSH (20), POP 
The sequence of values popped out is:

Detailed Solution: Question 3


∴ The sequence of values popped out is 20, 20, 10, 10, 20.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 4

Which of the following permutations can be obtained in the output (in the same order) using a stack assuming that the input is the sequence 1,2, 3, 4, 5 in that order?

Detailed Solution: Question 4

- To evaluate which permutations can be obtained using a stack, we push the input sequence 1, 2, 3, 4, 5 onto the stack.
- We can only pop the top element of the stack. This means the output order is determined by the order of pops after appropriate pushes.
- For each permutation:
- Option 1 (3, 4, 5, 1, 2): Invalid as 1 and 2 cannot be popped after 3, 4, and 5.
- Option 2 (3, 4, 5, 2, 1): Valid as we can push and pop accordingly.
- Option 3 (1, 5, 2, 3, 4): Invalid as 5 cannot be popped after 1.
- Option 4 (5, 4, 3, 1, 2): Invalid as 1 and 2 cannot be popped after 5, 4, and 3.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 5

The postfix expression for the infix expression A + B * ( C + D ) / F + D * E is

Detailed Solution: Question 5

Option B is correct.

Handle the parenthesised subexpression first; it becomes CD+.

Apply multiplication of the preceding operand with that result to get BCD+*.

Divide that result by the next operand to obtain BCD+*F/.

Add the first operand to this intermediate result producing ABCD+*F/+.

Form the postfix for the other multiplication as DE*.

Finally, add the two postfix parts to obtain ABCD+*F/+DE*+, which matches Option B.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 6

Consider the following statements:
(i) First-in-first out types of computations are efficiently supported by STACKS.
(ii) Implementing LISTS on linked lists is more efficient than implementing LISTS on an array for almost all the basic LIST operations.
(iii) Implementing QUEUES on a circular array is more efficient than implementing QUEUES, on a linear array with twg indices.
(iv) Last-in-first-out type of computations are efficiency supported by QUEUES.

Detailed Solution: Question 6

Stack is UFO system so FIFO not supported by stack hence option statement 1 is incorrect and queue is using FIFO so statement 4 is also wrong.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 7

Which of the following is essential for converting an infix expression to the post fix form efficiently?

Detailed Solution: Question 7

Operands never change its position during expression conversion so only operator stack is needed.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 8

A priority queue Q is used to implement a stack that stores characters. PUSH (C) is implemented INSERT (Q, C, K) where K is an appropriate integer key chosen by the implementation. POP is implemented as DELETEMIN(Q). For a sequence of operations, the keys chosen are in

Detailed Solution: Question 8

In stack last element will be deleted first but according to question, it should be wprk like queue. So last element deleted at last, for that we give lower priority to last element. So all elements should be in strictly decreasing order.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 9

What value would the following function return for the input x - 95?
Function fun (x: integer): integer;
Begin
If x > 100 then fun = x - 10
Else fun := fun(fun (x + 11))
End;

Detailed Solution: Question 9


So the return value is 91.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 10

The best data structure to check whether an arithmetic expression has balanced parentheses is a

Detailed Solution: Question 10

The stack is a data structure in which each push (insert) or pop (delete) operation takes constant 0(1) time. The best data structure to check whether an arithmetic expression has a balanced parentheses.
Step 1: Start with empty stack of currently open parentheses.
Step 2: Process each char of an expression string.
Step 3: If it is open, push it on the stack.
Step 4: If it is closed, check it against the top of stack element.
Step4.1: If stack empty or not a matching parentheses then not balanced and return false.
Step 4.2: Otherwise it matches, pop the open parentheses then goto step 2.
Step 5: If stack is empty at the end, return true.
Step 6: If not empty then some parentheses is unmatched, return false.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 11

A circularly linked list is used to represent a Queue. A single variable p is used to access the Queue. To which node should p point such that both the operations enQueue and deQueue can be performed in constant time?

Detailed Solution: Question 11

Answer: A

Pointer p should point to the rear node. In a circular linked list the front node is the node rear->next, so both insertion at rear and deletion from front can be done using only p.

For enQueue (insert at rear), using only p (pointing to rear):

Create the new node: new.

new->next = p->next;

p->next = new;

p = new;

Each of these steps accesses or updates a fixed number of pointers, so enQueue is done in O(1) time.

For deQueue (delete from front), using only p (pointing to rear):

temp = p->next; (temp is the front node)

p->next = temp->next;

free(temp);

These steps also perform a fixed number of pointer operations, so deQueue is done in O(1) time.

Therefore, with p pointing to the rear node, both operations run in O(1). If p pointed to front, enQueue would require locating rear (an O(n) traversal), so that would not give constant-time insertion.

Hence, p must point to the rear node.



Test: Arrays, Stack, Queues & Linked List- 3 - Question 12

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

Detailed Solution: Question 12

According to conditions given:
⇒ [(a + (b x c)) - (d ^ (e ^ f))]
⇒ [(a + ( b c x)) - (d ^ (e f ^))]
⇒ [(abc x +) - (def^^)]
⇒ abc x + def^^ -

Test: Arrays, Stack, Queues & Linked List- 3 - Question 13

A program attempts to generate as many permutations as possible of the string, ‘abcd' by pushing the characters a, b, c, d in the same order onto a stack, but it may pop off the top character at any time. Which one of the following strings CANNOT be generated using this program?

Detailed Solution: Question 13

• For every element push an element and pop immediately i.e. push (a) then pop will give permutation abed.
• For all elements push (a), push (b), push (c) and push (d) then pop, pop, pop, pop will give us deba.
• Push (a), push (b), push (c) then pop, pop, pop will give is eba, then push (d) and pop will gives us deba.
• Option (d) is not possible because a cannot pop after c and before ‘b’.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 14

The following postfix expression with single digit operands in evaluated using a stack
8 2 3 ^ / 2 3* + 5 1 * -
Note that A is the exponentiation operator. The top two elements of the stack after the first* is evaluated are

Detailed Solution: Question 14

Given postfix expression is
8 2 3 ^ / 23 * + 5 1 * -

So the top two elements of the stack are 6, 1 after the first * is evaluated.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 15

Suppose a stack implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in addition to the PUSH and POP instructions. Which one of the following statements is TRUE with respect to this modified stack? .

Detailed Solution: Question 15

Consider an queue with elements inserted in same order as element present in queue.

Now to implement stack same as queue:


A queue can be implemented where ENQUEUE takes a sequence of three instructions and DEQUEUE takes a single instruction.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 16

The result evaluating the postfix expression 10 5 + 60 6/* 8 - is

Detailed Solution: Question 16

10 5 + 60 6 / * 8 -

Result is 142.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 17

In a circular linked list organization, insertion of a record involves modification of

Detailed Solution: Question 17


In above linked list a new record X wili be inserted in between B and C.

Two pointers are modified to insert X record.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 18

Linked lists are not suitable data structures of which one of the following problems?

Detailed Solution: Question 18

Using linked list binary search wili take O(n) time. So binary search is inefficient with linked list.

Test: Arrays, Stack, Queues & Linked List- 3 - Question 19

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

Detailed Solution: Question 19

Linear search number of comparisons: O(n).

Test: Arrays, Stack, Queues & Linked List- 3 - Question 20

Consider the function f defined below:


For a given linked list p, the function f returns 1 if and only if

Detailed Solution: Question 20

For a given linked list p, the function f returns 1 if and only if the eiements in the list are stored in non-decreasing (increasing) order of the data value.
f returns 1 if p == NULL or p Next == NULL or p → data < = p → next data, satisfies in linked list for every node p.

63 videos|8 docs|165 tests
Information about Test: Arrays, Stack, Queues & Linked List- 3 Page
In this test you can find the Exam questions for Test: Arrays, Stack, Queues & Linked List- 3 solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Arrays, Stack, Queues & Linked List- 3, EduRev gives you an ample number of Online tests for practice
Download as PDF