CS 133 Quiz 5

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

When memory allocated with malloc is no longer needed, return that memory to the system immediately with __________.

free

New nodes can be added to a stack and removed from the stack only at its top. For this reason a stack is referred to as a __________ data structure.

last-in, first-out

For a non-empty linked list, select the code that should appear in a function that adds a node to the end of the list. newPtr is a pointer to the new node to be added, and lastPtr is a pointer to the current last node. Each node contains a pointer nextPtr, a link to a node.

lastPtr->nextPtr = newPtr; lastPtr = newPtr;

A linked list is a __________ collection of self-referential structures, called nodes, connected by pointer links.

linear

A self-referential structure contains a ________ member that points to ________.

pointer, a structure of the same structure type

Which of the following is not true of queues?

Queues are used to support high-speed sorting algorithms.

Which of the following statements is true?

A structure's size is not necessarily the sum of the sizes of its members.

How many pointers are contained in a circular, doubly linked list with five nodes?

10

A stack is initially empty, then the following commands are performed.push 5push 7poppush 10push 5popWhich of the following is the correct stack (assume the top of the stack is on the left).

10 5

A queue receives the following commands (in pseudo-code):enqueue 4, 6, 8, 3, 1dequeue three elementsenqueue 3, 1, 5, 6dequeue two elementsWhat number is at the front of the queue?

3

set

BST

Which of these is not a common programming error?

Calling malloc in a statement without using sizeof.

__________ is not an advantage of linked lists when compared to arrays.

Direct access to any list element

Which of the following statements is false?

Function pop removes a node from the bottom of the stack.

Which statement is false?

Linked lists are normally stored contiguously in memory.

Which of the following is false?

Linked lists can become full.

Which of the following is false?

Linked lists cannot become full.

A(n) __________ pointer normally indicates the end of a data structure.

NULL

__________ are important in compilers and operating systems-insertions and deletions are made only at one end of a __________-its top.

Stacks, stack

The difference between an unordered_set and an unordered_map is that:

The unordered_set uses the value as the key while the unordered_map uses a key-value pair

An a map and an unordered_map allows insertions using both [] and the insert function, the difference being:

[] replaces an existing value at the given key

An unordered_set in the C++ STL is based on:

a hash table

A binary search tree is established when:

all the nodes in all the left subtrees are less than their parents and all the nodes in all the right subtree are greater than their parents.

Which of the following is a non-linear data structure?

binary tree

The individual storage places in the underlying array in a hash table are called:

buckets

In a hash table, the hash function:

calculates the index of an element

Passing a pointer to a pointer is called __________.

double indirection

Which of the following statements about stacks is incorrect?

stacks are first in, first-out (FIFO) data structures.

In a hash table a collision occurs when:

two elements are hashed to the same index


Ensembles d'études connexes

Abnormal Psychology- Chapter 11- Disorders of Sex and Gender

View Set

PSI Life, Accident, Health Practice Exam Questions

View Set

Anthropology Quiz 11, 12, 13 (Final Exam Review)

View Set

EL MAESTRO PART 2, EL MAESTRO PART 1

View Set