CS244 - Data Structures Test 1 Questions
To delete a given item from an ordered linked list, there may be no need to search the list to see whether the item to be deleted is in the list. A) True B) False
A) True
From the binary search algorithm, it follows that every iteration of the while loop cuts the size of the search space by half. A) True B) False
A) True
Header/first and trailer/last nodes are considered part of a linked list. A) True B) False
A) True
If every recursive call will result in another recursive call, then the recursive function (algorithm) is said to have infinite recursion. A) True B) False
A) True
In a doubly linked list, every node contains the address of the next node (except the last node), and every node contains the address of the previous node (except the first node). A) True B) False
A) True
A doubly linked list is a linked list in which every node has a next pointer and a ____ pointer. A) back B) center C) null D) binary
A) back
A ____ case is the case for which the solution is obtained directly. A) base B) general C) direct D) recursive
A) base
Building a linked list backward places the item to be added at the ____ of the linked list. A) beginning B) end C) middle D) key point
A) beginning
A linked list in which the last node points to the first node is called a ____ linked list. A) circular B) recursive C) standard D) doubly
A) circular
We can traverse a singly linked list backward starting from the last node to the first node. A) True B) False
B) False
Because initially the list is empty, the pointer first must be initialized to ____. A) NULL B) EMPTY C) NIL D) NOP
A) NULL
A general solution to a recursive algorithm must eventually reduce to a base case. A) True B) False
A) True
A stack is called a LIFO data structure. A) True B) False
A) True
A function that calls itself is an iterative function. A) True B) False
B) False
The time-complexity of the copyStack function is O(1). A) True B) False
B) False
In ____, the data is stored within the hash table and no linked structure is used. A) closed addressing B) open addressing C) inverted addressing D) converted addressing
B) open addressing
The header node is placed at the ____ of a list. A) middle B) end C) beginning D) key location
C) beginning
A linked list is not a random access data structure such as a(n) ____. A) stack B) deque C) structure D) array
D) array
Recursion is a very powerful way to solve certain problems for which the solution would otherwise be more complicated to code. A) True B) False
A) True
Stacks can be used to print a list backwards without using recursion. A) True B) False
A) True
The address of the first node in a linked list is stored in a separate location/pointer, called the head. A) True B) False
A) True
The operation push removes the bottom element from the stack. A) True B) False
B) False
The recursive algorithm must have three or more base cases. A) True B) False
B) False
The recursive process to solving a problem starts with the base case. A) True B) False
B) False
The sequential search always starts at the last element in the list and continues until either the item is found in the list or the entire list is searched. A) True B) False
B) False
A queue is a ____ data structure. A) Last In First Out B) First In First Out C) First In Last Out D) there are no correct options
B) First In First Out
A linked list is a collection of ____. A) classes B) nodes C) addresses D) memory variables
B) nodes
The analysis of algorithms enables programmers to decide which algorithm to use for a specific application. A) True B) False
A) True
The call to the recursive function contains a statement that causes the same function to execute again before completing the current function call. A) True B) False
A) True
The link component of each node is a pointer. A) True B) False
A) True
The number of key comparisons in a sequential search depends on the value of the search item. A) True B) False
A) True
The operation top returns the top element of the stack without removing it. A) True B) False
A) True
The queue operation isFullQueue determines whether the queue is full. A) True B) False
A) True
To access the fifth element in a list, we must first traverse the first four elements. A) True B) False
A) True
To design a working recursive function, you must determine the limiting conditions. A) True B) False
A) True
When analyzing a search algorithm, we count the number of key comparisons because this number gives us the most useful information. A) True B) False
A) True
You cannot write a recursive algorithm to implement a sequential search algorithm. A) True B) False
A) True
The address of the first node in the list is stored in a separate location, called the ____. A) head B) tail C) key D) top
A) head
The queue operation ____ determines whether the queue is full. A) isFullQueue B) isNullQueue C) queueFront D) deleteQueue
A) isFullQueue
The operation ____ is used to remove the top element from the stack. A) pop B) push C) peek D) isEmpty
A) pop
The ____ operation is used to add an element onto the stack. A) push B) pop C) add D) insert
A) push
In a doubly linked list, every node contains the address of the next node except for the ____ node. A) middle B) last C) first D) second to last
B) last
Every call to a recursive function has its own code and its own set of ____ and local variables. A) headers B) parameters C) stack D) heap
B) parameters
An algorithm that finds the solution to a given problem by reducing the problem to smaller versions of itself is called a(n) ____. A) iterative algorithm B) recursive algorithm C) regressive algorithm D) successive algorithm
B) recursive algorithm
Given a pointer to a list, the function ____ prints the elements of the list in reverse order. A) reverse B) reversePrint C) invert D) translate
B) reversePrint
An array is a random access data structure; a stack is not. A) True B) False
A) True
An element can be removed from the stack only if there is something in the stack, and an element can be added to the stack only if there is room. A) True B) False
A) True
Because the size of the array to store elements is fixed, only a finite number of elements can be stored in a queue that is implemented using an array. A) True B) False
A) True
Every node in a linked list has two components: one to store the relevant information and one to store the address. A) True B) False
A) True
Every recursive call has its own copy of code of the recursive function. A) True B) False
A) True
When we check the array locations t, (t + 1) % HTSize, (t + 2) % HTSize, . . ., (t + j) % HTSize it is called the____ of the hash table. A) probe sequence B) probe value C) hash value D) kindred value
A) probe sequence
Prior to the addQueue operation, the queue must exist and must not be empty. A) True B) False
B) False
Recursive algorithms are implemented using while loops. A) True B) False
B) False
The algorithms to implement the operations search, insert, and remove are the same for sorted and unsorted list. A) True B) False
B) False
The best and worst cases are likely to occur most of the time that we apply the sequential search on a list. A) True B) False
B) False
The bottom element of the stack is the last element added to the stack. A) True B) False
B) False
The elements at the top of the stack have been in the stack the longest. A) True B) False
B) False
The execution of the recursive version of the program to calculate a Fibonacci number is as efficient as the execution of the non-recursive version. A) True B) False
B) False
The general case in a recursive function is the case for which the solution is obtained directly. A) True B) False
B) False
The general rule to process elements in a queue is that the customer at the end/rear of the queue is served next and that when a new customer arrives, he or she stands at the front of the queue. A) True B) False
B) False
The item added to the stack last will be the item removed last. A) True B) False
B) False
The operation pop returns the top element of the stack without removing it. A) True B) False
B) False
Because all the elements of a stack are of the same type, you can use a(n) ____ to implement a stack. A) struct B) array C) record D) class
B) array
Building a linked list forward places the item to be added at the ____ of the linked list. A) beginning B) end C) middle D) key point
B) end
The ____ operation checks whether the stack is empty. A) isFullStack B) isEmptyStack C) peek D) pop
B) isEmptyStack
A doubly linked list can be traversed in ____ direction. A) only the forward B) only the backward C) a circular D) either the forward or backward
D) either the forward or backward
The ____ operation checks whether the stack is full. A) isEmpty B) peek C) pop D) isFullStack
D) isFullStack
A binary search can be performed only on ____. A) unordered lists B) arrays C) comparable lists D) ordered lists
D) ordered lists
Whenever a system is modeled on the First In First Out principle, ____ are used. A) stacks B) trees C) arrays D) queues
D) queues
A(n) ____ definition is a definition in which something is defined in terms of a smaller version of itself. A) iterative B) general C) non-standard D) recursive
D) recursive
In an ordered linked list, the search algorithm is somewhat improved because the list is ____. A) larger B) smaller C) referenced D) sorted
D) sorted
Searching through a linked list or inserting an item in a linked list may require a ____ of the list. A) review B) deletion C) copying D) traversal
D) traversal
A doubly linked list is a linked list in which every node has a next pointer and a null pointer. A) True B) False
B) False
A linked list is a random access data structure such as an array. A) True B) False
B) False
A queue cannot be implemented using in an array. A) True B) False
B) False
A recursive solution is always a better alternative to an iterative solution. A) True B) False
B) False
Building a linked list backwards places the new item to be added at the end of the linked list. A) True B) False
B) False
Building a linked list forward places the new item to be added at the beginning of the linked list. A) True B) False
B) False
Each node of a singly linked list has at least four components. A) True B) False
B) False
In a linked list implementation of a stack, only a fixed number of elements can be pushed onto the stack. A) True B) False
B) False
In general, there are three types of linked lists and they are: sorted, unsorted and mixed. A) True B) False
B) False
Logically, you can think of a working recursive function as having an unlimited number of copies of itself and never stops. A) True B) False
B) False
Operations such as search, insert, and delete require a linked list to be sorted. A) True B) False
B) False
A sequence of number such as 1, 1, 2, 3, 5, 8, 13, 21, 34, ... is called a ____ sequence. A) Newtonian B) Gaussian C) Fibonacci D) Marconi
C) Fibonacci
____ lists have elements that are in no particular order. A) Search B) Structured C) Unsorted D) Randomized
C) Unsorted
Sequential and binary search algorithms are called ____ search algorithms. A) cumulative B) compartmentalized C) comparison-based D) key-based
C) comparison-based
Linear probing to avoid collision for a hash table may cause _____ problem. A) storage shortage B) complicated C) element clustering D) no options are correct
C) element clustering
In a linked list, we always want head to point to the ____ node. A) key B) main C) first D) last
C) first
A function that calls another function and eventually results in the original function call is said to be ____recursive. A) directly B) indeterminantly C) indirectly D) suspiciously
C) indirectly
The operation ____ reinitializes the stack to an empty state. A) alloc B) init C) initializeStack D) new
C) initializeStack
A(n) ____ is a list of items, called nodes, in which the next node is determined by the address, called the link, stored in each node. A) array B) structure C) linked list D) hash table
C) linked list
A ____ is a data structure in which elements of the same type are added at one end and removed at another end. A) hash table B) tree C) queue D) network
C) queue
The process of solving a problem by reducing it to smaller versions of itself is called ____. A) iteration B) succession C) recursion D) repulsion
C) recursion
The function ____ makes an identical copy of a stack. a. readStack b. buildStack c. clearStack d. copyStack
d. copyStack