adplus-dvertising

Welcome to the Stacks and Queues MCQs Page

Dive deep into the fascinating world of Stacks and Queues with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Stacks and Queues, a crucial aspect of Data Structures and Algorithms. In this section, you will encounter a diverse range of MCQs that cover various aspects of Stacks and Queues, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Data Structures and Algorithms.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Stacks and Queues. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Data Structures and Algorithms.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Stacks and Queues. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Stacks and Queues MCQs | Page 20 of 25

Explore more Topics under Data Structures and Algorithms

Q191.
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();
Discuss
Answer: (d).5
Q192.
Which of the following data structures can be used for parentheses matching?
Discuss
Answer: (d).stack
Q193.
Minimum number of queues to implement stack is ___________

a.

3

b.

4

c.

1

d.

2

Discuss
Answer: (c).1
Q194.
Which of the following properties is associated with a queue?
Discuss
Answer: (b).First In First Out
Q195.
In a circular queue, how do you increment the rear end of the queue?
Discuss
Answer: (b).(rear+1) % CAPACITY
Q196.
What is the term for inserting into a full queue known as?
Discuss
Answer: (a).overflow
Q197.
What is the time complexity of enqueue operation?
Discuss
Answer: (d).O(1)
Q198.
What does the following piece of code do?
public Object function()
{
 if(isEmpty())
 return -999;
 else
 {
  Object high;
  high = q[front];
  return high;
 }
}
Discuss
Answer: (c).Return the front element
Discuss
Answer: (a).effective usage of memory
Q200.
Which of the following represents a dequeue operation? (count is the number of elements in the queue)
a)

public Object dequeue()
{
 if(count == 0)
 {
  System.out.println("Queue underflow");
  return 0;
 }
 else
 {
  Object ele = q[front];
  q[front] = null;
  front = (front+1)%CAPACITY;
  count--;
  return ele;
 }
}

b)

public Object dequeue()
{
 if(count == 0)
 {
  System.out.println("Queue underflow");
  return 0;
 }
 else
 {
  Object ele = q[front];
  front = (front+1)%CAPACITY;
  q[front] = null;
  count--;
  return ele;
 }
}

c)

public Object dequeue()
{
 if(count == 0)
 {
  System.out.println("Queue underflow");
  return 0;
 }
 else
 {
  front = (front+1)%CAPACITY;
  Object ele = q[front];
  q[front] = null;
  count--;
  return ele;
 }
}

d)

public Object dequeue()
{
 if(count == 0)
 {
  System.out.println("Queue underflow");
  return 0;
 }
 else
 {
  Object ele = q[front];
  q[front] = null;
  front = (front+1)%CAPACITY;
  return ele;
  count--;
 }
}

a.

a

b.

b

c.

c

d.

d

Discuss
Answer: (a).a

Suggested Topics

Are you eager to expand your knowledge beyond Data Structures and Algorithms? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!