AMCAT Stacks and Queues Questions-Computer Programming section 2018: AMCAT is one of the topmost employment tests. The level of the questions is also average.That makes it easy to score more in the test. The exam majorly comprises of 3 modules – Quantitative abilities, Reasoning abilities and English language. It also includes personality test. Computer programming section is one of the optional modules. This module also helps attracting more recruiters to the profile.
AMCAT Stacks and Queues Questions 2018
One of the important topics in AMCAT Computer Programming section is stacks and queues. Most of all 1-2 question comes every time. In addition, the difficulty level of the questions is moderate. It usually takes 45- 50 seconds to solve the questions. Below we will be discussing in detail about stacks and queues and its sample questions.
About Stacks and Queues
Queues and stacks is a rather, important concept of data structures and algorithms.
Stacks are dynamic data structures that follow the Last In First Out (LIFO) principle. The last item to be inserted into a stack is the first one to be deleted from it.
For example, you have a stack of trays on a table. The tray at the top of the stack is the first item to be moved if you require a tray from that stack.
Inserting and deleting elements
In data structures, stacks have restrictions on the insertion and deletion of elements. Elements can be inserted or deleted only from one end of the stack i.e. from the. The element at the top is called the element. The operations of inserting and deleting elements are called and respectively.
When the top element of a stack is deleted, if the stack remains non-empty, then the element just below the previous top element becomes the new top element of the stack.
As an example, in the stack of trays, if you take the tray on the top and do not replace it, then the second tray automatically becomes the top element (tray) of that stack.
Features of stacks
- Dynamic data structures
- Do not have a fixed size
- Do not consume a fixed amount of memory
- Size of stack changes with each and operation. Each and operation increases and decreases the size of the stack by , respectively.
Like Stack, Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). A good example of queue is any queue of consumers for a resource where the consumer that came first is served first.
The difference between stacks and queues is in removing. In a stack we remove the item the most recently added; in a queue, we remove the item the least recently added.
Operations on Queue:
Mainly the following four basic operations are performed on queue:
Enqueue: Adds an item to the queue. If the queue is full, then it is said to be an Overflow condition.
Dequeue: Removes an item from the queue. The items are popped in the same order in which they are pushed. If the queue is empty, then it is said to be an Underflow condition.
Front: Get the front item from queue.
Rear: Get the last item from queue.
Download AMCAT Stacks and Queues Questions 2018
Sample questions on AMCAT Stacks and Queues Questions:
These operations can be performed on which type of structure? Push, Pop, Peek
B. Priority Queue
D. Both 1 and 2
Answer: Option D
Explanation: Only stack has these queue has enqueue and dequeue
Which one of the following is an application of Queue Data Structure?
A. When a resource is shared among multiple consumers.
B. When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes
C. Load Balancing
D. All of the above
Answer: Option D
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.
Answer: Option B
A priority queue can efficiently implemented using which of the following data structures? Assume that the number of insert and peek (operation to see the current highest priority item) and extraction (remove the highest priority item) operations are almost same.
B. Linked List
C. Heap Data Structures like Binary Heap, Fibonacci Heap
D. None of the above
Answer: Option C
In a queue, the initial values of front pointer f rare pointer r should be …….. and ……….. respectively.
A. -1, -1
B. 0, -1
C. 0, 0
D. -1, 0
Answer: Option B
You can also practice sample questions on AMCAT iteration, recursion and decision.
Any questions and concern on AMCAT Stacks and Queues Questions then please ask in comment box.
More Articles AMCAT CSE Questions Paper:
- Data Types
- Iteration, Recursion, Decision
- Procedure, functions and scope
- Arrays, Linked Lists, Trees, Graphs (Data Structure)
- Stacks, Queues
- Hash Tables
- Heaps Questions
- Searching and Sorting
- Complexity Theory
Looking for AMCAT Discount? – check here AMCAT Discount Code