Basic CS [3i Infotech Placement]: Sample Questions 208 - 209 of 243

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 208

Write in Short Short Answer▾

Where are the auto variable stored? What are register variabes?

Edit

Explanation

  • Auto variable are stored in memory and their default value is a garbage value. Compare them with register variables below.

Register Variables

  • Register variables are meant to be stored in processor registers.
  • It may or get the place in a register depending upon whether there are sufficient registers available. Microprocessors have 14 to 16 registers and might already be occupied.
  • Registers are 16 bit so these statements should be avoided: register float i , register double j. The compiler wont show any error and will take them as auto.

Question 209

Describe in Detail Essay▾

How does a stack differ from a queue?

Edit

Explanation

Difference between Stack and Queue
StackQueue
  • Object are inserted and removed at the same end.
  • Object are inserted and removed from different ends.
  • Only one pointer is used.
  • Two different pointers are used for front and rear ends.
  • Follow Last in First Out order.
  • Following First in First Out order.
  • Operations are called push and pop.
  • Operations are called enqueue and dequeue.
  • Visualized as vertical collections.
  • Visualized as horizontal collections.
  • Does not have variants.
  • Variants like circular queue, priority queue, doubly ended queue.
  • Implementation is simple
  • Implementation is complex
  • The element inserted first is removed last.
  • The element inserted first is removed first.