Question 1

Time: 00:00:00
Which of the following points is/are true about Linked List data structure when it is compared with array

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

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

It is easy to insert and delete elements in Linked List

It is easy to insert and delete elements in Linked List

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

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

The size of array has to be pre-decided, linked lists can change their size any time.

The size of array has to be pre-decided, linked lists can change their size any time.

All of the above

All of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 2

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

Insertion Sort

Insertion Sort

Quick Sort

Quick Sort

Heap Sort

Heap Sort

Merge Sort

Merge Sort

Time Sort

Time Sort

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 3

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

log 2 n

log 2 n

n/2

n/2

log 2 n – 1

log 2 n – 1

n

n

None of the Above

None of the Above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 4

Time: 00:00:00
Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among union, intersection, membership, cardinality will be the slowest?

membership, cardinality

membership, cardinality

intersection, membership

intersection, membership

union, intersection

union, intersection

union only

union only

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 5

Time: 00:00:00
Which one of the following is an application of Stack Data Structure?

Managing function calls

Managing function calls

The stock span problem

The stock span problem

Arithmetic expression evaluation

Arithmetic expression evaluation

All of the above

All of the above

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 6

Time: 00:00:00
Which of the following is true about linked list implementation of stack?

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

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

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

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

Both of the above

Both of the above

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 7

Time: 00:00:00
A single array A[1..MAXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables top1 and top2 (topl< top 2) point to the location of the topmost element in each of the stacks. If the space is to be used efficiently, the condition for “stack full” is ____

top1 + top2 = MAXSIZE

top1 + top2 = MAXSIZE

(top1= MAXSIZE/2) or (top2 = MAXSIZE)

(top1= MAXSIZE/2) or (top2 = MAXSIZE)

(top1 = MAXSIZE/2) and (top2 = MAXSIZE/2+1)

(top1 = MAXSIZE/2) and (top2 = MAXSIZE/2+1)

top1= top2 -1

top1= top2 -1

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 8

Time: 00:00:00
To evaluate an expression without any embedded function calls:

A Turing machine is needed in the general case

A Turing machine is needed in the general case

As many stacks as the height of the expression tree are needed

As many stacks as the height of the expression tree are needed

Two stacks are needed

Two stacks are needed

One stack is enough

One stack is enough

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 9

Time: 00:00:00
How many stacks are needed to implement a queue. Consider the situation where no other data structure like arrays, linked list is available to you.

1

1

2

2

3

3

4

4

5

5

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 10

Time: 00:00:00
Suppose 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?

To DEQUEUE an item, simply POP. To ENQUEUE an item, we can do following 3 operations 1) REVERSE 2) PUSH 3) REVERSE

To DEQUEUE an item, simply POP. To ENQUEUE an item, we can do following 3 operations 1) REVERSE 2) PUSH 3) REVERSE

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

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

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

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

A queue cannot be implemented using this stack.

A queue cannot be implemented using this stack.

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 11

Time: 00:00:00
Which of the following option is not correct?

If the queue is implemented with a linked list, keeping track of a front pointer, Only rear pointer s will change during an insertion into an non-empty queue.

If the queue is implemented with a linked list, keeping track of a front pointer, Only rear pointer s will change during an insertion into an non-empty queue.

Queue data structure can be used to implement least recently used (LRU) page fault algorithm and Quick short algorithm.

Queue data structure can be used to implement least recently used (LRU) page fault algorithm and Quick short algorithm.

Queue data structure can be used to implement Quick short algorithm but not least recently used (LRU) page fault algorithm.

Queue data structure can be used to implement Quick short algorithm but not least recently used (LRU) page fault algorithm.

Both (A) and (C)

Both (A) and (C)

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 12

Time: 00:00:00
A program P reads in 500 integers in the range [0..100] exepresenting the scores of 500 students. It then prints the frequency of each score above 50. What would be the best way for P to store the frequencies?

An array of 50 numbers

An array of 50 numbers

An array of 500 numbers

An array of 500 numbers

An array of 100 numbers

An array of 100 numbers

A dynamically allocated array of 550 numbers

A dynamically allocated array of 550 numbers

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 13

Time: 00:00:00
Which of the following operations is not O(1) for an array of sorted data. You may assume that array elements are distinct.

Find the ith smallest element

Find the ith smallest element

Delete an element

Delete an element

Find the ith largest element

Find the ith largest element

All of the above

All of the above

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 14

Time: 00:00:00
Consider an array consisting of –ve and +ve numbers. What would be the worst time comparisons an algorithm can take in order to segregate the numbers having same sign altogether i.e all +ve on one side and then all -ve on the other ?

N-1

N-1

N

N

N+1

N+1

(N*(N-1))/2

(N*(N-1))/2

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 15

Time: 00:00:00
The time complexity of computing the transitive closure of a binary relation on a set of n elements is known to be:

O(nLogn)

O(nLogn)

O(n ^ (3/2))

O(n ^ (3/2))

O(n^3)

O(n^3)

O(n)

O(n)

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 16

Time: 00:00:00
How many undirected graphs (not necessarily connected) can be constructed out of a given set V= {V 1, V 2,…V n} of n vertices ?

n(n-l)/2

n(n-l)/2

n!

n!

2^(n(n-1)/2)

2^(n(n-1)/2)

2^n

2^n

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 17

Time: 00:00:00
What is common in three different types of traversals (Inorder, Preorder and Postorder)?

Root is visited before right subtree

Root is visited before right subtree

Left subtree is always visited before right subtree

Left subtree is always visited before right subtree

Root is visited after left subtree

Root is visited after left subtree

All of the above

All of the above

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 18

Time: 00:00:00
The inorder and preorder traversal of a binary tree are d b e a f c g and a b d e c f g, respectively. The postorder traversal of the binary tree is:

d e b f g c a

d e b f g c a

e d b g f c a

e d b g f c a

e d b f g c a

e d b f g c a

d e f g b c a

d e f g b c a

f e d g a c b

f e d g a c b

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 19

Time: 00:00:00
Which traversal of tree resembles the breadth first search of the graph?

Level order

Level order

Postorder

Postorder

Inorder

Inorder

Preorder

Preorder

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 20

Time: 00:00:00
Choose the equivalent prefix form of the following expression (a + (b − c))* ((d − e)/(f + g − h))

* +a −bc − /de − +fgh

* +a −bc − /de − +fgh

* +a − bc /− de − +fgh

* +a − bc /− de − +fgh

* +a − bc /− ed + −fgh

* +a − bc /− ed + −fgh

* +ab − c /− ed + −fgh

* +ab − c /− ed + −fgh

* +ab − c /− ed - +fgh

* +ab − c /− ed - +fgh

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Get over 200+ Courses under One Subscription

mute

Don’t settle Learn from the Best with PrepInsta Prime Subscription

Learn from Top 1%

One Subscription, For Everything

The new cool way of learning and upskilling -

Limitless Learning

One Subscription access everything

Job Assistance

Get Access to PrepInsta Prime

Top Faculty

from FAANG/IITs/TOP MNC's

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.