C++ Linked List

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

first node

In a circular linked list, the last node points to the Group of answer choices head pointer tail pointer first node None of these

head

In a linked list, the address of the first node in the list is stored in a separate location, called the ____ or first. Group of answer choices head pointer front top

two: one for the node under inspection and one for the previous node

In an insertion or deletion routine: how many pointers are you required to create for use during the traversal process? Group of answer choices two: one for the node under inspection and one for the previous node two: one for the node under inspection and one for the next node one: for the node being inserted or deleted three: one for the node under inspection, one for the next node, and one for the following node

copy

The ____________________ constructor executes when an object is declared and initialized using another object.

a node can be inserted or removed faster from a linked list than from a vector

The advantage a linked list has over a vector is that Group of answer choices a linked list can dynamically shrink or grow and a vector cannot a linked list is smaller than a vector a node can be inserted or removed faster from a linked list than from a vector data removal and insertion are more accurate with a linked list than with a vector None of these

True

To delete an entire list, normally you must traverse the list, deleting each node, one by one. Group of answer choices True/False

arranged in ascending order

To insert a new node in ascending order into a list, the list must be Group of answer choices arranged in descending order randomly ordered empty arranged in ascending order None of these

True

When working with a linked list one of the basic operations you can perform is to destroy the list. Group of answer choices True/False

False

When you build a linked list in the backward manner, a new node is always inserted at the end of the linked list. Group of answer choices True/False

True

When you delete a node from a list, you must ensure that the links in the list are not permanently broken. Group of answer choices True/False

the destructor function

A linked list class must take care of removing the dynamically allocated nodes and this is done by Group of answer choices the constructor function the destructor function overriding the removal function overloading the memory persistence operator None of these

False

A list that contains pointers to the previous node, the next node, and a node in the third dimension is known as a triple linked list. Group of answer choices True/False

doubly

A(n) ____________________ linked list is a linked list in which every node has a next pointer and a back pointer.

inserting

Appending a node means adding it to the end of a list, and ________ a node means putting a new node in the list, but not necessarily at the end. Group of answer choices concatenating popping clamping inserting None of these

class or struct

Because each node of a linked list has two components, we need to declare each node as a(n) ____. Group of answer choices reference and string int and object index and element class or struct

back; next

Every node in a doubly linked list has two pointers: ____ and ____. Group of answer choices top; bottom back; next current; forward previous; forward

there are no nodes in the list

If the head pointer points to nullptr, this indicates Group of answer choices the list has been previously created and then destroyed the list needs to be destroyed there are no nodes in the list the list is full and cannot accept any new nodes None of these

the previous node

A doubly linked list keeps track of the next node in the list as well as Group of answer choices itself the head node the tail node the previous node None of these

two: remove the node without breaking links, then delete it from memory

How many steps are involved in the process of deleting a node? Group of answer choices one: delete the node from memory two: remove the node without breaking links, then delete it from memory three: create a blank node, remove the node being deleted, insert the blank node four: create a blank node, insert the blank node before the node being deleted, remove the node being deleted, delete the blank node None of these

head

The ________ of a linked list points to the first node in the list. Group of answer choices starter head tail declaration None of these

nullptr

The link field of the last node of a linked list is ____. Group of answer choices nullptr 1 n-1 n

doubly linked list

The list container provided by the Standard Template Library is a template version of a Group of answer choices singly linked list doubly linked list circular linked list backward linked list None of these

False

We deallocate the memory for a linked list by calling the operator clear. Group of answer choices True/False

Traversal of a linked list

What is the purpose of the following code? current = head; while (current != nullptr) { //Process current current = current->link;} Group of answer choices Insertion of a node Selection of a node Traversal of a linked list Creation of a new list

first = nullptr; last = nullptr; count = 0;

Which of the following correctly initializes a doubly linked list in the default constructor? Group of answer choices head = nullptr; back = nullptr; head = 0; back = 0; count = 0; first = 0; last = 0; first = nullptr; last = nullptr; count = 0;

Make a copy of the linked list.

Which of the following is a basic operation on singly linked lists? Group of answer choices Retrieve the data of an arbitrary node. Swap the head and the last nodes. Determine whether the list is nearly full. Make a copy of the linked list.

circular linked

Which type of list does NOT contain a null pointer at the end of the list? Group of answer choices backwards linked doubly linked circular linked null linked None of these

it encounters a null pointer

While traversing a list, a node pointer knows when it has reached the end of the list if Group of answer choices it encounters the newline character it encounters a null pointer it finds itself back at the beginning of the list it encounters a sentinel such as 9999

sequential

data can be organized and processed sequentially using an array, called a(n) ____ list. Group of answer choices linked ordered sequential ascending

Stores 50 in the info field of the newNode

struct nodeType { int info; nodeType *link; }; nodeType *head, *p, *q, *newNode; newNode = new nodeType; Consider the accompanying code. What is the effect of the following statement? newNode->info = 50; Group of answer choices Stores 50 in the info field of the newNode Creates a new node Places the node at location 50 Cannot be determined from this code


Ensembles d'études connexes

Chapter 7 - Consumer Buying Behavior, Chapter 8 - Business Markets and Buying Behavior, Chapter 9 - Reaching Global Markets, Chapter 10 - Product Concepts, Chapter 6 - Target Markets: Segmentation, Evaluation, and Positioning

View Set

Chapter 1 Computer Security Principles and Practice (Stallings/Brown)

View Set

Google IT Support Professional Certificate: IT Security: Defense against the digital dark arts. Week 5

View Set

Health Policy Provisions, Clauses, and Riders

View Set

CDX Chapter 30 (meter usage and circuit diagnosis)

View Set