

![]()


Data Structures and Algorithms is a fundamental course that covers the essential concepts required to organize, process, and store data efficiently. Students learn about various data structures such as arrays, linked lists, stacks, queues, trees, and graphs, as well as techniques for manipulating them. The course emphasizes algorithm design, analysis, and implementation, including sorting, searching, and recursive algorithms. By understanding the efficiency and trade-offs of different approaches, students develop problem-solving skills crucial for effective programming and software development.
Recommended Textbook
Java Foundations 3rd Edition by John Lewis
Available Study Resources on Quizplus
16 Chapters
639 Verified Questions
639 Flashcards
Source URL: https://quizplus.com/study-set/3997 Page 2

40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80262
Sample Questions
Q1) Which of the following might be included in an IDE?
A) a compiler
B) an editor
C) a debugger
D) all of the above
E) none of the above
Answer: D
Q2) Explain the difference between a compile-time error and a run-time error. Give an example of each.
Answer: A compile-time error will cause the compiler to exit with an error, and therefore the program will not be properly translated. A program with a run-time error will compile and be translated, but will crash or throw an exception while it is running. An example of a compile-time error is forgetting a semicolon. An example of a run-time error is dividing by zero.
Q3) A reserved word can be used to name a method.
A)True
B)False
Answer: False
Q4) Write an application that prints the first few lines of a song (your choice).
Answer: 11edd9cc_5a45_7376_84e8_afca069acf96_TB2841_00
To view all questions and flashcards with answers, click on the resource link above. Page 3

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80257
Sample Questions
Q1) The print and the println methods are identical and can be used interchangeably.
A)True
B)False
Answer: False
Q2) Explain why it might not be safe for a programmer to use a narrowing conversion.
Answer: A narrowing conversion might not be safe because it can result in information loss. This is because in a narrowing conversion a programmer is changing a piece of data from a data type that can hold more information into a data type that can hold less information.
Q3) For the following expression, indicate the order that in which the operators will be evaluated.
a + b * c / (d -
e)
Answer: d - e will be evaluated first since it is in parenthesis. Next, b*c will be evaluated and then the division operation will be evaluated. Finally, the addition will be performed.
Q4) Java is a strongly-typed language.
A)True
B)False
Answer: True
To view all questions and flashcards with answers, click on the resource link above. Page 4

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80255
Sample Questions
Q1) The System.out.printf() method is an alternative way to output information in Java.
A)True
B)False
Answer: True
Q2) Which of the following is a correct declaration of enumerated type for the suits of a deck of cards?
A) enumerated type Suit = { hearts, spades, diamonds, clubs };
B) enum Suit {hearts, spades, diamonds, clubs };
C) enum Suit {hearts, spades, diamonds, clubs }
D) enumerated type Suit = {hearts, spades, diamonds, clubs };
E) enum Suit = { hearts, spades, diamonds, clubs }
Answer: C
Q3) Write an expression that computes 12 raised to the power 4.3 and store the result in a double called result.
Answer: result = Math.pow(12, 4.3);
Q4) The new operator is used to access an objects methods.
A)True
B)False
Answer: False
To view all questions and flashcards with answers, click on the resource link above. Page 5

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80254
Sample Questions
Q1) What is wrong with the following snippet of code? Rewrite it so it produces the correct output.
if(a < b)
if(a == c)
System.out.println( a < b and a == c );
else
System.out.println( a is not less than b );
Q2) Write a switch statement that switches on an integer variable named val. If val is 2 or 15, then output "Hello World." For all other values, output "Goodbye World."
Q3) It is possible to implement a switch statement using if statements. A)True B)False
Q4) Rewrite the following for loop as a while loop. for(int i = 0; i < MAX; i++) //loop body
Q5) Write a snippet of code that determines which of two integer variables, intOne and intTwo, contains a larger number, and print out the larger one. If they are equal, the output should say that.
Q6) Write a for loop to print the even numbers from 1 to 100 (inclusive).
Page 6
To view all questions and flashcards with answers, click on the resource link above.

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80253
Sample Questions
Q1) A return statement is not required at the end of every method. A)True
B)False
Q2) Write a method called maxOfThree that accepts three integer parameters and returns the largest of the three.
Q3) Methods that can be called directly through the class name and do not need to have an object instantiated are called _________________.
A) final
B) public
C) static D) private E) none of the above
Q4) Aggregation is sometimes described as a has-a relationship. A)True
B)False
Q5) Write a method that prints your name, age, and major. The method should accept no parameters and return no value.
Q6) Explain the difference between actual parameters and formal parameters.
Q7) Explain why a static method cannot refer to an instance variable.
Page 7
To view all questions and flashcards with answers, click on the resource link above.

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80252
Sample Questions
Q1) Which of the following components can be toggled on or off using the mouse, indicating that a particular boolean condition is set or unset?
A) check box
B) radio button
C) slider
D) dialog box
E) none of the above
Q2) A mnemonic is a short line of text that will appear when the cursor is rested momentarily on top of the component.
A)True
B)False
Q3) Which of the following layout managers organize the components from left to right, starting new rows as necessary?
A) Border Layout
B) Box Layout
C) Card Layout
D) Flow Layout
E) Grid Layout
Q4) Explain the difference between check boxes and radio buttons.
To view all questions and flashcards with answers, click on the resource link above. Page 8

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80251
Sample Questions
Q1) Write a method called average that accepts an array of floating point numbers and returns their average.
Q2) In Java, array indexes begin at 0 and end at one less than the length of the array.
A)True
B)False
Q3) What is the precedence of the index operator ( [ ] ) relative to other operators in Java?
A) It has the lowest precedence of all Java operators.
B) It has a higher precedence than addition, but a lower precedence than multiplication. C) It has a higher precedence than multiplication, but a lower precedence than addition.
D) It has the highest precedence of all Java operators.
E) [ ] is not an operator.
Q4) Write the declaration for a two-dimensional array of integers that can be thought of as a table with three rows and three columns. Assign the value 3 to the cell that is in the second row and the third column.
Q5) Explain how arrays are passed to methods as parameters.
To view all questions and flashcards with answers, click on the resource link above. Page 9

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80250
Sample Questions
Q1) Draw a hierarchy of people at a University.
Q2) To invoke a parents constructor in a subclass, we use the ______________ method.
A) abstract
B) construct
C) parent
D) super
E) extends
Q3) Once a method is overridden in a subclass, the original version can never be referenced from within the subclass.
A)True
B)False
Q4) When a variable is declared in a subclass has the same name as a variable declared in a superclass, it is called a _______________ variable.
A) final
B) shadow
C) static
D) dead
E) this is not allowed in Java
Q5) Explain the relevance of the Object class to the Java programming language.
Page 10
To view all questions and flashcards with answers, click on the resource link above.

Available Study Resources on Quizplus for this Chatper
39 Verified Questions
39 Flashcards
Source URL: https://quizplus.com/quiz/80249
Sample Questions
Q1) Consider a class hierarchy that includes a class called Vehicle, with subclasses called Car and Airplane. The Vehicle class has a method called getMaxSpeed, which is overridden in the Car class. The getMaxSpeed of the Vehicle class returns 760 mph, while the getMaxSpeed method of the Car class is overridden to return 150 mph. What is the output of the following snippet of code? Explain your answer. Vehicle v = new Car(); System.out.println(v.getMaxSpeed() + " mph");
Q2) An interface cannot declare any instance variables.
A)True
B)False
Q3) A parameter to a method can be polymorphic.
A)True
B)False
Q4) How do interfaces relate to multiple inheritance?
Q5) Describe the compareTo method the circumstances under which it returns different values.
Q6) Why can't an interface be instantiated?
Q7) What is polymorphism?
Q8) Describe the Iterator interface.
To view all questions and flashcards with answers, click on the resource link above. Page 11

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80260
Sample Questions
Q1) Write the recursive definition of the factorial of a number.
Q2) Recursive solutions to problems should be used whenever possible. A)True
B)False
Q3) Write a recursive Java method that takes in a String as a parameter and returns true if the String is a palindrome. You may assume that the string only contains lower case characters (i.e. no numbers, spaces, punctuation, etc).
Q4) What are the "base" cases when searching for a path through a maze?
Q5) The Towers of Hanoi puzzle cannot be solved iteratively.
A)True
B)False
Q6) A method that calls a different method, which then calls the original calling method is a recursive method.
A)True
B)False
Q7) In Java, it is possible for a method to call itself.
A)True
B)False
Q8) Give a recursive definition of the sum of the first n integers, S(n).
To view all questions and flashcards with answers, click on the resource link above. Page 12
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80261
Sample Questions
Q1) The Exception class is a subclass of the Object class.
A)True
B)False
Q2) What is exception prorogation, and how does it work in Java?
Q3) Consider the following code fragment.
int [] a = new int[50]; a[50] = 100;

Will this code fragment throw an exception? Explain.
Q4) Unchecked exceptions must be caught or propogated, or a program will not compile.
A)True
B)False
Q5) Is the Exception class a subclass of the Error class? Explain.
Q6) What is the difference between a checked exception and an unchecked exception?
Q7) The getMessage method of the Exception class prints out the stack trace, which helps the user to track down the source of the exception.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 13
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80259
Sample Questions
Q1) A linear search is more efficient than a binary search.
A)True
B)False
Q2) Quick sort works by separating a list into two lists, and recursively sorting the two lists using quick sort.
A)True
B)False
Q3) Write a method that accepts an array of integers as a parameter and sorts them using the selection sort algorithm.
Q4) Suppose we would like to swap the elements at index i and index j in an array. Does the following code work? If so, explain how. If not, explain why it fails.
array[i] = array[j];
array[j] = array[i];
Q5) Every algorithm for a problem has the same efficiency.
A)True
B)False
Q6) Explain how merge sort works.
Q7) Explain what O(1) means.
Q8) Explain how quick sort works.

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

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80258
Sample Questions
Q1) A decision tree cannot be used as the basis for an expert system.
A)True
B)False
Q2) Explain the implementation of an postorder traversal.
Q3) What is a decision tree?
Q4) Which of the following traversals visits the root after visiting the left and right subtrees?
A) Preorder
B) Inorder
C) Postorder
D) Level-order
E) none of the above
Q5) If a tree has order 4, what does this mean?
Q6) Since trees are nonlinear structures, it is impossible to implement them using an array.
A)True
B)False
Q7) What does it mean for a tree to be balanced?
Q8) What are the leaves of a tree?
Q9) Explain how a binary tree can be implemented using an array. Page 15
To view all questions and flashcards with answers, click on the resource link above.
Page 16

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80248
Sample Questions
Q1) A postfix expression can be easily evaluated using a queue.
A)True
B)False
Q2) Which of the following is not an operation on a stack?
A) push
B) pop
C) peek
D) dequeue
E) all of the above are operations on a stack
Q3) Suppose the following sequence of elements are inserted into a stack and a queue in the following order: 50, 26, 32, 18, 26, 51. What is the result of three pop operations of the stack and three dequeue operations of the queue?
Q4) In a linked implementation of a stack, a pushed element should be added to the end of the list.
A)True
B)False
Q5) A stack is a LIFO structure.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 17

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80247
Sample Questions
Q1) Finding an element in a balanced binary search tree that contains n elements requires _____________________ comparisons.
A) O(1)
B) O(n)
C) O(2<sup>n</sup>)
D) O(log<sub>2</sub> n)
E) none of the above
Q2) Draw a binary search tree that results from inserting the following elements: 12, 16, 9, 1, 15, 13
Q3) What is the inorder successor of a node in a binary search tree?
Q4) A binary search tree is always a full tree.
A)True
B)False
Q5) Finding an element in a binary search tree always requires O(log<sub>2</sub> n) comparisons.
A)True
B)False
Q6) In a maxheap, the largest element is always the root.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 18
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80256
Sample Questions
Q1) A spanning tree of a graph is a tree with that always has which of the following properties?
A) It includes some of the edges and some of the vertices of the graph.
B) It includes all of the edges and some of the vertices of the graph.
C) It includes some of the edges and all of the vertices of the graph.
D) It includes all of the edges and all of the vertices of the graph.
E) none of the above
Q2) Consider the following undirected graph. vertices: 1, 2, 3, 4, 5 edges: (1,2),(3,4), (2,4), (2, 3) Is the graph connected?
Q3) Can an edge be part of more than one cycle in a graph? Explain.
Q4) Consider the following undirected graph. vertices: 1, 2, 3, 4, 5 edges: (1,2),(3,4), (2,4), (2, 3), (3,5), (4,5)
Give a spanning tree for this graph.
Q5) In an undirected graph, an edge of the form (A, B) is the same as an edge of the form (B, A).
A)True B)False

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