data structures important questions

data structures important questions

data structures important questions


Q 1. what is a data- structure?

ans. a data – structure is a logical way for organizing data in memory that considers not only the items stored but also the relationship among the items so as to give efficient and optimal performance . in other words , it is a organizing data such that it can be used efficiently.

Q 2. write the equivalent infix expression for : 10,3,*,7,1,-,*,23,+

ans.         10*3*(7-1)+23

Q 3. write the equivalent infix expression for given post-fix expression : a,b,AND,a,c,AND,OR.

ans.      a AND b OR a AND c.

Q 4. what is a stack?

ans. a stack is a linear list implemented in LIFO- Last In First Out manner where insertions and deletions are restricted to occur only at one end – stack’s top.

Q 5. enlist some applications of stacks.

ans. because of LIFO property of stacks, these are used in various applications like:
(i) reversal of a sequence,
(ii)infix to post-fix conversion,
(iii) post-fix and prefix expression evaluation,
and many more.

Q 6. what is a queue?

ans. a queue is a linear list implemented in FIFO – First In First Out manner where insertions take place at the rear- end and deletions are restricted to occur only at front end of the queue.

Q 7. enlist some applications of queues.

ans. applications of queues include the situations where FIFO property is exploited . some common applications of queues include:
(i)  sharing of one resource among multiple users or seekers such as shared printer among multiple computers; call center executive’s response among waiting callers etc.
(ii) airport authorities make use of queues in situation of sharing a single runway of airport for both landing and take – off of flights .
(iii) CPU uses queues to implement round-robin scheduling among waiting processes.
(iv) Queues are used in many computer algorithms also.

Q 8. which data structure will you use for simulating a blanket donation camp?

ans. a queues.

Q 9. given a stack as an array of 7 elements STACK :K,P,S,-,-,-,

(a) when will overflow and underflow occur?
(b) can K be deleted before S ? why?

ans. (a) overflow will occur when stack will be having 7 elements and there would be no space to insert a new element.
underflow will occur when all the elements will have been deleted from the stack and no more element could be deleted.
    (b) K can not be deleted before S. as S has been inserted after K and stack follows the LIFO rule i.e., Last In First Out , therefore S will be deleted before K.
data structures important questions



Q 12. consider an empty stack of integer.let the numbers 1,2,3,4,5,6 be pushed on to this stack only in the order they appeared from left to right. let S indicate a push and X indicates a pop operation.can they be outputted into the order 325641 and order 154623.
   (hint. SSSSSSXXXXXX outputs 654321)

ans. SSSXXSSXSXXX outputs 325641.
   154623 cannot be output as 2 is pushed much before 3 so can appear only after 3 in output.

Q 13 evaluate following arithmetic expedition. a which is in post-fix the contents of the stack during the execution of algorithm using the following.

data structures important questions

(data structures important questions, Based on latest cbse board exam pattern, by studying this you can score good. )

data structures notes