click below
click below
Normal Size Small Size show me how
M2 - CCS0015
DATA STRUCTURES AND ALGORITHMS
| Question | Answer |
|---|---|
| [T/F] The algorithm for displaying the elements of a linked list would require traversal. | TRUE |
| [T/F] A circular linked list has 2 node pointers. | FALSE / |
| [T/F] list.unique(); unique removes any element that has the same value as the element | FALSE* |
| [T/F] list [int] myList; // is a valid declaration | FALSE |
| Which of the following is an application of a stack? Group of answer choices Printer Spooler Calculator CPU Scheduling Sending of Network Packets | CALCULATOR / |
| [T/F] During a POP operation in a STATIC STACK, the elements are being moved one step up. | FALSE; top position of the stack is adjusted to remove the element that was previously on top / |
| [T/F] In a DYNAMIC STACK, the node that was POPPED is deleted. | TRUE / |
| [T/F] Dynamic Stacks can be implemented using linked list. | TRUE |
| [T/F] In a static stack, the variable stackSize will handle the total capacity of the stack. | TRUE / |
| [T/F] In a dynamic stack, pointer TOP points to a fixed value in the linked list and does not move. | FALSE; point to most recently added node / |
| [T/F] The STL function top returns a reference to the element at the top of the stack. | TRUE / |
| [T/F] A stack container that is used to adapt to different containers, it is often referred to as a container adapter. | TRUE / |
| [T/F] The STL empty function will yield a value of true if the stack has elements. | FALSE; will yield false / |
| TRUE/FALSE: Each node in a linked list contains one or more members that represent data and a pointer which can point to another node. | TRUE / |
| TRUE/FALSE: Appending a node means adding a node at the start of the list. | FALSE; adding at the end |
| TRUE/FALSE: A linked list can grow or shrink in size as the program runs. | TRUE / |
| TRUE/FALSE: STL lists are also efficient at adding elements at their back because they have a built-in pointer to the last element in the list. | TRUE / |
| TRUE/FALSE: Use of template will make the ADT flexible in terms of accepting values of different data types. | TRUE / |
| Below are characteristics of a dynamic stack, except: | Can be implemented with a dynamic array |
| TRUE/FALSE: In a dynamic implementation of stack, the pointer TOP has an initial value of NULL. | TRUE / |
| The following are 3 possible containers that can be used in implementing the STL Stack, except: | ARRAY / |
| TRUE/FALSE: The STL stack container may be implemented as a vector, a list, or a deque. | TRUE / |
| TRUE/FALSE: The STL function push retrieves an element at the top of the stack. | FALSE; add an element instead of retrieving / |
| TRUE/FALSE: The delete operation only involves the removing of the node from the list without breaking the links created by the next pointers. | TRUE / |
| TRUE/FALSE: cout << list.front() << endl; front returns a reference to the last element of the list. | FALSE; outputs first |
| TRUE/FALSE: A doubly linked list has both a next and previous node pointers. | TRUE / |
| TRUE/FALSE: In a DYNAMIC STACK the pointer TOP stays at the HEAD after a PUSH operation. | FALSE; it gets updated to the newly added element / |
| TRUE/FALSE: In a dynamic stack, the pointer TOP is like the HEAD which always point to the first element of the linked list. | TRUE / |
| TRUE/FALSE: A static stack is implemented using arrays. | FALSE / |
| TRUE/FALSE: Invoking the STL function top will automatically retrieve the element and move the pointer. | FALSE; top does not modify the stack or move the pointer |
| TRUE/FALSE: Using pop function automatically moves the top pointer to the next node without deleting the memory used. | FALSE; purpose of pop is to remove top element from stack / |
| TRUE/FALSE: In inserting a node, finding its proper location and following a certain order is necessary. | TRUE / |
| TRUE/FALSE: A linked list is a series of connected nodes, where each node is a data structure. | TRUE / |
| TRUE/FALSE: cout << list.back() << endl; The back member function returns a reference to the last element in the list. | TRUE / |
| What happens to the value of the TOP during a PUSH operation in a STATIC STACK? | INCREMENTS BY 1 |
| TRUE/FALSE: The initial value of index top in the static implementation of a stack is 0. | FALSE / |
| This node is responsible to handle the data that will be added to the linked list. | newNode |
| What is the value of TOP when the STATIC STACK is FULL? | = to the (stack size-1)* |
| TRUE/FALSE: Below is a valid declaration of a dynamic stack implemented as a list: stack< int, list<int> > iStack; | TRUE / |
| TRUE/FALSE: The list container, found in the Standard Template Library, is a template version of a doubly linked list. | TRUE / |
| The manner in which a stack behaves? | LIFO / |
| The following are stack operations except: | CLEAR / |
| TRUE/FALSE: Pop function will always retrieve the top. | TRUE / |
| TRUE/FALSE: The STL list function push_back is equivalent to inserting a node in a list. | FALSE / |
| TRUE/FALSE: In addition to the data, each node contains a pointer, which can point to another node. | TRUE / |