Data Structures and algorithms Exam Questions with Answers
Class - Correct Answers: What term refers to a template for creating an object?
A. Application
B. Class
C. Method
D. Algorithm
Uses an agnostic code repository - Correct Answers: Which characteristic of an algorithm is independent in nature?
A. Uses Python to implement the algorithm
B. uses MySQL for the database needs of the algorithm's application
C. Uses Windows to install the application
D. Uses an agnostic code repository
Record - Correct Answers: What is referred to as a data structure that stores subitems?
A. Array
B. Matrix
C. Record
D. Graph
Maintainability - Correct Answers: Which factor takes the ability to easily update an algorithm into consideration?
A. Scalability
B. Feasability
C. Maintainability
D. Modularity
Finiteness - Correct Answers: What is a component of an algorithm that specifies a stopping point?
A. Sequencing
B. Finiteness
C. Iteration
D. Looping
Linear - Correct Answers: Which term refers to a type of search algorithm?
A. Linear
B. Divide-and-conquer
C. Greedy
D. Quicksort
Simplicity - Correct Answers: What is a high-level consideration in an algorithm's design?
A. Simplicity
B. Database type
C. Finiteness
D. Browser Type
Binary Search - Correct Answers: What is the primary method used to search for an item in a sorted array?
A. Binary search
B. Jump Search
C. Exponential search
D. Linear Search
A posteriori analysis - Correct Answers: Which review of an algorithm happens after implementation?
* Binary search
* A posteriori analysis
* A priori analysis
* Linear search
Extensibility - Correct Answers: Which factor helps measure the reusability of an algorithm?
* User adoption
* Correctness
* Extensibility
* Flowchart
Binary Search - Correct Answers: Which search algorithm utilizes the divide-and-conquer strategy?
* Insertion search
* Bubble search
* Linear search
* Binary search
Binary - Correct Answers: Which algorithm requires data sorting as its first step?
* Recursive
* Linear
* Binary
* Merge
Worst case - Correct Answers: What does a time complexity analysis of an algorithm include?
* Memory usage
* Efficiency analysis
* Screen load times
* Worst case
Tree-based data structure - Correct Answers: Which data type do heap sorts work with?
* Tree-based data structure
* Array
* String
* Number
Recursive - Correct Answers: Which function is used in conjunction with a merge sort algorithm?
* For loop
* If statement
* Do while loop
* Recursive
Calls itself - Correct Answers: Which attribute of a recursive function makes it unique?
* Calls itself
* Calls another function
* Uses for loops
* Uses case statements
x = 25 - Correct Answers: What is x in the following block of logic?
x=28
If x = 10 and x 20
x = 20
elif x = 30
x = 25
elif x = 50
x = 100
else
x = 500
Nested - Correct Answers: What is an if statement inside of an if statement referred to as?
* Nested
* Internal
* Double if
* Subscript
Binary Search - Correct Answers: Which search algorithm functions by continually dividing the data set in half until the sought item is found or the data set is exhausted?
* Sequential search
* Binary search
* Jump search
* Linear search
Interval Search - Correct Answers: Which search algorithm has the best performance when the data set is sorted?
* Sequential search
* List search
* Interval search
* Linear search
Data Structure - Correct Answers: Which term describes a way of organizing, storing, and performing operations on data?
* Data structure
* Vertex
* Record
* Graph
Hash Table - Correct Answers: Which data structure is used to implement a dictionary data type?
* Heap
* Hash table
* List
* Queue
Indexes - Correct Answers: Which element refers to the numeric positions in a list abstract data type (ADT)?
* Head
* Queue
* Priority
* Indexes
It consists of variables and methods - Correct Answers: Which characteristic of a class allows it to be used as an abstract data type (ADT)?
* Overloading
* Instantiation
* It consists of variables and methods
* Overriding
7,9,8,6 - Correct Answers: What is the result when 6 is enqueued to the queue 7,9,8 (with 7 as the front)?
* 6,7,9,8
* 7,9,8,6
* 6,7,9
* 7,9,6
7 - Correct Answers: Which value would be returned from executing the dequeue operation on the queue 7,9,8 (with 7 as the front)?
* 7,9,8
* 9
* 7
* 8
8,6,5 - Correct Answers: Which queue results from executing the following queue operations on the queue 7,9,8 (with 7 as the front)?
Dequeue ()
Enqueue (6)
Enqueue (5)
Dequeue ()
7,9,8,3 - Correct Answers: What will be the new state of the queue 7,9,8 (with 7 as the front) after the enqueue (3) operation?
Array - Correct Answers: Which format is used to store data in a hash table?
* Graph
* Array
* ArrayList
* Doubly linked lists
Record - Correct Answers: Which term refers to a data structure that groups related items of data together?
* Pointer
* Graph
* Record
* Hash table
Hash Table - Correct Answers: Which data structure is used to store unordered items by mapping each item to a location in an array?
* Stack
* List
* Dictionary
* Hash table
Grows and shrinks as needed - Correct Answers: What is the advantage that a linked list has over an array?
* Grows and shrinks as needed
* Allows for random access
* Less memory needed for each element
* Faster search time
A doubly linked list - Correct Answers: What would be the best data structure for a hash table with simple chaining?
* A binary tree
* A doubly linked list
* A singly linked list
* An array
2 - Correct Answers: How many leaf nodes does this tree have?
Anne
/
Peter Zara
|
Savannah
Anne - Correct Answers: What is the root node for this tree?
Anne
/
Peter Zara
|
Savannah
Two - Correct Answers: What is the height for this tree?
Anne
/
Peter Zara
|
Savannah
List - Correct Answers: Which data structure is the most dynamic in storing data items of varying lengths?
* Tuple
* List
* String
* Char
1,8,9,3,5 - Correct Answers: What is the resulting stack when the push(1) function is implemented on this stack yield?8,9,3,5(top is 8)
* 8,9,3,5,1
* 8,9,3,5
* 1,8,9,3,5
* 8,9,3,1
8 - Correct Answers: What will the peek() operation from this stack return? 8,9,3,5(top is 8)
* 4
* 1
* 3
* 8
{82} - Correct Answers: What is the set that results from set1 intersection set2, given these sets?
set1 = {69,82,47}
set2 = {11,82}
* {82}
* {69,82,47,11}
* {69,82,47}
* {11,82}
2/N 37N log(N2) N22N - Correct Answers: What is the order of these functions by growth rate? 2/N,37,2N,N log(N2),N2
* 2/N 37N log(N2) N22N
* 2/N 37N22NN log(N2)
* N log(N2) 2/N 37 N22N
* 2/NN log(N2) N22N 37
11 - Correct Answers: How many elements will be compared to linear search for 27 in this list? [9,3,7,2,8,15,13,35,95,7,4]
* 0
* 10
* 11
* 121
9 - Correct Answers: What is the first element visited in this list when binary searching for the number 7? [6,7,8,9,11,15,20]
6 - Correct Answers: How many elements in a list of size 64 would be visited when using a binary search for a number that is larger than all the values in the list?
6 - Correct Answers: How many elements in a list of size 64 would be visited when using a binary search for a number that is smaller than all the values in the list?
Exponential - Correct Answers: What is the runtime complexity of the algorithm O(N^N + 1)?
* Logarithmic
* Linear
* Quadratic
* Exponential
O(N) - Correct Answers: What is the runtime complexity for the expression 305 + O(325*N)?
* O(N^2)
* N^325
* O(N^N)
* O(N)
O(N^3) - Correct Answers: What is the runtime complexity for this code?
for x in range(N):f
or y in range(N):
for z in range(N):
tot = tot + z
print tot
* O(3)
* O(N^2)
* O(N)
* O(N^3)
Array - Correct Answers: Which term describes an abstract data type (ADT) that Python uses?
* Array
* Numeric
* String
* Char
Stack - Correct Answers: Which abstract data type (ADT) is characterized by the LIFO (last in, first out) principle?
* Array
* Stack
* Queue
* List
dequeue - Correct Answers: Which queue operation removes an item from the front of the queue?
* dequeue
* enqueue
* push
* peek
count() - Correct Answers: Which function in Python returns the number of times the desired value is found in a tuple?
* index()
* len()
* count()
* pop()
index() - Correct Answers: Which function in Python is used to find a specific value in a tuple?
* index()
* len()
* print()
* dict()
clear() - Correct Answers: Which Python list function will remove all items from a list?
* clear()
* remove()
* pop()
* extend()
stack - Correct Answers: Which abstract data type (ADT) allows operations at one end only?
* Stack
* List
* Queue
* String
remove() - Correct Answers: Which Python list function removes the first instance of the specified element?
* stack()
* pop()
* remove()
* extend()
By iterating through the sorted list while placing each value into its correct sorted position within the list - Correct Answers: How does the insertion sort algorithm sort through a list?
* By iterating through the sorted list while placing each value into its correct sorted position within the list
* By comparing the target value to the element in the middle of the list
* By performing an in-place comparison of the items in the list
* By performing the divide and conquer approach, which separates the list into two smaller arrays for comparison
O(N*log(N)) - Correct Answers: What is the average runtime complexity of the merge sort algorithm?
* O(N)
* O(N^)
* O(log(N))
* O(N*log(N))
7 - Correct Answers: What is the midpoint given the quicksort on this list? Consider the lowindex = 5 and highindex = 9.
(43,3,72,18,2,28,51,111,66,71)
111 - Correct Answers: What is the pivot point given the quicksort on this list? Consider the lowindex = 5 and highindex = 9.(43,3,72,18,2,28,51,111,66,71)
Collections - Correct Answers: Which tool in Python is used to implement a deque ADT?
* Abstraction
* String
* Collections
* Robust
pop() - Correct Answers: Which function in Python is used to delete one item on the right side of the deque?
* extend()
* pop()
* insert()
* index()
isEmpty() - Correct Answers: Which function determines that a linked list contains no data?
* IsEmpty()
* peek()
* insert()
* put()
Methods - Correct Answers: What are classes composed of that perform the actions of an application?
* Databases
* JSON
* Methods
* XML
Do While - Correct Answers: Which loop type will always be done at least once?
* For
* Do while
* While
* Foreach
int myVar - Correct Answers: How would a strongly typed language create an integer variable?
* Var myVar
* int myVar
* String myVar
* let big: number = 0
Default - Correct Answers: Which component of a case statement would be considered a fall back in case no other parameters are met?
* Else
* Default
* Break
* Continue
+= - Correct Answers: Which operator is a type of assignment operator?
* +
* +=
* ==
* ||
Content preview
Data Structures and
algorithms Exam Questions
with Answers
Class - Correct Answers: What term refers to a template for creating an object?
A. Application
B. Class
C. Method
D. Algorithm
Uses an agnostic code repository - Correct Answers: Which characteristic of an algorithm is independent
in nature?
A. Uses Python to implement the algorithm
B. uses MySQL for the database needs of the algorithm's application
C. Uses Windows to install the application
D. Uses an agnostic code repository
Record - Correct Answers: What is referred to as a data structure that stores subitems?
A. Array
B. Matrix
C. Record
D. Graph
Maintainability - Correct Answers: Which factor takes the ability to easily update an algorithm into
consideration?
A. Scalability
B. Feasability
C. Maintainability
D. Modularity
, Finiteness - Correct Answers: What is a component of an algorithm that specifies a stopping point?
A. Sequencing
B. Finiteness
C. Iteration
D. Looping
Linear - Correct Answers: Which term refers to a type of search algorithm?
A. Linear
B. Divide-and-conquer
C. Greedy
D. Quicksort
Simplicity - Correct Answers: What is a high-level consideration in an algorithm's design?
A. Simplicity
B. Database type
C. Finiteness
D. Browser Type
Binary Search - Correct Answers: What is the primary method used to search for an item in a sorted
array?
A. Binary search
B. Jump Search
C. Exponential search
D. Linear Search
A posteriori analysis - Correct Answers: Which review of an algorithm happens after implementation?
* Binary search
* A posteriori analysis