

Data Structures and Algorithms Exam Bank
Course Introduction
This course introduces the fundamental concepts of data structures and algorithms, essential for efficient problem-solving and software development. Students will explore the design, analysis, and implementation of key data structures such as arrays, linked lists, stacks, queues, trees, graphs, and hash tables. The course also covers algorithmic techniques including sorting, searching, recursion, and basic complexity analysis. Through hands-on programming assignments and theoretical discussions, students will develop the skills necessary to select and apply appropriate data structures and algorithms to solve computational problems effectively.
Recommended Textbook
Absolute Java 5th Edition by Walter Savitch
Available Study Resources on Quizplus
20 Chapters
758 Verified Questions
758 Flashcards
Source URL: https://quizplus.com/study-set/3975

Page 2
Chapter 1: Getting Started
Available Study Resources on Quizplus for this Chatper
46 Verified Questions
46 Flashcards
Source URL: https://quizplus.com/quiz/79864
Sample Questions
Q1) There are two kinds of Java programs,applications and applets.Define and discuss each.
Answer: An application is just a regular program that runs on your computer.An applet is a little Java program that runs in a Web browser.Applets and applications are almost identical.The difference is that applications are meant to be run on your computer like any other program,whereas an applet is meant to be run from a Web browser.An applet can be sent to another location on the Internet and run there.
Q2) What is the value of 7.52e-5?
A)752000.0
B)0.0000752
C)0.000752
D)0.00752

Answer: B
Q3) How is the % (modulus)operator used? What is the common use of the modulus operator?
Answer: The modulus operator is used to return the remainder in integer division.For example,the modulus operator is commonly used to determine if a number is an even or an odd value.
To view all questions and flashcards with answers, click on the resource link above.
Page 3

Chapter 2: Console Input and Output
Available Study Resources on Quizplus for this Chatper
29 Verified Questions
29 Flashcards
Source URL: https://quizplus.com/quiz/79862
Sample Questions
Q1) Echoing input is good programming practice because it can reveal problems in the input.
A)True
B)False
Answer: True
Q2) Which statement or group of statements produces the output: Java programming is fun!
A)System.out.print(Java programming); System.out.print(is fun!);
B)System.out.println(Java programming is fun!);
C)System.out.println("Java programming"); System.out.println(" is fun!"); D)System.out.print("Java programming") System.out.println(" is fun!");
Answer: D
Q3) Write a Java program to create and display 57.32% using the DecimalFormat class.Include the necessary import statement to use the DecimalFormat class. Answer: import java.text.DecimalFormat; public class decimalClass { public static void main(String[] args) { DecimalFormat df = new DecimalFormat("00.00%"); System.out.println(df.format(.5732)); } }
To view all questions and flashcards with answers, click on the resource link above. Page 4
Chapter 3: Flow of Control
Available Study Resources on Quizplus for this Chatper
43 Verified Questions
43 Flashcards
Source URL: https://quizplus.com/quiz/79861
Sample Questions
Q1) When the number of repetitions are known in advance,you should use a ___________ statement.
A)while B)do while C)for D)None of the above

Answer: C
Q2) Boolean expressions are used to control branch and loop statements.
A)True
B)False Answer: True
Q3) What would be the output of the code in #1 if number was originally initialized to 25? Answer: The condition evaluated to false!
Q4) An if-else statement chooses between two alternative statements based on the value of a Boolean expression.
A)True
B)False Answer: True
To view all questions and flashcards with answers, click on the resource link above. Page 5

Chapter 4: Defining Classes I
Available Study Resources on Quizplus for this Chatper
44 Verified Questions
44 Flashcards
Source URL: https://quizplus.com/quiz/79860
Sample Questions
Q1) Boolean expressions may be used to control if-else or while statements.
A)True
B)False
Q2) Write a method called Greeting that displays a personalized greeting given a first name.
Q3) The new operator:
A)allocates memory
B)is used to create an object of a class
C)associates an object with a variable that names it.
D)All of the above.
Q4) Inside a Java method definition,you can use the keyword this as a name for the calling object.
A)True
B)False
Q5) Write a method called power the computes x<sup>n</sup> where x and n and positive integers.The method has two integer parameters and returns a value of type long.
Q6) Only the default constructor has the this parameter.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 6
Chapter 5: Defining Classes Ii
Available Study Resources on Quizplus for this Chatper
46 Verified Questions
46 Flashcards
Source URL: https://quizplus.com/quiz/79859
Sample Questions
Q1) All versions of Java support automatic boxing.
A)True
B)False
Q2) Static variables are often used:
A)in arithmetic expressions
B)to communicate between objects
C)within looping structures
D)all of the above
Q3) Write ONE Java statement that computes and displays the value of 2<sup>5</sup>.
Q4) A main method can be placed inside a class definition.
A)True
B)False
Q5) All of the following are wrapper classes except:
A)String
B)Integer
C)Character
D)Double
Q6) Primitive types are reference types.
A)True
B)False

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

Chapter 6: Arrays
Available Study Resources on Quizplus for this Chatper
47 Verified Questions
47 Flashcards
Source URL: https://quizplus.com/quiz/79858
Sample Questions
Q1) The correct syntax for passing an array as an argument in a method is:
A)a[]
B)a()
C)a
D)a[0]..a[a.length]
Q2) A variable of an enumerated type can have the special value null.
A)True
B)False
Q3) You can only use array indexed variables as arguments to methods.
A)True
B)False
Q4) A method can not change the values stored in the indexed variables of an array argument.
A)True
B)False
Q5) An array with more than one index is called a/an:
A)partially filled array
B)multidimensional array
C)bidirectional array
D)one dimensional array
To view all questions and flashcards with answers, click on the resource link above. Page 8

Chapter 7: Inheritance
Available Study Resources on Quizplus for this Chatper
43 Verified Questions
43 Flashcards
Source URL: https://quizplus.com/quiz/79857
Sample Questions
Q1) A method or instance variable modified by protected:
A)can not be accessed by name inside its own class definitions.
B)can not be accessed by name inside any class derived from it.
C)can not be accessed by name in the definition of any class in the same package.
D)can not be accessed by name in any other class (that is,other than classes named in a-c.).
Q2) The keyword extends indicates polymorphism.
A)True
B)False
Q3) A constructor for a derived class begins with an invocation of a constructor for the base class.
A)True
B)False
Q4) What is an "is a" relationship? How does it apply to the world of objects?
Q5) A base class is synonymous with a:
A)Child class
B)Parent class
C)Derived class
D)Sub class
To view all questions and flashcards with answers, click on the resource link above. Page 9

Chapter 8: Console Input and Output
Available Study Resources on Quizplus for this Chatper
43 Verified Questions
43 Flashcards
Source URL: https://quizplus.com/quiz/79856
Sample Questions
Q1) An abstract method serves as a placeholder for a method that must be defined in all derived classes.
A)True
B)False
Q2) ____________ refers to the process of associating a method definition with a method invocation.
A)Binding
B)Encapsulation
C)Inheritance
D)Polymorphism
Q3) Assigning an object of a derived class to a variable of a base class is called:
A)static binding
B)dynamic binding
C)upcasting
D)downcasting
Q4) Assigning an object of an ancestor class to a descendent class is called:
A)static binding
B)dynamic binding
C)upcasting
D)downcasting
To view all questions and flashcards with answers, click on the resource link above. Page 10
Chapter 9: Exception Handling
Available Study Resources on Quizplus for this Chatper
45 Verified Questions
45 Flashcards
Source URL: https://quizplus.com/quiz/79855
Sample Questions
Q1) All exceptions are descendants of the class:
A)Throwable
B)Catchable
C)Tryable
D)Blockable
Q2) Define an exception class called DiskDriveNotReady.The class should have a constructor with no parameters.If an exception is thrown with this zero-argument constructor,getMessage should return "Disk Drive Not Ready!" The class should also have a constructor with a single parameter of type String.If an exception is thrown with this constructor,then getMessage returns the value that was used as an argument to the constructor.
Q3) In event-driven programming,sending an event is called firing the event.
A)True
B)False
Q4) Revise the program in number 9 above to throw a NegativeNumberException if the user enters a negative number.
Q5) Exceptions that must follow the Catch or Declare Rule are often called unchecked exceptions.
A)True
B)False

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

Chapter 10: File IO
Available Study Resources on Quizplus for this Chatper
46 Verified Questions
46 Flashcards
Source URL: https://quizplus.com/quiz/79874
Sample Questions
Q1) The scanner class has a series of methods that checks to see if there is any more well-formed input of the appropriate type.These methods are called __________ methods:
A)nextToken
B)hasNext
C)getNext
D)testNext
Q2) In Java,when you open a text file you should account for a possible:
A)FileNotFoundException
B)FileFullException
C)FileNotReadyException
D)all of the above
Q3) What happens when the method close is invoked on a stream?
Q4) The output stream connected to the computer screen is:
A)System.exit
B)System.quit
C)System.in
D)System.out
Q5) Write a complete Java program using a Scanner object that opens a file named autos.txt and displays each line to the screen.
To view all questions and flashcards with answers, click on the resource link above. Page 12

Chapter 12: Uml and Patterns
Available Study Resources on Quizplus for this Chatper
22 Verified Questions
22 Flashcards
Source URL: https://quizplus.com/quiz/79872
Sample Questions
Q1) Class diagrams must contain all class members.
A)True
B)False
Q2) The first section of a UML class diagram specifies the:
A)class members
B)class name
C)class methods
D)class modifiers
Q3) Draw a UML class diagram for a class that represents a savings account.
Q4) Draw a UML class diagram for a class that represents a sphere.
Q5) An example of a container is a/an:
A)array
B)vector
C)linked list
D)all of the above
Q6) The Adaptor pattern transforms one class into a different class without changing the underlying class.
A)True
B)False
Q7) Define pseudocode.
To view all questions and flashcards with answers, click on the resource link above. Page 13

Chapter 13: Interfaces and Inner Classes
Available Study Resources on Quizplus for this Chatper
32 Verified Questions
32 Flashcards
Source URL: https://quizplus.com/quiz/79871
Sample Questions
Q1) The Comparable interface is in the ______________ package.
A)java.util
B)java.io
C)java.awt
D)java.lang
Q2) The method that must be implemented in a class using the Comparable interface is:
A)public Object compareTo(Object other)
B)public Boolean compareTo(Object other)
C)public int compareTo(Object other)
D)none of the above
Q3) If an inner class contains non static members,then the class name must be modified by the keyword:
A)Final
B)Static
C)Void
D)Protected
Q4) What is an anonymous class?
Q5) What are the obligations of a class that implements a specific interface?
Q6) What are two advantages to using inner classes?
Page 14
To view all questions and flashcards with answers, click on the resource link above.

Chapter 14: Generics and the Arraylist Class
Available Study Resources on Quizplus for this Chatper
31 Verified Questions
31 Flashcards
Source URL: https://quizplus.com/quiz/79870
Sample Questions
Q1) You can plug in a primitive type for a type parameter.
A)True
B)False
Q2) When using ArrayLists the method _______ can be used to save memory:
A)trimToSize()
B)trimDown()
C)trimOff()
D)None of the above
Q3) The Java standard libraries have a class named ___________ that behaves almost exactly the same as the class ArrayList.
A)Array
B)Container
C)Vector
D)All of the above
Q4) All of the following are memory management methods of the ArrayList class except:
A)ensureCapacity()
B)clear()
C)isEmpty()
D)trimToSize()
To view all questions and flashcards with answers, click on the resource link above. Page 15

Chapter 15: Linked Data Structures
Available Study Resources on Quizplus for this Chatper
43 Verified Questions
43 Flashcards
Source URL: https://quizplus.com/quiz/79869
Sample Questions
Q1) Redraw the diagram created in number 3 above,after deleting the node containing Chicago.
Q2) A node contains:
A)data item(s)
B)reference(s)to another node
C)both A and B
D)none of the above
Q3) What is the binary search tree storage rule?
Q4) Given the Node class created in number 6 above,write Java statements to delete a node from the beginning of the list.
Q5) A binary tree has exactly _________ link instance variables.
A)zero
B)one
C)two
D)three
Q6) Linked lists introduce the possibility of a privacy leak occurring.
A)True
B)False
Q7) What is the result of a postorder traversal of the binary search tree created in question 12 above?
To view all questions and flashcards with answers, click on the resource link above. Page 16
Chapter 16: Collections and Iterators
Available Study Resources on Quizplus for this Chatper
44 Verified Questions
44 Flashcards
Source URL: https://quizplus.com/quiz/79868
Sample Questions
Q1) Write a Java statement to recover the unused memory in the resulting vector in number 4 above.
Q2) How can one retrieve all the values of a HashMap object?
Q3) All of the following methods are part of the Collection<T> interface except:
A)Contains()
B)toArray()
C)retainAll()
D)toString()
Q4) Write a Java statement that changes the value of element 27 to 5.0 in the resulting vector in number 3 above.
Q5) What must you do before adding a primitive type to a vector?
Q6) The number of entries that may be added to a HashMap<K,V> object is limited to what is specified as the initial capacity in the constructor for the HashMap<K,V> object.
A)True
B)False
Q7) A collection is a data structure for holding elements.
A)True
B)False

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

Chapter 17: Swing I
Available Study Resources on Quizplus for this Chatper
37 Verified Questions
37 Flashcards
Source URL: https://quizplus.com/quiz/79867
Sample Questions
Q1) A ____________ is the smallest unit of space on which your screen can write.
A)pixel
B)dot
C)bit
D)font
Q2) The _______________ manager arranges components in a two-dimensional table with some number of rows and columns.
A)BorderLayout
B)FlowLayout
C)GridLayout
D)AbsoluteLayout
Q3) A _____________ is an object that is a simple container class that groups other objects.
A)JPanel
B)JMenu
C)JButton
D)JTextArea
Q4) Write a Java statement to add a title to the window in the GUI created in number 1 above that says "First Window".
Q5) Explain the model-view-controller pattern when applied to a typical GUI.
Page 18
To view all questions and flashcards with answers, click on the resource link above.

Chapter 18: Swing II
Available Study Resources on Quizplus for this Chatper
31 Verified Questions
31 Flashcards
Source URL: https://quizplus.com/quiz/79866
Sample Questions
Q1) When the user clicks any of the three standard JFrame buttons,a ___________ is generated.
A)window listener
B)window event
C)window activator
D)window deactivator
Q2) Java uses a coordinate system whose origin point (0,0)is located at the upper-left corner of the screen area.
A)True
B)False
Q3) If the policies for scroll bars are never set then the scroll bars will never be visible.
A)True
B)False
Q4) The paint method of the Graphics class can only be used with Applets.
A)True
B)False
Q5) The dispose method of the JFrame class terminates a Java program.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 19

Chapter 19: Java Never Ends
Available Study Resources on Quizplus for this Chatper
18 Verified Questions
18 Flashcards
Source URL: https://quizplus.com/quiz/79865
Sample Questions
Q1) A thread's start method invokes the thread's run method.
A)True
B)False
Q2) Java's Thread class is in the ____________ package.
A)java.util
B)java.thread
C)java.lang
D)javax.swing
Q3) SQL stands for Structured Query Language.
A)True
B)False
Q4) What other programming technique can be combined with sockets so a server can handle requests from multiple clients?
Q5) What are Enterprise JavaBeans?
Q6) The Java library that supports database connectivity is called:
A)ODBC
B)CDBC
C)MDBC
D)JDBC
Q7) What is a JavaBean?
To view all questions and flashcards with answers, click on the resource link above. Page 20

Chapter 11: Recursion
Available Study Resources on Quizplus for this Chatper
43 Verified Questions
43 Flashcards
Source URL: https://quizplus.com/quiz/79873
Sample Questions
Q1) Explain how the binary search works.
Q2) Write a recursive method to compute the power of x<sup>n</sup> for non-negative n.
Q3) Binary search is a divide and conquer algorithm.
A)True
B)False
Q4) Regarding recursion,if a base case is never reached the result is:
A)infinite recursion
B)iteration
C)termination
D)all of the above
Q5) The underlying data structure used by the computer during recursion is a:
A)queue
B)linked list
C)tree
D)stack
Q6) A stack is a last-in/first-out memory structure.
A)True
B)False
Q7) Explain the concept of divide and conquer.
To view all questions and flashcards with answers, click on the resource link above. Page 21

Chapter 20: Applets
Available Study Resources on Quizplus for this Chatper
25 Verified Questions
25 Flashcards
Source URL: https://quizplus.com/quiz/79863
Sample Questions
Q1) The class ___________ converts a digital picture to an icon for us in an applet.
A)ImageIcon
B)JAppletIcon
C)IconImage
D)IconJApplet
Q2) An HTML comment is delimited by:
A)< // / >
B)< !-- -- >
C)< ?-- -- >
D)< !- - >
Q3) URL stands for:
A)Unified Resource Locator
B)Uniform Reader Locator
C)Uniform Resource Locator
D)Uniform Resource Language
Q4) Applets do not support JMenus.
A)True
B)False
Q5) Write a complete Java applet that displays the phrase "Welcome to my world!" in the center of the applet.
To view all questions and flashcards with answers, click on the resource link above. Page 22