Quiz


1.  

What is a stack-linked list?

a stack-linked list is a data structure that uses a linked list to create a stack.

2.  

How does a stack-linked list differ from a linked list?

a stack-linked list accesses data last in, first out; a linked list accesses data first in, first out.

3.  

What is the benefit of using a stack-linked list?

the benefit of using a stack-linked list is that the number of nodes on the stack can increase or decrease as needed while the program runs.

4.  

Where is the front of the stack in a stack-linked list?

the front of the stack in a stack-linked list is at the back of the linked list.

5.  

What is the maximum number of nodes that you can have on a stack-linked list?

there can be a nearly unlimited number of nodes on a stack-linked list, restricted only by the amount of available memory in the computer.

6.  

Can a node on a stack-linked list have more than one data element?

yes, a node on a stack-linked list can have more than one data element, which is also true of a node on a linked list.

7.  

Why does the StackLinkedList class inherit the LinkedList class?

the stacklinkedlist class inherits the linkedlist class because the stacklinkedlist class uses attributes and member functions of the linkedlist class.

8.  

Why is the constructor of the StackLinkedList class empty?

the constructor of the stacklinkedlist class is empty because the constructor of the linkedlist class is called when an instance of the stacklinkedlist class is declared. the constructor of the linkedlist class initializes the node and attributes that are later used by the stacklinkedlist class.

9.  

Why is the destructor of the StackLinkedList class empty?

the destructor of the stacklinkedlist class is empty because the destructor of the linkedlist class is called prior to the destructor of the stacklinkedlist class. this is because the linkedlist class is inherited by the stacklinkedlist class.

10.  

What happens when you push a new node onto a stack?

when you push a new node onto a stack, the new node is placed at the front of the linked list.

Answers

1.  

A stack-linked list is a data structure that uses a linked list to create a stack.

2.  

A stack-linked list accesses data last in, first out; a linked list accesses data first in, first out.

3.  

The benefit of using a stack-linked list is that the number of nodes on the stack can increase or decrease as needed while the program runs.

4.  

The front of the stack in a stack-linked list is at the back of the linked list.

5.  

There can be a nearly unlimited number of nodes on a stack-linked list, restricted only by the amount of available memory in the computer.

6.  

Yes, a node on a stack-linked list can have more than one data element, which is also true of a node on a linked list.

7.  

The StackLinkedList class inherits the LinkedList class because the StackLinkedList class uses attributes and member functions of the LinkedList class.

8.  

The constructor of the StackLinkedList class is empty because the constructor of the LinkedList class is called when an instance of the StackLinkedList class is declared. The constructor of the LinkedList class initializes the node and attributes that are later used by the StackLinkedList class.

9.  

The destructor of the StackLinkedList class is empty because the destructor of the LinkedList class is called prior to the destructor of the StackLinkedList class. This is because the LinkedList class is inherited by the StackLinkedList class.

10.  

When you push a new node onto a stack, the new node is placed at the front of the linked list.




Data Structures Demystified
Data Structures Demystified (Demystified)
ISBN: 0072253592
EAN: 2147483647
Year: 2006
Pages: 90

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net