

Intermediate Programming with Java Exam Bank
Course Introduction
Intermediate Programming with Java builds upon foundational programming skills to deepen students understanding of Java as an object-oriented language. This course explores complex data structures, event-driven programming, exception handling, file input/output, and the development of graphical user interfaces. Emphasis is placed on software design principles, code organization, and debugging strategies. Students will apply their knowledge through the completion of hands-on projects and collaborative assignments, preparing them for more advanced topics in software development.
Recommended Textbook
Starting Out with Java From Control Structures through Data Structures 2nd Edition by Tony Gaddis
Available Study Resources on Quizplus
22 Chapters
981 Verified Questions
981 Flashcards
Source URL: https://quizplus.com/study-set/3640

Page 2
Chapter 1: Introduction to Computers and Java
Available Study Resources on Quizplus for this Chatper
42 Verified Questions
42 Flashcards
Source URL: https://quizplus.com/quiz/72352
Sample Questions
Q1) An operating system can be categorized according to:
A) The number of users they can accommodate
B) The number of tasks they can perform at one time
C) Both of the above
D) Neither of the above
Answer: C
Q2) One of the design tools used by programmers when creating a model of the program is:
A) Disk drive
B) Compiler
C) ALU
D) Pseudocode
Answer: D
Q3) Java source files end with the .class extension.
A)True
B)False
Answer: False
To view all questions and flashcards with answers, click on the resource link above.

Page 3
Chapter 2: Java Fundamentals
Available Study Resources on Quizplus for this Chatper
53 Verified Questions
53 Flashcards
Source URL: https://quizplus.com/quiz/72353
Sample Questions
Q1) What is the result of the following expression? 17 % 3 * 2 - 12 + 15
A) 7
B) 8
C) 12
D) 105
Answer: A
Q2) When saving a Java source file,save it with an extension of
A) .javac
B) .class
C) .src
D) .java
Answer: D
Q3) Assuming that pay has been declared a double,the following statement is valid. pay = 2,583.44;
A)True
B)False
Answer: False
To view all questions and flashcards with answers, click on the resource link above.

Page 4
Chapter 3: Decision Structures
Available Study Resources on Quizplus for this Chatper
52 Verified Questions
52 Flashcards
Source URL: https://quizplus.com/quiz/72354
Sample Questions
Q1) What will be the value of ans after the following code has been executed? int ans = 10;
Int x = 65;
Int y = 55; If (x >= y)
Ans = x + y;
A) 10
B) 120
C) 100
D) No value,there is a syntax error
Answer: B
Q2) When two Strings are compared using the compareTo method,the cases of the two strings are not considered.
A)True
B)False
Answer: False
To view all questions and flashcards with answers, click on the resource link above.

Page 5

Chapter 4: Loops and Files
Available Study Resources on Quizplus for this Chatper
48 Verified Questions
48 Flashcards
Source URL: https://quizplus.com/quiz/72355
Sample Questions
Q1) What will be the value of x after the following code is executed? int x,y = 4,z = 6; X = (y++)* (++z);
A) 24
B) 28
C) 30
D) 35
Q2) Which of the following will open a file named MyFile.txt and allow you to read data from it?
A) File file = new File("MyFile.txt");
B) Scanner inputFile = new Scanner("MyFile.txt");
C) File file = new File("MyFile.txt");
Scanner inputFile = new Scanner(file);
D) PrintWriter inputFile = new PrintWriter("MyFile.txt");
Q3) You can use this method to determine whether a file exists.
A) The Scanner class's exists method
B) The File class's exists method
C) The File class's canOpen method
D) The PrintWriter class's fileExists method
To view all questions and flashcards with answers, click on the resource link above.

Chapter 5: Methods
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/72356
Sample Questions
Q1) Assume that the following method header is for a method in class A. public void displayValue(int value)
Assume that the following code segments appear in another method,also in class A.Which contains a legal call to the displayValue method?
A) int x = 7; Void displayValue(x);
B) int x = 7; DisplayValue(x);
C) int x = 7; DisplayValue(int x);
D) int x = 7; DisplayValue(x)
Q2) Which of the following is included in a method call?
A) return type
B) method modifiers
C) parentheses
D) return variable
Q3) A value-returning method can return a reference to a non-primitive type.
A)True B)False
To view all questions and flashcards with answers, click on the resource link above. Page 7

Chapter 6: A First Look at Classes
Available Study Resources on Quizplus for this Chatper
49 Verified Questions
49 Flashcards
Source URL: https://quizplus.com/quiz/72357
Sample Questions
Q1) Look at the following statement. import java.util.*;
This is an example of
A) a wildcard import
B) an explicit import
C) unconditional import
D) conditional import
Q2) After the header,the body of the method appears inside a set of
A) brackets,[]
B) paretheses, ()
C) braces,{}
D) double quotes,""
Q3) A constructor
A) always accepts two arguments
B) has return type of void
C) has the same name as the class
D) always has an access specifier of private
Q4) The public access specifier for a field indicates that the attribute may not be accessed by statements outside the class.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 8

Chapter 7: A First Look at Gui Applications
Available Study Resources on Quizplus for this Chatper
49 Verified Questions
49 Flashcards
Source URL: https://quizplus.com/quiz/72358
Sample Questions
Q1) A GUI program automatically stops executing when the end of the main method is reached.
A)True
B)False
Q2) The System.exit method will end the application.
A)True
B)False
Q3) This layout manager arranges components in regions named North,South,East,West,and Center.
A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
Q4) To use the Color class,which is used to set the foreground and background of various objects,use the following import statement
A) import java.swing;
B) import java.awt;
C) import java.awt.*;
D) import java.awt.event.*;
To view all questions and flashcards with answers, click on the resource link above. Page 9

Chapter 8: Arrays and the Arraylist Class
Available Study Resources on Quizplus for this Chatper
52 Verified Questions
52 Flashcards
Source URL: https://quizplus.com/quiz/72359
Sample Questions
Q1) What do you normally use with a partially-filled array?
A) A class that does nothing but manage the array
B) An accompanying parallel array
C) An accompanying integer value that holds the number of items stored in the array
D) An accumulator
Q2) What will be the value of x[1] after the following code is executed? int[] x = {22,33,44}; ArrayProcess(x[1]); )..
Public static void arrayProcess(int a)
{ A = a + 5;
}
A) 27
B) 33
C) 38
D) 49
To view all questions and flashcards with answers, click on the resource link above.

Chapter 9: A Second Look at Classes and Objects
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/72360
Sample Questions
Q1) What will be returned from a method,if the following is the method header: public Rectangle getRectangle()
A) An object of the class Rectangle
B) The address of an object of the class Rectangle
C) The values stored in the data members of the Rectangle object the method changed
D) A graph of a rectangle
Q2) The term for the relationship created by object aggregation is
A) Has a
B) Is a
C) Sub-class object
D) Inner class
Q3) When a field is declared static,there will be
A) a copy of the field in each class object
B) only one copy of the field in memory
C) a copy of the field for each static method in the class
D) only two copies of the field in memory
Q4) Enum constants have a toString method.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 11

Chapter 10: Text Processing and More About Wrapper Classes
Available Study Resources on Quizplus for this Chatper
49 Verified Questions
49 Flashcards
Source URL: https://quizplus.com/quiz/72361
Sample Questions
Q1) What will be the value of str after the following statements are executed? StringBuilder str = New StringBuilder("We have lived in Chicago," + "Trenton,and Atlanta."); Str)replace(17,24,"Tampa");
A) We have lived in Tampa,Trenton,and Atlanta.
B) We have lived in Chicago,Tampa,and Atlanta.
C) We have lived in Tampa Trenton,and Tampa.
D) We have lived in Tampalanta.
Q2) Look at the following code. Integer myNumber; MyNumber = 5; Which of the following is true about the second statement?
A) It results in an error because you cannot assign a primitive type to a wrapper class object.
B) The statement performs autoboxing.
C) The statement performs unboxing.
D) The statement performs autowrapping.
Q3) You must call a method to get the value of a wrapper class object. A)True B)False
Page 12
To view all questions and flashcards with answers, click on the resource link above.

Chapter 11: Inheritance
Available Study Resources on Quizplus for this Chatper
49 Verified Questions
49 Flashcards
Source URL: https://quizplus.com/quiz/72362
Sample Questions
Q1) If a superclass does not have a default constructor or a no-arg constructor,
A) then a class that inherits from it,must initialize the superclass values.
B) then a class that inherits from it,must call one of the constructors that the superclass does have.
C) then a class that inherits from it,does not inherit the data member fields from the superclass.
D) then a class that inherits from it,must contain the default constructor for the superclass.
Q2) If ClassC extends ClassB,which extends ClassA,this would be an example of
A) multiple inheritance.
B) a chain of inheritance.
C) a family tree.
D) packaging.
Q3) When one object is a specialized version of another object,there is this type of relationship between them.
A) "has a"
B) "is a"
C) direct
D) "contains a"
To view all questions and flashcards with answers, click on the resource link above.
Page 13

Chapter 12: Exceptions and Advanced File Io
Available Study Resources on Quizplus for this Chatper
46 Verified Questions
46 Flashcards
Source URL: https://quizplus.com/quiz/72363
Sample Questions
Q1) All of the exceptions that you will handle are instances of classes that extend this class.
A) RunTimeException
B) IOException
C) Error
D) Exception
Q2) When an object is serialized,it is converted into a series of bytes that contain the object's data.
A)True
B)False
Q3) When the code in a try block may throw more than one type of exception,you need to write a catch clause for each type of exception that could potentially be thrown.
A)True
B)False
Q4) A class must implement the Serializable interface in order for objects of the class to be serialized.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 14
Chapter 13: Advanced Gui Applications
Available Study Resources on Quizplus for this Chatper
46 Verified Questions
46 Flashcards
Source URL: https://quizplus.com/quiz/72364
Sample Questions
Q1) Which of the following assigns ALT+C as a mnemonic key for the JButton object,clearButton?
A) clearButton.addMnemonic(KeyEvent.VK_C);
B) clearButton.setMnemonic(KeyEvent.C);
C) clearButton.setMnemonic(KeyEvent.VK_C);
D) clearButton.assignMnemonic(KeyEvent.VK_C);
Q2) What does the following statement do? JTextArea textField = JTextArea(message,25,15);
A) It creates a text area with 25 columns and 15 rows that will initially display the text stored in the String object message.
B) It creates a text area with 25 columns and 15 rows that will initially display the text stored in the text area textField.
C) It creates a text area with 25 rows and 15 columns that will initially display the text stored in the String object message.
D) It creates a text area with 25 rows and 15 columns that will initially display the text "message".
To view all questions and flashcards with answers, click on the resource link above.

15

Chapter 14: Applets and More
Available Study Resources on Quizplus for this Chatper
39 Verified Questions
39 Flashcards
Source URL: https://quizplus.com/quiz/72365
Sample Questions
Q1) The browser creates an instance of the applet class automatically.
A)True
B)False
Q2) In an HTML document,the tags
A) instruct the Web browser how to format the text.
B) instruct the Web browser where to place images.
C) instruct the Web browser what to do when the user clicks on a link.
D) All of the above
Q3) An applet using a Swing GUI extends which class?
A) Applet
B) JApplet
C) JSwing
D) JFrame
Q4) When the applet viewer opens an HTML document with more than one < APPLET > tag,
A) it terminates immediately.
B) it displays the first applet,and then terminates.
C) it displays each applet in a separate window.
D) it displays each applet in order in the same window.
To view all questions and flashcards with answers, click on the resource link above. Page 16

Chapter 15: Recursion
Available Study Resources on Quizplus for this Chatper
34 Verified Questions
34 Flashcards
Source URL: https://quizplus.com/quiz/72366
Sample Questions
Q1) If Method A calls Method B which in turn calls Method A,it is called indirect recursion.
A)True
B)False
Q2) Which of the following problems cannot be programmed recursively?
A) Towers of Hanoi
B) Summing a range of array elements
C) Finding the greatest common divisor
D) All of the above can be programmed recursively
Q3) To solve a program recursively,you need to identify at least one case in which the problem can be solved without recursion - this is known as
A) the recursive case.
B) the terminal case.
C) the base case.
D) the final case.
Q4) A problem can be solved recursively if it can be broken down into successive smaller problems that are unique within the overall problem.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.
Chapter 16: Sorting, Searching, and Algorithm Analysis
Available Study Resources on Quizplus for this Chatper
46 Verified Questions
46 Flashcards
Source URL: https://quizplus.com/quiz/72367
Sample Questions
Q1) The insertion sort algorithm works by
A) repeatedly comparing adjacent items and swapping them so smaller values come before larger values
B) repeatedly locating the smallest value in the unsorted portion of the array and moving it toward the lower end of the array
C) repeatedly taking the first value in the unsorted portion of the array and placing it at its proper place in the part of the array that is already sorted
D) partitioning the unsorted portion of the array into two sublists and a pivot and recursively sorting the two sublists
Q2) For a computational problem,the input size
A) is the number of times the program requests input from the user
B) is the number of loop iterations required to read the input
C) is the amount of memory needed to store the input
D) None of the above
To view all questions and flashcards with answers, click on the resource link above.

18

Chapter 17: Generics
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/72368
Sample Questions
Q1) The clause
Catch(Exception< T > e){
}
A) can be used to catch exceptions that are parameterized by type
B) compiles correctly,but is best avoided because of a high runtime overhead
C) compiles correctly,but may throw a ClassCastException of the wrong type is passed
D) None of the above
Q2) The declaration
ArrayList< int > aL = new ArrayList< int >();
A) allows the programmer to create an ArrayList that holds integer types
B) compiles correctly,but causes an exception to be thrown at run time
C) causes a compile-time error
D) compiles and runs correctly,but is not recommended
Q3) Which of the following statements is true?
A) Interfaces may not be generic in Java
B) The keyword implements cannot be used do describe a type parameter that implements an interface
C) a generic class may not have more than one type parameter in its declaration
D) None of the above statements are true.
To view all questions and flashcards with answers, click on the resource link above.
Page 19

Chapter 18: Collections
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/72369
Sample Questions
Q1) A HashMap
A) is a subclass of Map that implements the HashCode interface
B) is a subclass of HashSet that implements the Map interface
C) uses hash codes to store keys
D) None of the above
Q2) Which of the following is true?
A) Both the Set and List interfaces extend the Collection interface
B) Both the Set and Map interfaces extend the Collection interface
C) Both the List and Map interfaces extend the Collection interface
D) None of the above
Q3) Which of the following is true of a HashSet object?
A) Increasing the capacity of the HashSet usually has no effect on the number of collisions
B) The time required to add an element,or search for an element,is unaffected by the number of collisions
C) The time required to add an element,or search for an element,decreases as the number of collisions increases
D) The time required to add an element,or search for an element,increases as the number of collisions increases
To view all questions and flashcards with answers, click on the resource link above.
Page 20

Chapter 19: Array-Based Lists
Available Study Resources on Quizplus for this Chatper
20 Verified Questions
20 Flashcards
Source URL: https://quizplus.com/quiz/72370
Sample Questions
Q1) Assume an array-based list implemented by a class that uses the fields
String [ ] list; int nElements;
to represent the array of elements,and the number of elements currently stored.Show the code for a method String remove(int index)that removes and returns the element at the given index.The method should throw an appropriately named exception if it cannot return the requested element.
Q2) The capacity of an array-based list such as ArrayList
A) is the number of bytes of memory that the list can hold
B) is the number of elements that are currently stored in the list
C) is the size of its internal array
D) None of the above
Q3) Assume an array-based list implemented by a class that uses the fields
String [ ] list; int nElements;
to represent the array of elements,and the number of elements currently stored.Show the code for a method int size( )that returns the current size of the list.
To view all questions and flashcards with answers, click on the resource link above.
Chapter 20: Linked Lists
Available Study Resources on Quizplus for this Chatper
36 Verified Questions
36 Flashcards
Source URL: https://quizplus.com/quiz/72371
Sample Questions
Q1) A linked list is represented by a reference to
A) the first node in the list,unless the list is empty,in which case the reference is set to null B) to the list representation object,which contains a boolean flag set to false when the list is empty
C) the superclass of the list
D) None of the above
Q2) To remove a node with a positive index k from a linked list,
A) decrement k by 1,and set the reference to the node to be removed to null
B) start a reference r at the head of the list,walk r forward k steps,and then set r to null
C) assign the successor reference in the node with index k to the successor reference in the node with index k-1
D) decrement k by 1,and then use recursion
Q3) The tail of a list
A) is an instance of a class that implements the ListTail interface
B) is what you get when take a list and remove its head
C) is a synchronized subclass of the LinkedList class
D) None of the above
To view all questions and flashcards with answers, click on the resource link above.

Page 22
Chapter 21: Stacks and Queues
Available Study Resources on Quizplus for this Chatper
36 Verified Questions
36 Flashcards
Source URL: https://quizplus.com/quiz/72372
Sample Questions
Q1) Compilers of modern programming languages support method calls and returns with an internal
A) priority queue
B) hash set
C) stack
D) queue
Q2) In a queue implementation that uses an array of fixed size,
A) the array must be made so large that the queue will never run out of space
B) it is necessary to use the array as a circular buffer
C) the array must be created from an ArrayList object
D) the queue must implement the List interface
Q3) The stack peek operation
A) checks a stack to see if there are any elements in it
B) removes and returns an item from the stack
C) returns the item at the top of the stack,but does not remove it
D) adds a single item to the stack
To view all questions and flashcards with answers, click on the resource link above.

23

Chapter 22: Binary Trees, Avl Trees, and Priority Queues
Available Study Resources on Quizplus for this Chatper
45 Verified Questions
45 Flashcards
Source URL: https://quizplus.com/quiz/72373
Sample Questions
Q1) Postorder traversal of a binary tree
A) first visits the root,then recursively traverses the left and right subtree
B) recursively traverses the left subtree,then visits the root,then traverses the right subtree
C) recursively traverses the left subtree,then traverses the right subtree,then visits the root
D) visits all the nodes according to their natural order
Q2) A ternary tree is like a binary tree,except each node may have up to three successors.Write a TNode class that can be used to represent a ternary tree.Define a notion of preorder and postorder traversal for ternary trees,and write methods void postorder(TNode tree)and void preorder(TNode tree)that implements your notion of those traversals.
Q3) A binary tree is a collection of nodes in which
A) each node has at most one predecessor and at most one successor
B) each node has at most one predecessor and exactly two successors
C) each node has at most one predecessor and at most two successors
D) each node has at least one predecessor and at most two successors
To view all questions and flashcards with answers, click on the resource link above. Page 24