

Algorithms Practice Exam
Course Introduction
This course offers a comprehensive exploration of algorithms, focusing on their design, analysis, and implementation across a variety of computational problems. Topics include sorting and searching techniques, divide-and-conquer strategies, greedy algorithms, dynamic programming, graph algorithms, and basic complexity analysis. Students will learn how to evaluate algorithm efficiency, reason about correctness, and select appropriate techniques for different problem domains. Practical assignments and theoretical exercises will develop both programming proficiency and problem-solving skills essential for computer science.
Recommended Textbook
Data Abstraction and Problem Solving with Java Walls and Mirrors 3rd Edition by Janet
Available Study Resources on Quizplus
15 Chapters
870 Verified Questions
870 Flashcards
Source URL: https://quizplus.com/study-set/2590 Page 2

Prichard
Chapter 1: Review of Java Fundamentals
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51576
Sample Questions
Q1) Complete the following code so that it sets found to true if the array a consisting of integers contains the value zero. int index = 0; boolean found = false; Answer: for (index = 0;index < a.length;index++) if (a[index] == 0) found = true;
Q2) What is wrong with this Java statement? int num = new int(5); Answer: int is a primitive type in Java,not a class.We can immediately assign it the value of 5;there is no constructor to call,and no need to dynamically allocate memory.
Q3) How is the finally keyword used in Java?
A)To indicate that a method should terminate and pass a value to the calling environment.
B)To indicate the last statement that will execute in a program.
C)To indicate an action that should take place whether an exception occurred or not.
D)To indicate a termination condition for a loop.
Answer: C
To view all questions and flashcards with answers, click on the resource link above.

3

Chapter 2: Principles of Programming and Software Engineering
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51577
Sample Questions
Q1) What is a prototype program and what is it used for?
Answer: A prototype program is a program that simulates the behavior of portions of the desired software product.It is used to clarify the specifications of the software.
Q2) Abstraction separates the purpose of a module from its implementation.
A)True
B)False
Answer: True
Q3) In a UML diagram,what does it mean if there is an arrow pointing from class A to class B?
Answer: Class A is a subclass of class B.
Q4) Coding is a relatively minor phase in the software life cycle.
A)True
B)False
Answer: True
Q5) What are some of the benefits of modularity?
Answer: Modularity makes it easier to construct large programs.Modularity also isolates errors which makes it easier to debug the program.Also,modular programs are easier to read.Modularity also isolates modifications to the code,and eliminates redundant code.
Page 4
To view all questions and flashcards with answers, click on the resource link above.

Chapter 3: Recursion: the Mirrors
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51578
Sample Questions
Q1) An iterative method always calls itself.
A)True
B)False Answer: False
Q2) A method that is declared as static is an object method.
A)True
B)False Answer: False
Q3) An array is a(n)______.
A)class
B)method
C)object
D)variable Answer: C
Q4) The factorial of n is equal to ______.
A)n - 1
B)n - factorial (n-1)
C)factorial (n-1)
D)n * factorial (n-1)
Answer: D
To view all questions and flashcards with answers, click on the resource link above. Page 5

Chapter 4: Data Abstraction: The Walls
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51579
Sample Questions
Q1) The specifications of an ADT's operations indicate ______.
A)what the operations do
B)how to implement the operations
C)how to store the data in the ADT
D)how to carry out the operations
Q2) Which of the following operations of the ADT list changes the list?
A)remove
B)isEmpty
C)size
D)get
Q3) When is a compiler-generated default constructor created?
Q4) A(n)______ allows two modules to communicate with each other.
A)data structure
B)axiom
C)interface
D)client
Q5) A default Java constructor has a single parameter.
A)True
B)False
Q6) Define the client of a class?
To view all questions and flashcards with answers, click on the resource link above. Page 6

Chapter 5: Linked Lists
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51580
Sample Questions
Q1) _______ is a process that transforms an object into a stream of bytes that can be saved to and restored from a file.
A)Information hiding
B)Object serialization
C)Encapsulation
D)Inheritance
Q2) Insertion at the end of a linear linked list is a special case.
A)True
B)False
Q3) The ADT list can have an arbitrary length.
A)True
B)False
Q4) Each node in a linear linked list references both its predecessor and its successor. A)True
B)False
Q5) The constant null can be used as the value of a reference to any type of object.
A)True
B)False
Q6) What information is stored in a reference to an object?
To view all questions and flashcards with answers, click on the resource link above. Page 7

Chapter 6: Problem Solving With Abstract Data Types
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51581
Sample Questions
Q1) What is a postfix expression?
Q2) What is a fully parenthesized expression?
Q3) Which of the following is a prefix expression?
A)/ a + b c
B)a b c + /
C)a * b + c
D)a / (b +c)
Q4) Which of the following is the postfix form of the prefix expression: * + a b c?
A)a + b * c
B)a + b c *
C)a b + c *
D)a b * c +
Q5) Which of the following strings is a palindrome?
A)"bottle"
B)"beep"
C)"coco"
D)"r"
Q6) What is meant by a grammar?
Q7) What is the main benefit of using a grammar that is recursive?
Q8) What is a recognition algorithm?
To view all questions and flashcards with answers, click on the resource link above. Page 8

Chapter 7: Stacks
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51582
Sample Questions
Q1) In the StackInterface class,the pop method returns an item that is an instance of
A)Integer
B)Double
C)String
D)Object
Q2) Calls to methods that throw StackException must be enclosed in try blocks.
A)True
B)False
Q3) Which of the following is NOT true about converting infix expressions to postfix expressions?
A)the operands always stay in the same order with respect to one another
B)the operators always stay in the same order with respect to one another
C)an operator will move only "to the right" with respect to the operands
D)all parentheses are removed
Q4) When infix expressions are converted to postfix expressions,the operands always stay in the same order with respect to one another.
A)True
B)False
Q5) What is meant by the first in,first out (FIFO)property?
Page 9
To view all questions and flashcards with answers, click on the resource link above.

Chapter 8: Queues
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51583
Sample Questions
Q1) What is the action performed by the dequeueAll operation?
Q2) Which of the following is NOT an ADT queue operation?
A)enqueue
B)isEmpty
C)pop
D)peek
Q3) In an implementation of a queue uses the ADT list,which of the following can be used to implement the operation enqueue(newItem)?
A)list.add(list.size(),newItem)
B)list.add(list.size()+1,newItem)
C)list.add(newItem.size(),newItem)
D)list.add(newItem.size()+1,newItem)
Q4) Write the code fragment to insert the item newItem into a queue that is represented by a circular array.
Q5) In an event-driven simulation of a bank,the arrival of a customer is an internal event.
A)True
B)False
Q6) What is the goal of a simulation?
To view all questions and flashcards with answers, click on the resource link above. Page 10
Chapter 9: Advanced Java Topics
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51584
Sample Questions
Q1) Can the object type of an argument in the call to a method be difference from the object type of the corresponding formal parameter? Explain.
Q2) A class's ______ members are available to instances of all classes.
A)public
B)protected
C)private
D)package access
Q3) A base class is a class that inherits the members of another class.
A)True
B)False
Q4) A(n)______ is a class that is used to provide access to another class that contains many objects.
A)interface
B)abstract class
C)package
D)iterator
Q5) What are the two basic kinds of relationships among classes?
Q6) Inheritance should not be used to implement a has-a relationship.
A)True
B)False

Page 11
To view all questions and flashcards with answers, click on the resource link above.

Chapter 10: Algorithm Efficiency and Sorting
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51585
Sample Questions
Q1) The value of which of the following growth-rate functions grows the fastest?
A)O(n)
B)O(n²)
C)O(1)
D)O(log2 )
Q2) Consider an algorithm that contains loops of the form: for (x = 1 through n ){
For (y = 1 through x){
For (z = 1 through 10){
Task T
} // end for } // end for } // end for
If task T requires t time units,the innermost loop on z requires ______ time units.
A)y
B)10
C)z * t
D)10 * t
Q3) In the worst case,how many comparisons are required in the bubble sort?
Q4) What is determined by average-case analysis?
To view all questions and flashcards with answers, click on the resource link above. Page 12

Chapter 11: Trees
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51586
Sample Questions
Q1) A data element within a record is called a ______.
A)field
B)tree
C)collection
D)key
Q2) In inorder traversal,what is the order of visiting a node and its subtrees?
Q3) What are the three properties of each node n in a binary search tree?
Q4) The minimum height of a binary tree of n nodes is ______.
A)n
B)n / 2
C)(n / 2)- 2
D)log2(n + 1)
Q5) The lines between the nodes of a tree are called ______.
A)branches
B)edges
C)arches
D)subtrees
Q6) Define the left child of node n in a binary tree.
Q7) What are the three methods that a class that implements the Iterator interface must provide?
To view all questions and flashcards with answers, click on the resource link above. Page 13

Chapter 12: Tables and Priority Queues
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51587
Sample Questions
Q1) A heap is a ______.
A)general tree
B)table
C)full binary tree
D)complete binary tree
Q2) A sorted implementation of a table can insert a new item into any convenient location.
A)True
B)False
Q3) What is the effect of the assumption that all items in a table have distinct search keys,on the insertion operation of a table?
Q4) The sorted reference-based implementation of the tableDelete operation is ______.
A)O(1)
B)O(log n)
C)O(n)
D)O(n²)
Q5) What is the major advantage that a heap implementation of a priority queue has over a binary search tree implementation?
To view all questions and flashcards with answers, click on the resource link above. Page 14

Chapter 13: Advanced Implementations of Tables
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51588
Sample Questions
Q1) The height of a binary tree is sensitive to the order in which items are inserted into the tree.
A)True
B)False
Q2) A 2-3-4 tree requires more storage than a binary search tree.
A)True
B)False
Q3) What is the maximum and the minimum number of children that an internal node can have in a 2-3 tree?
Q4) What is a bucket?
Q5) In a 2-3 tree,how is the search key of a 3-node related to the search keys in the left subtree,the middle subtree,and the right subtree of the 3-node?
Q6) What is a 4-node?
Q7) A(n)______ maps the search key of a table item into a location that will contain the item.
A)hash function
B)hash table
C)AVL tree
D)red-black tree
To view all questions and flashcards with answers, click on the resource link above. Page 15

Chapter 14: Graphs
Available Study Resources on Quizplus for this Chatper
60 Verified Questions
60 Flashcards
Source URL: https://quizplus.com/quiz/51589
Sample Questions
Q1) An Euler circuit exits if and only if each vertex touches ______.
A)two edges
B)three edges
C)an even number of edges
D)an odd number of edges
Q2) A ______ is a special cycle that passes through every vertex in a graph exactly once.
A)multigraph
B)tree
C)spanning tree
D)circuit
Q3) What is a simple path?
Q4) A graph consists of ______ sets.
A)two
B)three
C)four
D)five
Q5) The adjacency matrix for an undirected graph is symmetrical.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 16

Chapter 15: External Methods
Available Study Resources on Quizplus for this Chatper
30 Verified Questions
30 Flashcards
Source URL: https://quizplus.com/quiz/51590
Sample Questions
Q1) What is the advantage of using a B-tree instead of a 2-3 tree for indexing external data?
Q2) A 2-3 tree is a type of B-tree.
A)True
B)False
Q3) A file is typically partitioned into individual ______ which are the smallest unit of transfer between internal and external memory.
A)blocks
B)disks
C)keys
D)lines
Q4) Let N be a node in a B-tree.If N has m subtrees S0,S1,S2, ,Sm-1,and N's key values are K1,K2,K3, ,Km-1,then which of the following statements is true?
A)All values in subtree S0 are greater than K1.
B)All values in subtree S1 are less than K1.
C)All values in subtree Sm-2 are greater than Km-2.
D)All values in subtree Sm-1 are less than Km-1.
Q5) Why is random access preferable over sequential access for supporting external tables?
To view all questions and flashcards with answers, click on the resource link above. Page 17