

Computer Science II
Final Exam
Course Introduction
Computer Science II builds on foundational programming concepts introduced in introductory computer science courses. This course focuses on advanced programming techniques, data structures (such as lists, stacks, queues, trees, and hash tables), and algorithm design. Students learn object-oriented programming principles, recursion, searching and sorting algorithms, and software development best practices. Through hands-on projects and exercises, learners develop problem-solving skills and gain experience working on more complex programming assignments, preparing them for further study in computer science and software engineering.
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) The syntax that declares a Java named constant named SALES_TAX is:
A)double SALES_TAX = 7.50;
B)public double SALES_TAX = 7.50;
C)public static double SALES_TAX = 7.50;
D)public static final double SALES_TAX = 7.50;
Answer: D
Q2) The value of the expression (int)27.6 evaluates to:
A)28
B)27
C)26
D)None of the above.

Answer: B
Q3) Java uses the ASCII character set.
A)True
B)False
Answer: False
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) The Java method printf is based on the ________ language.
A)Pascal
B)C++
C)C
D)ADA
Answer: C
Q2) The method printf is used the same way as the method println but has the added feature that allows you to add formatting instructions.
A)True
B)False
Answer: False
Q3) The statement: System.out.printf("%6.2f",597.7231); displays:
A)597.723
B)597.72
C)000597.72
D)None of the above

Answer: B
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) In a switch statement,the default case is always executed.
A)True
B)False
Answer: False
Q2) Write Java code that uses a do while loop that prints even numbers from 2 through 10.
Answer: int evenNumber = 2; do { System.out.println(evenNumber); evenNumber += 2; }while(evenNumber <= 10);
Q3) The equality operator (==)may be used to test if two string objects contain the same value.
A)True
B)False
Answer: False
Q4) To terminate a program,use the Java statement:
A)System.quit(0);
B)System.end(0);
C)System.abort(0);
D)System.exit(0);
Answer: D

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

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) A set method is:
A)an accessor method
B)a mutator method
C)a recursive method
D)none of the above
Q3) Define the terms arguments and parameters.How are they different?
Q4) A method that performs some action other than returning a value is called a __________ method.
A)null
B)void
C)public
D)private
Q5) Java supports operator overloading.
A)True
B)False
Q6) What is the purpose of the new operator?
Q7) Discuss a situation in which it is appropriate to use the this parameter.
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) Write a Java method that returns true if and only if a character is a digit or a letter.The method should display appropriate feedback to the console.
Q2) When used with objects,what is the equality ( == )operator really comparing?
Q3) null can be used:
A)to indicate a variable has no real value
B)in a Boolean expression with ==
C)as a placeholder
D)all of the above
Q4) Static variables are often used:
A)in arithmetic expressions
B)to communicate between objects
C)within looping structures
D)all of the above
Q5) What is the purpose of Java's wrapper classes?
Q6) Wrapper classes provide a class type corresponding to each of the primitive types so that you can have class types that behave somewhat like primitive types.
A)True
B)False
Q7) Explain how a package is named in Java.
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) A ________ loop is a good way to step through the elements of an array and perform some program action on each indexed variable.
A)while
B)do while
C)for
D)all of the above
Q2) An ArrayIndexOutOfBounds error is a:
A)compiler error
B)syntax error
C)logic error
D)all of the above
Q3) Which of the following initializer lists correctly initializes the indexed variables of an array named myDoubles?
A)double myDoubles[double] = {0.0,1.0,1.5,2.0,2.5};
B)double myDoubles[5] = new double(0.0,1.0,1.5,2.0,2.5);
C)double[] myDoubles = {0.0,1.0,1.5,2.0,2.5};
D)array myDoubles[double] = {0.0,1.0,1.5,2.0,2.5};
Q4) Explain what the main methods array parameter,args,is used for.
Q5) What are three ways you can use the square brackets [ ] with an array name?
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) Overriding is when a derived class redefines a method from the base class.
A)True
B)False
Q2) The keyword extends indicates:
A)encapsulation
B)polymorphism
C)inheritance
D)none of the above
Q3) You may substitute the keyword this for super()to call a constructor of the derived class.
A)True
B)False
Q4) A derived class is a class defined by adding instance variables and methods to an existing class.
A)True
B)False
Q5) What is an "is a" relationship? How does it apply to the world of objects?
Q6) What is a "has a" relationship?
Q7) What are the different ways in which you can check the class of an Object?
Q8) Explain the modifiers public,protected and private.
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) A class with no abstract methods is called a
A)concrete class
B)encapsulated class
C)abstract class
D)private class
Q2) What is wrong with the following method definition? public abstract void doSomething(int count)
Q3) Assigning an object of an ancestor class to a descendent class is called:
A)static binding
B)dynamic binding
C)upcasting
D)downcasting
Q4) An abstract class must have the modifier ___________ included in the class heading.
A)static
B)abstract
C)final
D)private
Q5) Write a decision statement to determine if an object should be downcast.
Q6) Derive a class named Boots from the base class created in number 9 above.
Page 10
To view all questions and flashcards with answers, click on the resource link above.

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) When defining your own exception class,you extend an existing exception class.This is an example of:
A)polymorphism
B)encapsulation
C)inheritance
D)all of the above
Q2) Use a catch block to display the exception thrown in number one above.
Q3) Revise the program in number 8 above to use a try/catch block to handle the IOException.
Q4) Which circumstance is an exception to the catch or declare rule?
A)Exceptions that result from errors of some sort.
B)Exceptions that are descendents of the class RuntimeException.
C)Both A and B
D)None of the above
Q5) Define an exception class called FileNotFoundException.The class should have a constructor with no parameters.If an exception is thrown with this zero-argument constructor,getMessage should return "File Not Found!" 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.
To view all questions and flashcards with answers, click on the resource link above. Page 11

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 methods of the scanner class do not behave the same when reading from a text file as they do when used to read from the keyboard.
A)True
B)False
Q2) A __________ path name gives the path to a file,starting with the directory that the program is in.
A)relative
B)descendant
C)full
D)complete
Q3) Write a Java statement that creates an output stream to a binary file named statistics.dat.
Q4) All of the following are methods of the File class except:
A)exists()
B)delete()
C)getDirectory()
D)getName()
Q5) Write a Java statement to create an input stream to a file named "statistics.dat".
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) In a UML class diagram,the minus (-)indicates:
A)public access
B)protected access
C)private access
D)package access
Q2) In a quick sort algorithm,a value called a splitting value is an arbitrarily selected value from the array to sort.
A)True
B)False
Q3) Pseudocode is a mixture of programming language and English.
A)True
B)False
Q4) Define pseudocode.
Q5) Draw a UML class diagram for a class that represents a sphere.
Q6) Any construct that allows you to cycle through all the items in a container is an iterator.
A)True
B)False
Q7) Draw a UML inheritance diagram for possible classes used to represent a bank account.
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) Inner and outer classes do not have access to each other's private members.
A)True
B)False
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) Inner classes available outside the scope of their outer class are modified by the keyword:
A)Public
B)Private
C)Protected
D)Package access
Q4) Any constant variables defined in an interface must be defined as:
A)public
B)private
C)protected
D)package access
To view all questions and flashcards with answers, click on the resource link above. Page 14

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) What is a parameterized class?
Q2) The Type parameter is always indicated as a T.
A)True
B)False
Q3) You can plug in a primitive type for a type parameter.
A)True
B)False
Q4) All of the following are memory management methods of the ArrayList class except:
A)ensureCapacity()
B)clear()
C)isEmpty()
D)trimToSize()
Q5) Which is the correct syntax for placing the string "boat" into an ArrayList name recVehicles in position 3 for the first time?
A)recVehicles.set(3,"boat"); B)recVehicles.set("boat",3); C)recVehicles.add(3,"boat"); D)recVehicles.add("boat",3);
Q6) What are the three main disadvantages of an ArrayList?
15
To view all questions and flashcards with answers, click on the resource link above.

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) following values in the given order: 7,10,5,12,1,3,9.
Q2) Java does not come with a LinkedList library class.
A)True
B)False
Q3) Given the Node class created in number 6 above,write Java statements to insert a new node containing (Chattanooga,23.7)into an empty list.
Q4) Making the Node class a private inner class of a linked data structure is an example of:
A)polymorphism
B)encapsulation
C)inheritance
D)all of the above
Q5) A ____________ copy of an object is a copy that has no references in common with the original object.
A)bit copy
B)deep copy
C)shallow copy
D)none of the above
Q6) Discuss the differences between a queue and a stack.
Page 16
To view all questions and flashcards with answers, click on the resource link above.

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) All of the following are methods of the Iterator interface except:
A)clear()
B)hasNext()
C)next()
D)remove()
Q2) All Collection classes are part of the java.util package.
A)True
B)False
Q3) The interface SortedSet and the concrete class _________ is designed for implementations of the Set interface that provide for rapid retrieval of elements.
A)Vector< T >
B)LinkedList< T >
C)HashSet< T >
D)TreeSet< T >
Q4) The method contains(Object o)of the ArrayList class returns a value of type:
A)int
B)char
C)byte
D)boolean
Q5) Compare and contrast vectors and arrays.
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) The JFrame method setVisible()takes one argument of type:
A)byte
B)boolean
C)int
D)short
Q2) A programming style that uses a signal and response approach to programming is called:
A)Object Oriented Programming
B)Structured Programming
C)Event-driven Programming
D)Bottom-up Programming
Q3) Write a Java statement to add a title to the window in the GUI created in number 1 above that says "First Window".
Q4) The _____________ manager places components into five regions.
A)BorderLayout
B)FlowLayout
C)GridLayout
D)AbsoluteLayout
Q5) Explain the model-view-controller pattern when applied to a typical GUI.
Q6) Write Java statements to add the menu created in number 7 above to the menu bar.
To view all questions and flashcards with answers, click on the resource link above. Page 18

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) A rounded rectangle is a rectangle whose corners have been replaced by arcs.
A)True
B)False
Q2) All of the following are methods of the Graphics class except:
A)drawRect
B)fillRect
C)coloredRect
D)fill3DRect
Q3) The Graphics class is a(n)____________ class.
A)discrete
B)concrete
C)abstract
D)none of the above
Q4) The class JFrame has a method named __________ that eliminates the invoking JFrame without terminating the program.
A)close
B)dispose
C)eliminate
D)None of the above
Q5) Set policies for the scroll bar created in number 3 above.
Page 19
To view all questions and flashcards with answers, click on the resource link above.

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) What method in the Thread class is responsible for pausing a thread for a specific amount of milliseconds?
A)pause()
B)sleep()
C)hang()
D)kill()
Q2) Threads execute in a ___________ fashion.
A)parallel
B)serial
C)complex
D)none of the above
Q3) SQL stands for Structured Query Language.
A)True
B)False
Q4) The sleep method of the Thread class requires one formal parameter that represents the number of:
A)nanoseconds
B)microseconds
C)picoseconds
D)milliseconds
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) To keep track of recursion most computer systems us a structure called a queue.
A)True
B)False
Q3) All recursive methods have a/an ____________ equivalent method.
A)Iterative
B)Selective
C)Inherited
D)None of the above
Q4) A base case must include a recursive call.
A)True
B)False
Q5) Explain how a sequential search works.
Q6) When defining recursive void methods you should:
A)Ensure there is no infinite recursion.
B)Ensure that each stopping case performs the correct action for that case.
C)Ensure that if all recursive calls perform their actions correctly,then the entire case performs correctly.
D)All of the above
Q7) What are the two base cases for a recursive binary search algorithm?
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) Images can be embedded within HTML pages.
A)True
B)False
Q2) Write a complete Java applet that displays the phrase "Welcome to my world!" in the center of the applet.
Q3) HTML is case sensitive.
A)True
B)False
Q4) URL stands for:
A)Unified Resource Locator
B)Uniform Reader Locator
C)Uniform Resource Locator
D)Uniform Resource Language
Q5) Applets do not support JMenus.
A)True
B)False
Q6) Create an HTML block that will display "Absolute Java" in the largest standard heading.
Q7) Create an HTML page for the applet created in number 4 above (the class file is named myApplet.class).
To view all questions and flashcards with answers, click on the resource link above. Page 22