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


Test Description

20 Questions MCQ Test Question Bank for GATE Computer Science Engineering | Test: Arrays, Stack, Queues & Linked List- 3

Test: Arrays, Stack, Queues & Linked List- 3 for Computer Science Engineering (CSE) 2022 is part of Question Bank for GATE Computer Science Engineering preparation. The Test: Arrays, Stack, Queues & Linked List- 3 questions and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus.The Test: Arrays, Stack, Queues & Linked List- 3 MCQs are made for Computer Science Engineering (CSE) 2022 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Arrays, Stack, Queues & Linked List- 3 below.
Solutions of Test: Arrays, Stack, Queues & Linked List- 3 questions in English are available as part of our Question Bank for GATE Computer Science Engineering for Computer Science Engineering (CSE) & Test: Arrays, Stack, Queues & Linked List- 3 solutions in Hindi for Question Bank for GATE Computer Science Engineering course. Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free. Attempt Test: Arrays, Stack, Queues & Linked List- 3 | 20 questions in 60 minutes | Mock test for Computer Science Engineering (CSE) preparation | Free important questions MCQ to study Question Bank for GATE Computer Science Engineering for Computer Science Engineering (CSE) Exam | Download free PDF with solutions
1 Crore+ students have signed up on EduRev. Have you?
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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - Question 4

PUSH one by one element into Stack and POP accordingly desired output. Only second option can satisfy.

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 for Test: Arrays, Stack, Queues & Linked List- 3 - Question 5

Infix: A + B*(C + D)/F + D*E
Postfix: ABCD + *F/ + DE*++

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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - Question 11


To add a new node:

new → next = Rear → next;
Rear → next = new;
Rear = new;

It will take constant time.
Similarly delete node from Front code will be:
Front = Rear → next;
Rear → next = Front → next;
Free (Front);
It will also take constant time.

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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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 for Test: Arrays, Stack, Queues & Linked List- 3 - 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.

Use Code STAYHOME200 and get INR 200 additional OFF
Use Coupon Code
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