Nt1330 Unit 1 Question Paper

Words: 962
Pages: 4

1) Suppose you push the following numbers: 22, 24, 26, 28, 30, and 32 onto the stack, then you pop four items. List the numbers that are still in the stack.
Answer: The push and pop methods employ the Last-In, First-Out (LIFO) discipline or method for the removal of elements, according to the principles of this method 22 and 24 are the remaining numbers in the stack.
2) Suppose you add the numbers: 22, 24, 26, 28, 30, and 32 onto the queue, then remove four items. List the numbers that are still in the queue.
Answer: Queue containers practice the discipline First-In, First-Out (FIFO) so the removal four items would remove 22, 24, 26, and 28, leaving the remaining items 30 and 32.

3) Examine the following statement and explain which of the following is true:
a. The top of a stack is equivalent to the front of a queue.
b. In both the stack and the queue, items removed in sequence are the ones from increasingly high index cells in the array.
Answer: Statement ‘A’ is true when compare the characteristics of the front of a queue and the top of a stack. As the front of a queue and the top of a stack represent the free space within the appropriate data structure or object. Moving through the index as new items are added, until the index reaches capacity. Additionally, the front and
…show more content…
Answer: Events in life are stored in the brain in both forms stack and queue, as sometimes easier to remember the latest or most current event first, referring to LIFO method of stack. (Jenkins, 1998) Personally a big sports fan and easier to remember the games from the previous night, and recall the earlier games of a player’s career in reverse order. Queue method of FIFO, reciting material from coursework as the basics of the particular subject is discussed first, so it easier to recall the basic first and build upon the particular subject. (Jenkins,