click below
click below
Normal Size Small Size show me how
DSA F2
DATA STRUCUTRES AND ALGORITHMS FORMATIVE ASSESSMENT 2
| Question | Answer |
|---|---|
| During a POP operation in a STATIC STACK, the elements are being moved one step up. True False | False |
| What happens to the value of the TOP during a PUSH operation in a STATIC STACK? increments by 1 decrements by 1 becomes -1 becomes 0 | increments by 1 |
| The manner in which a stack behaves? FILO FIFO LILO LIFO | LIFO |
| Dynamic Stacks can be implemented using linked list. True False | True |
| The following are 3 possible containers that can be used in implementing the STL Stack, except: vector deque array list | array |
| In a static stack, the variable stackSize will handle the total capacity of the stack. True False | True |
| Using pop function automatically moves the top pointer to the next node without deleting the memory used. True False | False |
| Below is a valid declaration of a dynamic stack implemented as a vector: stack< int > iStack True False | False |
| Invoking the STL function top will automatically retrieve the element and move the pointer. True False | False |
| Below is a valid declaration of a dynamic stack implemented as a list: stack< int, list<int> > iStack; True False | True |
| Given: Enqueue(1) Enqueue(2) Enqueue(3) The value stored in front of the queue is 3. True False | False |
| In a multi-user system, a queue is used to hold print jobs submitted by users , while the printer services those jobs one at a time. True False | True |
| C++ has an existing queue container. True False | True |
| As each item is dequeued, the node pointed to by the front pointer is deleted, and front is made to point to the next node in the list. True False | True |
| Front is a function in deque STL that returns a reference to the first element of the deque. True False | True |
| The queue version of push always inserts an element at the front of the queue. True False | False |
| By default, the queue container uses list as its base. True False | False |
| A deque (pronounced "deck" or "deek") is a double-ended queue. True False | True |
| Below are characteristics of a dynamic stack, except: Can be implemented with a linked list Shrink in size as needed Grow in size as needed Can be implemented with a dynamic array | Shrink in size as needed |
| In a DYNAMIC STACK the pointer TOP stays at the HEAD after a PUSH operation. True False | True |
| In a dynamic stack, the pointer TOP is like the HEAD which always point to the first element of the linked list. True False | True |
| In a DYNAMIC STACK, the node that was POPPED is deleted. True False | True |
| A stack container that is used to adapt to different containers, it is often referred to as a container adapter. True False | True |
| Pop function will always retrieve the top. True False | False |
| The STL empty function will yield a value of true if the stack has elements. True False | False |
| The STL function push retrieves an element at the top of the stack. True False | False |
| TRUE/FALSE: The elements in a queue are processed like customers standing in a grocery check-out line: the first customer in line is the first one served. False True | True |
| The two primary queue operations are push and pop. True False | False |
| In a static queue the pointer front moves every time you dequeue. True False | True |
| In a dynamic stack, pointer TOP points to a fixed value in the linked list and does not move. True False | False |
| The STL stack container may be implemented as a vector, a list, or a deque. True False | True |
| A queue, however, provides access to its elements in first-in, first-out (FIFO) order. True False | True |
| Given: Enqueue(1) Enqueue(2) Enqueue(3) Dequeue() The value stored in front of the queue is 1. True False | False |
| A dynamic queue starts as an empty linked list. True False | True |
| op is a function in deque STL that removes the first element of the deque and discards it. True False | True |
| queue int x; Is a valid declaration of a queue container in C++. True False | False |
| Programs that use the deque ADT must include the deque header file. True False | True |
| A static stack is implemented using arrays. True False | True |
| The STL function top returns a reference to the element at the top of the stack. True False | True |
| TRUE/FALSE: The pointer FRONT moves every time a new value is enqueued. True False | False |
| Consider Program E: What variable holds the length of the string that should be accepted? n count input t | n |
| Consider Program E: What is the output of the following inputs: 5 1 BGGBG GBGBG GBGGB GBBGG BGGBG | G B G G B |
| A dynamic queue makes use of an array for implementation. True False | False |
| The queue ADT is like the the stack ADT: it is actually a container adapter. True False | True |
| Pop is a function in deque STL that removes the first element of the deque and discards it. True False | True |
| Which of the following is an application of a stack? CPU Scheduling Sending of Network Packets Calculator Printer Spooler | Calculator |
| A static queue does not need the isFull operation anymore. True False | False |
| Consider Program E: What is the output of the following inputs: 3 3 BGB None of the Options BGB GBB BBG | GBB |
| A deque is similar to an array, but allows efficient access to values at both the front and the rear. True False | True |
| The queue container adapter can be built upon vectors, lists, or deques. True False | True |
| What is the value of TOP when the STATIC STACK is FULL? <= to the stack size = to the (stack size-1) < to the stack < to the (stack size-1) | = to the (stack size-1) |
| The initial value of index top in the static implementation of a stack is 0. True False | True |
| Consider Program E: What are the valid characters being processed by the program? G, H A, B B, G B, C | B, G |
| Consider Program E: What is the output of the following inputs: 5 3 BBGBG GGBBB BBBGG BGBGB GBBGB | GGBBB |
| In a dynamic implementation of stack, the pointer TOP has an initial value of NULL. True False | True |
| TRUE/FALSE: To dequeue means to insert an element at the rear of a queue. False True | False |