CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.




Get it now !!
Send your Resume to 6000 Companies

Search Interview Questions

Question: What is difference between stack and queue?

Answer: In high level programming, a stack is defined as a list or sequence of elements that is lengthned by placing new elements "on top" of existing elements and shortened by removing elements from the top of existing elements. It is an ADT with math operations of "push" and "pop". A queue is a sequence of elements that is added to by placing the new element at the rear of existing and shortened by removing elements in front of queue. It is an ADT. There is more to these terms understood in programming of Java, C++, Python and so on.



Category Database Interview Questions & Answers - Exam Mode / Learning Mode
Rating (0.6) By 657 users
Added on 8/3/2013
Views 5015
Rate it!
Question: What is difference between stack and queue?
Answer:

In high level programming, a stack is defined as a list or sequence of elements that is lengthned by placing new elements "on top" of existing elements and shortened by removing elements from the top of existing elements. It is an ADT with math operations of "push" and "pop". A queue is a sequence of elements that is added to by placing the new element at the rear of existing and shortened by removing elements in front of queue. It is an ADT. There is more to these terms understood in programming of Java, C++, Python and so on. Source: CoolInterview.com

Answered by: shing le | Date: 8/12/2008 | Contact shing le Contact shing le

Stack is last in first out(LIFO). that is which is entered last will be retrieved firstly. example of stack is arranging plates in one above one.
Queue is first in first out(FIFO). That is which is entered first will be served first. Example is ordinary queue in provisional store. Source: CoolInterview.com

Answered by: chithralekha | Date: 11/18/2008 | Contact chithralekha Contact chithralekha

Stack is a linear data structure which follows the LIFO "Last In, First Out" method
Stack is a linear data structure which follows the FIFO "First In, First Out" method
Insertions and deletions are possible through one end called ?TOP? in a stack.
Insertions are at the rear end and deletions are from the Front end in a queue
Eg( Queue): Processes waiting for an I/O devices like printer or disk can be arranged in a order for their arrival using a Queue. Stacks are in fact used on every Processor. Each processor has a stack where data and addresses are pushed or added to the stack
In a real time queue are used to control the landing and take off of aircrafts at airports. The popular ?Rat in a maze? problem is also solved using stacks.

Source: CoolInterview.com

Answered by: Harish Kumar | Date: 7/6/2009 | Contact Harish Kumar Contact Harish Kumar

Stack-: this can be define as an abstract data type the inserting and deleting follow the principle of (LIFO) and the operation on it is pop and push
while
Queue follow the principle of (FIFO) Source: CoolInterview.com

Answered by: jimoh | Date: 7/9/2009 | Contact jimoh Contact jimoh

I tell simple answer stack mean LIFO which is the element or data comes last this data will be top of stack.the top of element is removing.queues is add element in rear side and element removing frond side(FIFO)(EX:CINMA TICKET COUNTER) Source: CoolInterview.com

Answered by: kannan | Date: 11/13/2009 | Contact kannan Contact kannan

stack .it is define as a data type inserting follow the operation Lifo(last in first out)ex-books in liberary
queue. it is defins as a data type inserting and deleting operation follow on fifo(first in first out)ex.queue for ticket. Source: CoolInterview.com

Answered by: sunil | Date: 4/7/2010 | Contact sunil Contact sunil

Stack is based on (LIFO) operation , eg. in parties the the sequential order of plates.Last plate will remove at first.
Queue is based on (FIFO)operation,
eg. on railway reservation counter the first person will serve first according to there sequential line number. Source: CoolInterview.com

Answered by: Vipin | Date: 5/11/2010 | Contact Vipin Contact Vipin

Stack is a linear data structure which follows the LIFO "Last In, First Out" method
Stack is a linear data structure which follows the FIFO "First In, First Out" method
Insertions and deletions are possible through one end called ?TOP? in a stack.
Insertions are at the rear end and deletions are from the Front end in a queue
Eg( Queue): Processes waiting for an I/O devices like printer or disk can be arranged in a order for their arrival using a Queue. Stacks are in fact used on every Processor. Each processor has a stack where data and addresses are pushed or added to the stack
In a real time queue are used to control the landing and take off of aircrafts at airports. The popular ?Rat in a maze? problem is also solved using stacks.



Source: CoolInterview.com

Answered by: pallavi gupta | Date: 6/4/2010 | Contact pallavi gupta Contact pallavi gupta

stack .it is define as a data type inserting follow the operation Lifo(last in first out)ex-books in liberary
queue. it is defins as a data type inserting and deleting operation follow on fifo(first in first out)ex.queue for ticket. Source: CoolInterview.com

Answered by: kumar | Date: 6/28/2010 | Contact kumar Contact kumar

stack- in stack ,list of element is inserted or deleted by push and pop.

queue- in queue ,list of element is inserted or deleted by front and rear.ex-(bus) Source: CoolInterview.com

Answered by: TANU BAJAJ | Date: 7/8/2010 | Contact TANU BAJAJ Contact TANU BAJAJ

ang pinag ka iba nila ung spelling !! haixt common answer!!
BUTATA!! Source: CoolInterview.com

Answered by: butata | Date: 8/8/2010 | Contact butata Contact butata


If you have the better answer, then send it to us. We will display your answer after the approval

Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.

Post your answer here

Inform me about updated answers to this question.
Related Questions
View Answer
What is the difference between oracle and sql?
View Answer
Can you take Image Backups using RMAN?

20. Can you use Back upsets created by RMAN with any other utility?
View Answer
How grid work. is it possible grid in 9i. how ?
View Answer
Why we use g with 10g .
View Answer
I have active redo log is it possible increase size and how?
View Answer
What is undo /rollback segment how you resize this ?
View Answer
What is steps of cloning?
View Answer
Any inbuilt utility of oracle available which make database mirroring ?
View Answer
What is lock and latch?
View Answer
My transaction take 30 min i want if my transaction data written in table after each 5 min . If transaction commit or rollback then do according work . this is done through pl/sql how?
View Answer
I want to write data from table to flat file this is possible through pl/sql how ?
View Answer
If i have unique key this is possible to create another unique key on table .
View Answer
If i have primary key this is possible to create another primary key on table.
View Answer
What is primary & unique key which type index oracle create when we make those key ?
View Answer
What is view is it possible to create index on view on view & how ?
View Answer
What is row changing how u eliminate ?
View Answer
How we determine index require rebuilding ?
View Answer
How we determine index require rebuilding ?
View Answer
Your query return 80 % data from table is it we use index or not why ?
View Answer
How you can determine query use full table scan?
View Answer

Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

View All Database Interview Questions & Answers - Exam Mode / Learning Mode




India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.046875 Seconds