You are on page 1of 54

Stacks is also called a algorithm Queue.

-False

Enqueue means to insert an item into the back of the queue, dequeue means inserting the front item.

-FALSE

The acronym FIFO stands for First in First Out.

-True

The acronym LIFO stands for Long in First Out.

-False

Indexed array are arrays that with name keys.

-False

An invariant is a statement about program variables that is true every time the execution of the program
reaches the invariant.

-True

Array holds multiple values, whereas an ordinary value hold a single value.

-True

A recursive function calls itself, the memory for a called function is allocated on top of a memory
allocated to calling function and different copy of local variables is created for each function call.

-True

Lists is a way to group together related piece of information, so that they are easy to read and
understand.

-True
A loop invariant is a property of a program loop that is true before each iteration.

-True

Loop is also called variant and does not invariant.

-False

The recursion is the repeated application of a recursive procedure or definition.

-True

An iteration is a data structure, which can store a fixed size collection of elements of the same data type.

-False

Multidimensional arrays is not a type of array.

-False

In an entry controlled loop, a condition is checked before executing the body of a loop, it is called pre-
checking loop.

-True

An array is used to store a collection of data , but it is often more useful to think of an array as a
collection of variables of the same type.

-True

Iterative control statements are used when we want to repeat the execution of one or more statements
for specified number of times.

-True
A queue is a collection of entities that are maintained in a sequence and can be modified by the addition
of entities at one end of the sequence and removal from the other end of the sequence.

-True

A simple data type can store only one value at a time.

-True

Count controlled loops is a type of an iterations.

-True

Algo Final Quiz 1 (search sa midterm and prelim yung iba)

A hash function is any function that can be used to map data of arbitrary size to fixed-size values.

-True

Advantages of Hash Search,Hashing provides a more reliable and flexible method of data retrieval than
any other data structure. It is faster than searching arrays and lists. In the same space it can retrieve in
1.3probes anything stored in a tree that will otherwise take log n probes.

-False

Cryptographic hash functions add security features to typical hash functions, thereby making it difficult
to detect the contents of a message or information about recipients and senders.

-True

In DBMS,hashing is a technique to directly search the location of desired data on the disk without using
index structure.

-True

A graph function that returns a unique hash number is called a universal hash function.

-True

The hash table should be an array with length about 1.5times the maximum number of keys that will
actually be in the table, and. Size of hash table array should be a prime number
-False

BLAKE2 is a cryptographic hash function faster than MD5, SHA-1, SHA-2, and SHA-3, yet is at least as
secure as the latest standard SHA-3. BLAKE2 has been adopted by many projects due to its high speed,
security, and simplicity.

-True

The four most common are probably line graphs, bar graphs and histograms, pie charts, and Cartesian
graphs.

-True

A graph is undirected each edge is an unordered pair {u,v} of vertices, and we don't regard either of the
two vertices as having a distinct role from the other.

-True

Graphs are a powerful and versatile data structure that easily allow you to represent real life
relationships between different types of data.

-True

Path Matrix in graph theory is a matrix sized n*n , where n is the number of vertices of the graph.

-True

A hash table is a data structure that is used to store keys/value pairs.

-True

“One-way” means that it is practically possible to go the other way - to turn the hashed.

-False

The Shortest Path Faster Algorithm (SPFA) is an improvement of the Bellman–Ford algorithm which
computes single-source shortest paths in a weighted directed graph.
-True

Dijkstra doesn't work for Graphs with negative weight edges, Bellman-Ford works for such
graphs.Bellman-Ford is also simpler than Dijkstra and suites well for distributed systems.

-True

There is a simple tweak to get from DFS to an algorithm that will find the shortest paths on an
unweighted graph. Essentially, you replace the stack used by DFS with a queue.

-True

BFS doesn't use a priority queue (or array, should you consider using that) storing the distances, and.
BFS doesn't perform edge relaxations

-True

Dynamic programming is a method of solving complex problems by breaking them down into simpler
steps.

-True

Dijkstra was the one that discovered the algorithm for trees in the year of 1970.

-False

Dijkstra's algorithm can be used to determine the shortest path from one node in a graph to every other
node within the same graph data structure, provided that the nodes are reachable from the starting
node.

-True

Dijkstra's algorithm works correctly, because all edge weights are non-negative, and the vertex with the
least shortest-path estimate is always chosen.

-True

a directed acyclic graph (DAG) is a graphthat is directed and without cycles connecting the other edges
-True

A* is the most popular choice for pathfinding, because it's fairly flexible and can be used in a wide range
of contexts. A* is like Dijkstra's Algorithm in that it can be used to find a shortest path.

-True

BFS uses always queue, Dfs uses Stack data structure

-True

BFS doesn't use a priority queue (or array, should you consider using that) storing the distances, and.
BFS doesn't perform edge relaxations

-True

Johnson's algorithm works best with sparse graphs,This algorithm varies from the rest as it relies on two
other algorithms to determine the shortest path

-True

The Bellman-Ford algorithm is a graph search algorithm that finds the shortest path between a given
source vertex and all other vertices in the graph

-True

Dijkstra's algorithm can be used to determine the longest path from one node in a graph to every other
node within the same graph data structure, provided that the nodes are reachable from the starting
node.

-False

Greedy algorithm is efficient whereas Dynamic programming is more efficient.

-True

Dijkstra's algorithm is an algorithm creates a tree of shortest paths from the starting vertex, the source,
to all other points in the graph.
-True

In terms of implementation, BFS is usually implemented with Queue , while DFS uses a LOOP.

-False

The weighted longest path problem is the same as the Travelling salesman path problem, because the
longest path always includes all vertices.

-True

Dynamic programming is heavily used in computer networks, routing, graph problems, computer vision,
artificial intelligence, machine learning etc.

-True

Data Structure and Algorithm Midterm Exam 50-50

The Floyd-Warshall algorithm outputs the correct result as long as no negative cycles exist in the input
graph.

-True

The acronym FIFO stands for ?

-FIRST IN FIRST OUT

Greedy algorithm is efficient whereas Dynamic programming is more efficient.

-True

A hash function takes a group of characters (called a key) and maps it to a value of a certain length
(called a hash value or hash)

-True
The selection is a straightforward process of sorting values. In this method, to sort the data in ascending
order, the 0thelement is compared with all other elements. If the 0th element is found to be greater
than the compared element, the two values get interchanged.

-True

A RADIX is a specific tree based data structure in which all the nodes of tree are in a specific order.

-NO,it must be HEAP

A binary tree where the left child contains only nodes with values less than the parent node, and where
the right child only contains nodes with values greater than or equal to the parent.

-YES

In computer science, a problem is said to have optimal substructure if an optimal solution can be
constructed from optimal solutions of its subproblems.

-TRUE

Binary Search Tree, is a node-based binary tree data structure which has the following properties: The
left subtree of a node contains only nodes with keys lesser than the node's key. The right subtree of a
node contains only nodes with keys greater than the node's key.

-TRUE

A hash function that returns a unique hash number is called a _______hash function.

-UNIVERSAL

A _______ queue acts like a queue in that you dequeue an item by removing it from the front.

-PRIORITY

_______programming is a method of solving complex problems by breaking them down into simpler
steps.

-DYNAMIC
The recursion is the repeated application of a recursive procedure or definition.

-True

Bellman Ford algorithm is useful in finding shortest path from a given source vertex to all the other
vertices even if the graph contains a _______ weight edge.

-NEGATIVE

An MD5 hash function encodes a string of information and encodes it into a 128-bit fingerprint.

-True

______ is one of the most powerful and advanced data structures. It is a non-linear data structure
compared to arrays, linked lists, stack and queue. It represents the nodes connected by edges.

-TREE

Bubble Sort Algorithm is used to arrange N elements in ascending order, and for that, you have to begin
with 0th element and compare it with the first element. If the 0th element is found greater than the 1st
element, then the swapping operation will be performed, i.e., the two values will get interchanged. In
this way, all the elements of the array get compared.

-True

The Bellman-Ford algorithm is a graph search algorithm that finds the shortest path between a given
source vertex and all other vertices in the graph.

-True

A ________ is a data structure that has two types of elements, vertices and edges.

-GRAPH

_________Algorithm is used to arrange N elements in ascending order, and for that, you have to begin
with 0th element and compare it with the first element.

-BUBBLE SORT
A simple data type can store only one value at a time.

-True

The _______ algorithm is a graph search algorithm that finds the shortest path between a given source
vertex and all other vertices in the graph.

-BELLMAN-FORD

Sorting is the process of arranging objects in a certain sequence or order according to specific rules.

-TRUE

A queue is a collection of entities that are maintained in a sequence and can be modified by the
addition of entities at one end of the sequence and removal from the other end of the sequence.

-True

The ______ is a straightforward process of sorting values. In this method, to sort the data in ascending
order, the 0thelement is compared with all other elements.

-SELECTION SORT

The hash table should be an array with length about __times the maximum number of keys that will
actually be in the table, and. Size of hash table array should be a prime number.

Answer: 1.3

Count controlled loops is a type of an iterations.

-True

Iterative control statements are used when we want to repeat the execution of one or more statements
for specified number of times.

-True

A graph is a collection of points, called vertices, and line segments connecting those points, called
edges.
-True

_______ memory is used to store local variables and function call while heap memory is used to store
objects in Java.

-STACK

A graph consists of a set of nodes or vertices together with a set of edges or arcs where each edge joins
two ______.

-VERTICES

_________ algorithms work by recursively constructing a set of objects from the smallest possible
constituent parts.

-GREEDY

___________ is a linear data structure in which the operations are performed based on FIFO (First In
First Out) principle and the last position is connected back to the first position to make a circle.

-CIRCULAR QUEUE

The weighted longest path problem is the same as the Travelling salesman path problem, because the
longest path always includes all vertices.

-True

Heap is called a ___________.

-MAX HEAP

A binary _______ is a complete binary tree which satisfies the heap ordering property.

-HEAP

_____matrix in graph theory is a matrix sized n*n , where n is the number of vertices of the graph.

-PATH
Dijkstra's algorithm can be used to determine the shortest path from one node in a graph to every other
node within the same graph data structure, provided that the nodes are reachable from the starting
node.

-True

In C++, hashing is a technique to directly search the location of desired data on the disk without using
index structure.

-True

A ________ is a data structure that is used to store keys/value pairs.

-HASH TABLE

A priority dequeue acts like a queue in that you dequeue an item by removing it from the front.

-True

A ________ is a complete binary tree in which the value in each internal node is greater than or equal to
the values in the children of that node.

-MAX HEAP

Dijkstra's algorithm works correctly, because all edge weights are non-________, and the vertex with
the least shortest-path estimate is always chosen.

-NEGATIVE

Hashing provides a more reliable and_ method of data retrieval than any other data structure.

-FLEXIBLE

The four most common are probably line graphs, bar graphs and histograms, pie charts, and ?

-CARTESIAN
A graph is a collection of points, called vertices, and line segments connecting those points, called
_______.

-EDGES

A binary search tree (BST), also known as an ordered ________.

-BINARY TREE

Sorting is any process of arranging items systematically, and has two common, yet distinct meanings:
ordering: arranging items in a sequence ordered by some criterion; categorizing: grouping items with
similar properties.

-True

___________ is another sorting technique and has an algorithm that has a reasonably proficient space-
time complexity - O(n log n) and is quite trivial to apply.

-MERGE SORT

_________A sorting algorithm used for numbers.

-RADIX

A graph is a data structure that has two types of elements, vertices and angles.

-False

A max-heap is a complete binary tree in which the value in each internal node is greater than or equal to
the values in the children of that node.

-True

Sa agham pangkompyuter, ang grap ay isang uri ng datos na abstrakt na binubuo ng set ng mga node at
isang set ng mga edge o gilid na nagtatakda ng relasyon sa pagitan ng mga node. Ang grap na ADT ay
nagmumula sa konsepto ng grap sa matematika.Wikipedia

-True
A Priority Queue in Java does not have any restriction with regard to duplicate elements.

-True

Hash Table is a data structure which stores data in an associative manner.

-True

The following are other terms of Binary search tree. EXCEPT ONE.

-search loop

A sorting algorithm is said to be _________ if two objects with equal keys appear in the same order in
sorted output as they appear in the input unsorted array.

-STABLE

A max-heap is a complete binary tree in which the value in each internal node is greater than or equal to
the values in the children of that node.

-True

A binary tree is a finite set of nodes that is either empty or consist a root node and two disjoint binary
trees called the left subtree and the right subtree.

-TRUE

Breadth-____-search is the algorithm that will find shortest paths in an unweighted graph.

-FIRST

A ____________ is a tree in which every node other than the leaves has two children.

-FULL BINARY TREE

A Priority Queue in Java does not have any restriction with regard to duplicate elements.

-True
A _____________is a binary tree in which every level, except possibly the last, is completely filled, and
all nodes are as far left as possible.

-COMPLETE BINARY TREE

A pseudo _____-graph is a general-graph allowing edges to connect a vertex to itself.

-GENERAL

The maximum value in a Binary Search Tree can be found by ?

-START AT THE ROOT NODE

_____________ have less memory consumption as compared to linear queue because while doing
insertion after deletion operation it allocate an extra space the first remaining vacant but in circular
queue the first is used as it comes immediate after the last.

-CIRCULAR QUEUE

How many leaves are there in a full binary tree?

-CONTAINS 2N-1

A Binary Tree is labeled if every node is assigned a label and a Binary Tree is __________ if nodes are not
assigned any label.

-UNLABELED

_________ is a linear data structure which follows a particular order in which the operations are
performed.

-STACK

Merge sort is more efficient and works faster than quick sort in case of larger array size or datasets.
-TRUE

The ________ sort is a combination of searching and sorting.

-SELECTION

QuickSort is an___________ algorithm because we do swapping of elements according to pivot's


position (without considering their original positions).

-UNSTABLE

In _________sorting data is stored outside memory (like on disk) and only loaded into memory in small
chunks.

-EXTERNAL

AVL tree is also a BST but it can rebalance itself.

-TRUE

__________ is a common operation in many applications, and efficient algorithms to perform it have
been developed.

-SORTING

The _________ is slightly faster than the heap sort for larger sets, but it requires twice the memory of
the heap sort because of the second array.

-MERGE SORT

A ____________is an example of a linear data structure, or more abstractly a sequential collection.

-QUEUE

DEQUEUE IS ALSO CALLED ?

-DOUBLY ENDED QUEUE


A binary tree is considered full if every node has exactly 0 or 2 children. A binary tree is considered
incomplete if every level is full except the last, and all nodes are pushed as far left as possible.

-NO

The following are synonym of QUEUE.EXCEPT ONE.

-massive

A ___________ is a tree with some extra leaf nodes at depth n+1, all toward the left.

-Perfect Binary Tree

In a _____ skewed, most of the nodes have the leftchild without corresponding right child.

-LEFT

Bubble Sort is based on the idea of repeatedly comparing pairs of ________ELEMENTS swapping their
positions if they exist in the wrong order.

-ADJACENT

A ___________ queue is typically implemented using Heap data structure.

-PRIORITY

This transformation consists of replacing every null subtree of the original tree with “special nodes.” The
nodes from the original tree are then internal nodes , while the “special nodes” are external nodes

-EXTENDED BINARY TREE

A General tree can't be empty but a Binary tree can be empty.

-YES

_________sorting means sorting without any extra space requirement.

-IN PLACE
A binary tree is either empty or consists of a node called the root together with two binary trees called
the left subtree and the right subtree.

-TRUE

Which is the slowest sorting algorithm?

-Heap sort

Means to insert an item into the back of the queue.

-ENQUEUE

This is the Best Sorting Algorithm That the time complexity of Quicksort is O(n log n) in the best case,
O(n log n) in the average case, and O(n^2) in the worst case.

-QUICKSORT

A ___________ is a specific tree based data structure in which all the nodes of tree are in a specific
order.

-HEAP

________is any process of arranging items systematically, and has two common, yet distinct meanings:
ordering: arranging items in a sequence ordered by some criterion; categorizing: grouping items with
similar properties.

-SORTING

The Floyd-Warshall algorithm outputs the correct result as long as no negative cycles exist in the input
graph.

-True

The acronym FIFO stands for ?

-FIRST IN FIRST OUT

Greedy algorithm is efficient whereas Dynamic programming is more efficient.

-True
A hash function takes a group of characters (called a key) and maps it to a value of a certain length
(called a hash value or hash)

-True

The selection is a straightforward process of sorting values. In this method, to sort the data in ascending
order, the 0thelement is compared with all other elements. If the 0th element is found to be greater
than the compared element, the two values get interchanged.

-True

A RADIX is a specific tree based data structure in which all the nodes of tree are in a specific order.

-NO,it must be HEAP

A binary tree where the left child contains only nodes with values less than the parent node, and where
the right child only contains nodes with values greater than or equal to the parent.

-YES

In computer science, a problem is said to have optimal substructure if an optimal solution can be
constructed from optimal solutions of its subproblems.

-TRUE

Binary Search Tree, is a node-based binary tree data structure which has the following properties: The
left subtree of a node contains only nodes with keys lesser than the node's key. The right subtree of a
node contains only nodes with keys greater than the node's key.

-TRUE

A hash function that returns a unique hash number is called a _______hash function.

-UNIVERSAL

A _______ queue acts like a queue in that you dequeue an item by removing it from the front.

-PRIORITY
_______programming is a method of solving complex problems by breaking them down into simpler
steps.

-DYNAMIC

The recursion is the repeated application of a recursive procedure or definition.

-True

Bellman Ford algorithm is useful in finding shortest path from a given source vertex to all the other
vertices even if the graph contains a _______ weight edge.

-NEGATIVE

An MD5 hash function encodes a string of information and encodes it into a 128-bit fingerprint.

-True

______ is one of the most powerful and advanced data structures. It is a non-linear data structure
compared to arrays, linked lists, stack and queue. It represents the nodes connected by edges.

-TREE

Bubble Sort Algorithm is used to arrange N elements in ascending order, and for that, you have to begin
with 0th element and compare it with the first element. If the 0th element is found greater than the 1st
element, then the swapping operation will be performed, i.e., the two values will get interchanged. In
this way, all the elements of the array get compared.

-True

The Bellman-Ford algorithm is a graph search algorithm that finds the shortest path between a given
source vertex and all other vertices in the graph.

-True

A ________ is a data structure that has two types of elements, vertices and edges.

-GRAPH
_________Algorithm is used to arrange N elements in ascending order, and for that, you have to begin
with 0th element and compare it with the first element.

-BUBBLE SORT

A simple data type can store only one value at a time.

-True

The _______ algorithm is a graph search algorithm that finds the shortest path between a given source
vertex and all other vertices in the graph.

-BELLMAN-FORD

Sorting is the process of arranging objects in a certain sequence or order according to specific rules.

-TRUE

A queue is a collection of entities that are maintained in a sequence and can be modified by the
addition of entities at one end of the sequence and removal from the other end of the sequence.

-True

The ______ is a straightforward process of sorting values. In this method, to sort the data in ascending
order, the 0thelement is compared with all other elements.

-SELECTION SORT

The hash table should be an array with length about __times the maximum number of keys that will
actually be in the table, and. Size of hash table array should be a prime number.

Answer: 1.3

Count controlled loops is a type of an iterations.

-True
Iterative control statements are used when we want to repeat the execution of one or more statements
for specified number of times.

-True

A graph is a collection of points, called vertices, and line segments connecting those points, called
edges.

-True

_______ memory is used to store local variables and function call while heap memory is used to store
objects in Java.

-STACK

A graph consists of a set of nodes or vertices together with a set of edges or arcs where each edge joins
two ______.

-VERTICES

_________ algorithms work by recursively constructing a set of objects from the smallest possible
constituent parts.

-GREEDY

___________ is a linear data structure in which the operations are performed based on FIFO (First In
First Out) principle and the last position is connected back to the first position to make a circle.

-CIRCULAR QUEUE

The weighted longest path problem is the same as the Travelling salesman path problem, because the
longest path always includes all vertices.

-True

Heap is called a ___________.

-MAX HEAP
A binary _______ is a complete binary tree which satisfies the heap ordering property.

-HEAP

_____matrix in graph theory is a matrix sized n*n , where n is the number of vertices of the graph.

-PATH

Dijkstra's algorithm can be used to determine the shortest path from one node in a graph to every other
node within the same graph data structure, provided that the nodes are reachable from the starting
node.

-True

In C++, hashing is a technique to directly search the location of desired data on the disk without using
index structure.

-True

A ________ is a data structure that is used to store keys/value pairs.

-HASH TABLE

A priority dequeue acts like a queue in that you dequeue an item by removing it from the front.

-True

A ________ is a complete binary tree in which the value in each internal node is greater than or equal to
the values in the children of that node.

-MAX HEAP

Dijkstra's algorithm works correctly, because all edge weights are non-________, and the vertex with
the least shortest-path estimate is always chosen.

-NEGATIVE

Hashing provides a more reliable and_ method of data retrieval than any other data structure.
-FLEXIBLE

The four most common are probably line graphs, bar graphs and histograms, pie charts, and ?

-CARTESIAN

A graph is a collection of points, called vertices, and line segments connecting those points, called
_______.

-EDGES

A binary search tree (BST), also known as an ordered ________.

-BINARY TREE

Sorting is any process of arranging items systematically, and has two common, yet distinct meanings:
ordering: arranging items in a sequence ordered by some criterion; categorizing: grouping items with
similar properties.

-True

___________ is another sorting technique and has an algorithm that has a reasonably proficient space-
time complexity - O(n log n) and is quite trivial to apply.

-MERGE SORT

_________A sorting algorithm used for numbers.

-RADIX

Data Structures And Algorithms Midterm Quiz 2

Sorting is any process of arranging items systematically, and has two common, yet distinct meanings:
ordering: arranging items in a sequence ordered by some criterion; categorizing: grouping items with
similar properties.
-True

A priority queue allows permit null elements.

-False

Merge sort - A sorting algorithm which divides the elements to subgroups and then merges back to
make a sorted.

-True

A priority dequeue acts like a queue in that you dequeue an item by removing it from the front.

-True

A priority queue in Java is a special type of queue wherein all the elements are ordered as per their
natural ordering or based on a custom TEMPERATURE supplied at the time of creation.

-False

Bubble Sort Algorithm is used to arrange N elements in ascending order, and for that, you have to begin
with 0th element and compare it with the first element. If the 0th element is found greater than the 1st
element, then the swapping operation will be performed, i.e., the two values will get interchanged. In
this way, all the elements of the array get compared.

-True

The selection is a straightforward process of sorting values. In this method, to sort the data in ascending
order, the 0thelement is compared with all other elements. If the 0th element is found to be greater
than the compared element, the two values get interchanged.

-True

Merge sort is another sorting technique and has an algorithm that has a reasonably proficient space-
time complexity - O(n log n) and is quite trivial to apply.

-True
Priority queue. Priority queues are a type of container adaptors, specifically designed such that its first
element is always the greatest of the elements it contains, according to some strict weak ordering
criterion.

-True

Quicksort — is the WORST Sorting Algorithm The time complexity of Quicksort is O(n log n) in the best
case, O(n log n) in the average case, and O(n^2) in the worst case.

-False

External Sorting If all the data that is to be sorted can be adjusted at a time in the main memory, the
internal sorting method is being performed.

-False

A max-heap is a complete binary tree in which the value in each internal node is greater than or equal to
the values in the children of that node.

-True

Sorting is an important issue in Data Structure which creates the sequence of the list of items.

-True

A heap is a specific tree based data structure in which all the nodes of tree are in a specific order.

-True

A Priority Queue in Java does not have any restriction with regard to duplicate elements.

-True

Internal Sorting is when the data that is to be sorted cannot be accommodated in the memory at the
same time and some has to be kept in auxiliary memory such as hard disk, floppy disk, magnetic tapes
etc, then external sorting methods are performed.

-False
Radix Sort - A sorting algorithm used for numbers.

-True

Loop sorting is any process that involves arranging the data into some meaningful order to make it
easier to understand, analyze or visualize.

-False

QUICK Sort - A sorting algorithm which is a comparison based sorting technique based on Binary Heap
data structure.

-False

Internal Sorting: If all the data that is to be sorted can be adjusted at a time in the main memory, the
internal sorting method is being performed.

-True

The Floyd-Warshall algorithm outputs the correct result as long as no negative cycles exist in the input
graph.

-True

The acronym FIFO stands for ?

-FIRST IN FIRST OUT

Greedy algorithm is efficient whereas Dynamic programming is more efficient.

-True

A hash function takes a group of characters (called a key) and maps it to a value of a certain length
(called a hash value or hash)

-True

The selection is a straightforward process of sorting values. In this method, to sort the data in ascending
order, the 0thelement is compared with all other elements. If the 0th element is found to be greater
than the compared element, the two values get interchanged.
-True

A RADIX is a specific tree based data structure in which all the nodes of tree are in a specific order.

-NO,it must be HEAP

A binary tree where the left child contains only nodes with values less than the parent node, and where
the right child only contains nodes with values greater than or equal to the parent.

-YES

In computer science, a problem is said to have optimal substructure if an optimal solution can be
constructed from optimal solutions of its subproblems.

-TRUE

Binary Search Tree, is a node-based binary tree data structure which has the following properties: The
left subtree of a node contains only nodes with keys lesser than the node's key. The right subtree of a
node contains only nodes with keys greater than the node's key.

-TRUE

A hash function that returns a unique hash number is called a _______hash function.

-UNIVERSAL

A _______ queue acts like a queue in that you dequeue an item by removing it from the front.

-PRIORITY

_______programming is a method of solving complex problems by breaking them down into simpler
steps.

-DYNAMIC

The recursion is the repeated application of a recursive procedure or definition.

-True
Bellman Ford algorithm is useful in finding shortest path from a given source vertex to all the other
vertices even if the graph contains a _______ weight edge.

-NEGATIVE

An MD5 hash function encodes a string of information and encodes it into a 128-bit fingerprint.

-True

______ is one of the most powerful and advanced data structures. It is a non-linear data structure
compared to arrays, linked lists, stack and queue. It represents the nodes connected by edges.

-TREE

Bubble Sort Algorithm is used to arrange N elements in ascending order, and for that, you have to begin
with 0th element and compare it with the first element. If the 0th element is found greater than the 1st
element, then the swapping operation will be performed, i.e., the two values will get interchanged. In
this way, all the elements of the array get compared.

-True

The Bellman-Ford algorithm is a graph search algorithm that finds the shortest path between a given
source vertex and all other vertices in the graph.

-True

A ________ is a data structure that has two types of elements, vertices and edges.

-GRAPH

_________Algorithm is used to arrange N elements in ascending order, and for that, you have to begin
with 0th element and compare it with the first element.

-BUBBLE SORT

A simple data type can store only one value at a time.

-True
The _______ algorithm is a graph search algorithm that finds the shortest path between a given source
vertex and all other vertices in the graph.

-BELLMAN-FORD

Sorting is the process of arranging objects in a certain sequence or order according to specific rules.

-TRUE

A queue is a collection of entities that are maintained in a sequence and can be modified by the
addition of entities at one end of the sequence and removal from the other end of the sequence.

-True

The ______ is a straightforward process of sorting values. In this method, to sort the data in ascending
order, the 0thelement is compared with all other elements.

-SELECTION SORT

The hash table should be an array with length about __times the maximum number of keys that will
actually be in the table, and. Size of hash table array should be a prime number.

Answer: 1.3

Count controlled loops is a type of an iterations.

-True

Iterative control statements are used when we want to repeat the execution of one or more statements
for specified number of times.

-True

A graph is a collection of points, called vertices, and line segments connecting those points, called
edges.

-True
_______ memory is used to store local variables and function call while heap memory is used to store
objects in Java.

-STACK

A graph consists of a set of nodes or vertices together with a set of edges or arcs where each edge joins
two ______.

-VERTICES

_________ algorithms work by recursively constructing a set of objects from the smallest possible
constituent parts.

-GREEDY

___________ is a linear data structure in which the operations are performed based on FIFO (First In
First Out) principle and the last position is connected back to the first position to make a circle.

-CIRCULAR QUEUE

The weighted longest path problem is the same as the Travelling salesman path problem, because the
longest path always includes all vertices.

-True

Heap is called a ___________.

-MAX HEAP

A binary _______ is a complete binary tree which satisfies the heap ordering property.

-HEAP

_____matrix in graph theory is a matrix sized n*n , where n is the number of vertices of the graph.

-PATH
Dijkstra's algorithm can be used to determine the shortest path from one node in a graph to every other
node within the same graph data structure, provided that the nodes are reachable from the starting
node.

-True

In C++, hashing is a technique to directly search the location of desired data on the disk without using
index structure.

-True

A ________ is a data structure that is used to store keys/value pairs.

-HASH TABLE

A priority dequeue acts like a queue in that you dequeue an item by removing it from the front.

-True

A ________ is a complete binary tree in which the value in each internal node is greater than or equal to
the values in the children of that node.

-MAX HEAP

Dijkstra's algorithm works correctly, because all edge weights are non-________, and the vertex with
the least shortest-path estimate is always chosen.

-NEGATIVE

Hashing provides a more reliable and_ method of data retrieval than any other data structure.

-FLEXIBLE

The four most common are probably line graphs, bar graphs and histograms, pie charts, and ?

-CARTESIAN

A graph is a collection of points, called vertices, and line segments connecting those points, called
_______.
-EDGES

A binary search tree (BST), also known as an ordered ________.

-BINARY TREE

Sorting is any process of arranging items systematically, and has two common, yet distinct meanings:
ordering: arranging items in a sequence ordered by some criterion; categorizing: grouping items with
similar properties.

-True

___________ is another sorting technique and has an algorithm that has a reasonably proficient space-
time complexity - O(n log n) and is quite trivial to apply.

-MERGE SORT

_________A sorting algorithm used for numbers.

-RADIX

A graph is a data structure that has two types of elements, vertices and angles.

-False

A max-heap is a complete binary tree in which the value in each internal node is greater than or equal to
the values in the children of that node.

-True

Sa agham pangkompyuter, ang grap ay isang uri ng datos na abstrakt na binubuo ng set ng mga node at
isang set ng mga edge o gilid na nagtatakda ng relasyon sa pagitan ng mga node. Ang grap na ADT ay
nagmumula sa konsepto ng grap sa matematika.Wikipedia

-True

A Priority Queue in Java does not have any restriction with regard to duplicate elements.
-True

Hash Table is a data structure which stores data in an associative manner.

-True

The following are other terms of Binary search tree. EXCEPT ONE.

-search loop

A sorting algorithm is said to be _________ if two objects with equal keys appear in the same order in
sorted output as they appear in the input unsorted array.

-STABLE

A max-heap is a complete binary tree in which the value in each internal node is greater than or equal to
the values in the children of that node.

-True

A binary tree is a finite set of nodes that is either empty or consist a root node and two disjoint binary
trees called the left subtree and the right subtree.

-TRUE

Breadth-____-search is the algorithm that will find shortest paths in an unweighted graph.

-FIRST

A ____________ is a tree in which every node other than the leaves has two children.

-FULL BINARY TREE

A Priority Queue in Java does not have any restriction with regard to duplicate elements.

-True
A _____________is a binary tree in which every level, except possibly the last, is completely filled, and
all nodes are as far left as possible.

-COMPLETE BINARY TREE

A pseudo _____-graph is a general-graph allowing edges to connect a vertex to itself.

-GENERAL

The maximum value in a Binary Search Tree can be found by ?

-START AT THE ROOT NODE

_____________ have less memory consumption as compared to linear queue because while doing
insertion after deletion operation it allocate an extra space the first remaining vacant but in circular
queue the first is used as it comes immediate after the last.

-CIRCULAR QUEUE

How many leaves are there in a full binary tree?

-CONTAINS 2N-1

A Binary Tree is labeled if every node is assigned a label and a Binary Tree is __________ if nodes are not
assigned any label.

-UNLABELED

_________ is a linear data structure which follows a particular order in which the operations are
performed.

-STACK

Merge sort is more efficient and works faster than quick sort in case of larger array size or datasets.

-TRUE
The ________ sort is a combination of searching and sorting.

-SELECTION

QuickSort is an___________ algorithm because we do swapping of elements according to pivot's


position (without considering their original positions).

-UNSTABLE

Means to insert an item into the back of the queue.

-ENQUEUE

In _________sorting data is stored outside memory (like on disk) and only loaded into memory in small
chunks.

-EXTERNAL

AVL tree is also a BST but it can rebalance itself.

-TRUE

__________ is a common operation in many applications, and efficient algorithms to perform it have
been developed.

-SORTING

The _________ is slightly faster than the heap sort for larger sets, but it requires twice the memory of
the heap sort because of the second array.

-MERGE SORT

A ____________is an example of a linear data structure, or more abstractly a sequential collection

-QUEUE

DEQUEUE IS ALSO CALLED ?


-DOUBLY ENDED QUEUE

A binary tree is considered full if every node has exactly 0 or 2 children. A binary tree is considered
incomplete if every level is full except the last, and all nodes are pushed as far left as possible

-NO

The following are synonym of QUEUE.EXCEPT ONE.

-massive

A ___________ is a tree with some extra leaf nodes at depth n+1, all toward the left.

-Perfect Binary Tree

In a _____ skewed, most of the nodes have the leftchild without corresponding right child.

-LEFT

Bubble Sort is based on the idea of repeatedly comparing pairs of ________ELEMENTS swapping their
positions if they exist in the wrong order.

-ADJACENT

A ___________ queue is typically implemented using Heap data structure.

-PRIORITY

This transformation consists of replacing every null subtree of the original tree with “special nodes.” The
nodes from the original tree are then internal nodes , while the “special nodes” are external nodes

-EXTENDED BINARY TREE

A General tree can't be empty but a Binary tree can be empty.

-YES

_________sorting means sorting without any extra space requirement.


-IN PLACE

A binary tree is either empty or consists of a node called the root together with two binary trees called
the left subtree and the right subtree.

-TRUE

Which is the slowest sorting algorithm?

-Heap sort

Means to insert an item into the back of the queue.

-ENQUEUE

The Floyd-Warshall algorithm outputs the correct result as long as no negative cycles exist in the input
graph.

-True

The acronym FIFO stands for ?

-FIRST IN FIRST OUT

Greedy algorithm is efficient whereas Dynamic programming is more efficient.

-True

A hash function takes a group of characters (called a key) and maps it to a value of a certain length
(called a hash value or hash)

-True

The selection is a straightforward process of sorting values. In this method, to sort the data in ascending
order, the 0thelement is compared with all other elements. If the 0th element is found to be greater
than the compared element, the two values get interchanged.

-True
A RADIX is a specific tree based data structure in which all the nodes of tree are in a specific order.

-NO,it must be HEAP

A binary tree where the left child contains only nodes with values less than the parent node, and where
the right child only contains nodes with values greater than or equal to the parent.

-YES

In computer science, a problem is said to have optimal substructure if an optimal solution can be
constructed from optimal solutions of its subproblems.

-TRUE

Binary Search Tree, is a node-based binary tree data structure which has the following properties: The
left subtree of a node contains only nodes with keys lesser than the node's key. The right subtree of a
node contains only nodes with keys greater than the node's key.

-TRUE

A hash function that returns a unique hash number is called a _______hash function.

-UNIVERSAL

A _______ queue acts like a queue in that you dequeue an item by removing it from the front.

-PRIORITY

_______programming is a method of solving complex problems by breaking them down into simpler
steps.

-DYNAMIC

The recursion is the repeated application of a recursive procedure or definition.

-True
Bellman Ford algorithm is useful in finding shortest path from a given source vertex to all the other
vertices even if the graph contains a _______ weight edge.

-NEGATIVE

An MD5 hash function encodes a string of information and encodes it into a 128-bit fingerprint.

-True

______ is one of the most powerful and advanced data structures. It is a non-linear data structure
compared to arrays, linked lists, stack and queue. It represents the nodes connected by edges.

-TREE

Bubble Sort Algorithm is used to arrange N elements in ascending order, and for that, you have to begin
with 0th element and compare it with the first element. If the 0th element is found greater than the 1st
element, then the swapping operation will be performed, i.e., the two values will get interchanged. In
this way, all the elements of the array get compared.

-True

The Bellman-Ford algorithm is a graph search algorithm that finds the shortest path between a given
source vertex and all other vertices in the graph.

-True

A ________ is a data structure that has two types of elements, vertices and edges.

-GRAPH

_________Algorithm is used to arrange N elements in ascending order, and for that, you have to begin
with 0th element and compare it with the first element.

-BUBBLE SORT

A simple data type can store only one value at a time.

-True
The _______ algorithm is a graph search algorithm that finds the shortest path between a given source
vertex and all other vertices in the graph.

-BELLMAN-FORD

Sorting is the process of arranging objects in a certain sequence or order according to specific rules.

-TRUE

A queue is a collection of entities that are maintained in a sequence and can be modified by the
addition of entities at one end of the sequence and removal from the other end of the sequence.

-True

The ______ is a straightforward process of sorting values. In this method, to sort the data in ascending
order, the 0thelement is compared with all other elements.

-SELECTION SORT

The hash table should be an array with length about __times the maximum number of keys that will
actually be in the table, and. Size of hash table array should be a prime number.

Answer: 1.3

Count controlled loops is a type of an iterations.

-True

Iterative control statements are used when we want to repeat the execution of one or more statements
for specified number of times.

-True

A graph is a collection of points, called vertices, and line segments connecting those points, called
edges.

-True
_______ memory is used to store local variables and function call while heap memory is used to store
objects in Java.

-STACK

A graph consists of a set of nodes or vertices together with a set of edges or arcs where each edge joins
two ______.

-VERTICES

_________ algorithms work by recursively constructing a set of objects from the smallest possible
constituent parts.

-GREEDY

___________ is a linear data structure in which the operations are performed based on FIFO (First In
First Out) principle and the last position is connected back to the first position to make a circle.

-CIRCULAR QUEUE

The weighted longest path problem is the same as the Travelling salesman path problem, because the
longest path always includes all vertices.

-True

Heap is called a ___________.

-MAX HEAP

A binary _______ is a complete binary tree which satisfies the heap ordering property.

-HEAP

_____matrix in graph theory is a matrix sized n*n , where n is the number of vertices of the graph.

-PATH
Dijkstra's algorithm can be used to determine the shortest path from one node in a graph to every other
node within the same graph data structure, provided that the nodes are reachable from the starting
node.

-True

In C++, hashing is a technique to directly search the location of desired data on the disk without using
index structure.

-True

A ________ is a data structure that is used to store keys/value pairs.

-HASH TABLE

A priority dequeue acts like a queue in that you dequeue an item by removing it from the front.

-True

A ________ is a complete binary tree in which the value in each internal node is greater than or equal to
the values in the children of that node.

-MAX HEAP

Dijkstra's algorithm works correctly, because all edge weights are non-________, and the vertex with
the least shortest-path estimate is always chosen.

-NEGATIVE

Hashing provides a more reliable and_ method of data retrieval than any other data structure.

-FLEXIBLE

The four most common are probably line graphs, bar graphs and histograms, pie charts, and ?

-CARTESIAN

A graph is a collection of points, called vertices, and line segments connecting those points, called
_______.
-EDGES

A binary search tree (BST), also known as an ordered ________.

-BINARY TREE

Sorting is any process of arranging items systematically, and has two common, yet distinct meanings:
ordering: arranging items in a sequence ordered by some criterion; categorizing: grouping items with
similar properties.

-True

___________ is another sorting technique and has an algorithm that has a reasonably proficient space-
time complexity - O(n log n) and is quite trivial to apply.

-MERGE SORT

_________A sorting algorithm used for numbers.

-RADIX

Data Structure and Algorithms Quiz 1

This may take place only when there is some minimum amount or no space left in free storage list.

-Garbage collection

In a linked list, the ____________ contains the address of next element in the list.

-Link field

Indexing the ________________ element in the list is not possible in linked lists.

-middle
This refers to a linear collection of data items.

-List

Which of the following is two way lists?

-List traversed in two directions

Each node in a linked list must contain at least ___________________.

-Two fields

A linear list in which the pointer points only to the successive node.

-singly linked list

Which is the pointer associated with the availability list?

-AVAIL

Value of first linked list index is _______________.

Answer: 0

Linked lists are best suited _____________________.

-for the size of the structure and the data in the structure are constantly changing

LINK is the pointer pointing to the ____________________.

-predecessor node

Each node in singly linked list has _______ fields.

Answer: 2

The situation when in a linked list START=NULL is ____________________.

-Underflow
What is a run list?

-small batches of records from a file

The operation of processing each element in the list is known as ________________.

-traversal

This is a linear list in which insertions and deletions are made to form either end of the structure.

-Dequeue

This indicates the end of the list.

-Sentinel

The dummy header in linked list contains ____________________.

-first record of the actual data

In linked lists, there are no NULL links in ______________

-circular linked list

A linear list in which the last node points to the first node.

-circular linked list

Data Structure and Algorithms Quiz 2

New nodes are added to the ________ of the queue.

-Back

Which is the pointer associated with the stack?

-Top

A pointer variable which contains the location at the top element of the stack.
-Top

Which of the following names does not relate to stacks?

-FIFO lists

The elements are removal from a stack in _________ order.

-Reverse

Deletion operation is done using __________ in a queue.

-front

This is the insertion operation in the stack.

-push

What is a queue?

-FIFO

In the linked representation of the stack, __________ pointer behaves as the top pointer variable of
stack.

-Start

This form of access is used to add/remove nodes from a stack.

-LIFO

In linked representation of stack, the null pointer of the last node in the list signals
_____________________.

-Bottom of the stack

The retrieval of items in a stack is ___________ operation.

-pop
Stack follows the strategy of ________________.

-LIFO

In linked representation of stack, ___________ fields hold the elements of the stack.

-INFO

The term push and pop is related to _____________.

-stacks

This is the term used to delete an element from the stack.

-Pop

Which of the following is an application of stack?

-all of these

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

-The new node is placed at the front of the linked list

The term used to insert an element into stack.

-push

This form of access is used to add and remove nodes from a queue.

-FIFO, First In First Out

A graph consists of a set of nodes or vertices together with a set of edges or arcs where each edge joins
two ______.

-VERTICES

_________A sorting algorithm used for numbers.


-RADIX

This is the Best Sorting Algorithm That the time complexity of Quicksort is O(n log n) in the best case,
O(n log n) in the average case, and O(n^2) in the worst case.

-QUICKSORT

A binary tree where the left child contains only nodes with values less than the parent node, and where
the right child only contains nodes with values greater than or equal to the parent.

-YES

________is any process of arranging items systematically, and has two common, yet distinct meanings:
ordering: arranging items in a sequence ordered by some criterion; categorizing: grouping items with
similar properties.

-SORTING

Heap is called a ___________.

- MAX HEAP

______ is one of the most powerful and advanced data structures. It is a non-linear data structure
compared to arrays, linked lists, stack and queue. It represents the nodes connected by edges.

-TREE

A graph is a collection of points, called vertices, and line segments connecting those points, called
_______.

-EDGES

The _______ algorithm is a graph search algorithm that finds the shortest path between a given source
vertex and all other vertices in the graph.

-BELLMAN-FORD

In computer science, a problem is said to have optimal substructure if an optimal solution can be
constructed from optimal solutions of its subproblems.

-TRUE
_______programming is a method of solving complex problems by breaking them down into simpler
steps.

-DYNAMIC

_____matrix in graph theory is a matrix sized n*n , where n is the number of vertices of the graph.

-PATH

A _______ queue acts like a queue in that you dequeue an item by removing it from the front.

-PRIORITY

A ________ is a complete binary tree in which the value in each internal node is greater than or equal to
the values in the children of that node.

-MAX HEAP

A ________ is a data structure that is used to store keys/value pairs.

-HASH TABLE

The four most common are probably line graphs, bar graphs and histograms, pie charts, and ?

-CARETESIAN

Sorting is the process of arranging objects in a certain sequence or order according to specific rules.

-TRUE

Dijkstra's algorithm works correctly, because all edge weights are non-________, and the vertex with
the least shortest-path estimate is always chosen.

-NEGATIVE

_________ algorithms work by recursively constructing a set of objects from the smallest possible
constituent parts.
-GREEDY

The Floyd-Warshall algorithm outputs the correct result as long as no negative cycles exist in the input
graph.

-TRUE

In ___________ we specify an object that is used as a key, and the value we want to associate to that
key.

-HASTABLE

Breadth-first-search is the algorithm that will find shortest paths in an _____ graph.

-UNWEIGHTED

A hash function is a function which when given a key, generates an address in the table.

-Yes

Tree is a hierarchical data structure which stores the information naturally in the form of hierarchy style.

-TRUE

A hash______ is a data structure that is used to store keys/value pairs.

-TABLE

Path Matrix in graph theory is a matrix sized ___ , where n is the number of vertices of the graph.

Answer: n*n

Kruskal's Algorithm : performs better in typical situations (sparse graphs) because it uses simpler data
structures. Prim's Algorithm : is significantly ___the limit when you've got a really dense graph with
many more edges than vertices.

-faster
The Three methods in HASHING in open addressing are linear probing, quadratic probing, and
_____hashing.

-DOUBLE

Graphs are a powerful and versatile data structure that easily allow you to represent real life
relationships between different types of data (nodes).

-YES

Comparing BFS and DFS, the big advantage of DFS is that it has much _____memory requirements than
BFS, because it's not necessary to store all of the child pointers at each level.

-LOWER

A simple graph may be either ____________.

-BOTH A AND B

A pseudo _____-graph is a general-graph allowing edges to connect a vertex to itself.

-GENERAL

A directed general-graph is a general-graph in which the set E is the set of ordered pairs of vertices.

-TRUE

Shortest path algorithms are a family of algorithms designed to solve the shortest path problem.

-YES

In computer science, a problem is said to have optimal substructure if an optimal solution can be
constructed from optimal solutions of its subproblems.

-True

Graph Algorithms or Graph ______ are analytic tools used to determine strength and direction of
relationships between objects in a graph.
-ANALYTICS

The eight most commonly used graphs are linear, power, quadratic, polynomial, rational, ______,
logarithmic, and sinusoidal.

-EXPONENTIAL

An MD5 hash function encodes a string of information and encodes it into a___bit fingerprint.

Answer: 128

_____Algorithm : is significantly faster in the limit when you've got a really dense graph with many more
edges than vertices.

-PRIM'S

An ______hash function encodes a string of information and encodes it into a 128-bit fingerprint.

-MD5

Eulerian refers to the Swiss mathematician _____Euler, who invented graph theory in the 18th century.

-LEONHARD

A complete digraph is a directed graph in which every pair of distinct vertices is connected by a ___of
unique edges (one in each direction).

-PAIR

A graph is a picture designed to express words, particularly the connection between two or more
quantities.

-TRUE

Dijkstra's algorithm is Dijkstra's algorithm, it is neither algorithm because BFS and DFS themselves are
not Dijkstra's algorithm.

-True
Dynamic programming is a method of solving complex problems by breaking them down into simpler
steps.

-Yes

A hash table is an array containing all of the keys to search on.

-YES

______ are a common method to visually illustrate relationships in the data.

-GRAPHS

A simple graph, also called a ______graph.

-STRICT

A graph is a____structure that has two types of elements, vertices and edges.

-DATA

_______ Algorithm : performs better in typical situations (sparse graphs) because it uses simpler data
structures.

-KRUSKAL'S

A hash function is a function which when given a key, generates an address in the table.

-True

Hashing is also used in encryption.

-YES

The hash table should be an array with length about _ times the maximum number of keys that will
actually be in the table, and. Size of hash table array should be a prime number.

Answer: 1.3

You might also like