

![]()


Object-Oriented Programming introduces students to the fundamental concepts and principles of object-oriented software development. The course covers topics such as classes, objects, encapsulation, inheritance, polymorphism, and abstraction. Through hands-on programming assignments and projects, students learn to design and implement modular, reusable, and maintainable code using an object-oriented programming language. Emphasis is placed on problem-solving strategies, understanding design patterns, and applying best practices to build robust applications. By the end of the course, students will have a solid foundation for advancing to more complex software engineering topics.
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
Q1) An identifier can begin with a digit.
A)True
B)False
Answer: False
Q2) In Java, total, ToTal and TOTAL are all different identifiers.
A)True
B)False
Answer: True
Q3) Name the steps to solving a problem as described by your textbook.
Answer: According to the textbook, the five steps to solving a problem are understanding the problem, designing the solution, considering alternatives to the solution and refining the solution, implementing the solution, and testing the solution and fixing any problems that exist.
Q4) What are the primary concepts that support object-oriented programming?
Answer: The primary concepts that support object-oriented programming are objects, attributes, methods, classes, encapsulation, inheritance and polymorphism.
Q5) Write a program that outputs Four Score and Seven Years Ago on six lines, with the words centered relative to each other.
Answer: 11edd9cc_ee20_b559_84e8_3972ed1653d9_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) 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.
Q2) Write an application that prints out the following using a single call to the print method.
Hello!
How are you?
Answer: 11edd9cf_ca49_6acb_84e8_a9c4d430f11e_TB2841_00
Q3) Write a short application that computes the perimeter of a rectangle. It should allow the user to input the length and width of the rectangle as a double.
Answer: 11edd9d0_7281_13b0_84e8_1da514850e2c_TB2841_00
Q4) Java uses the ASCII character set to represent character data. A)True
B)False Answer: False
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) Explain what it means for a String object to be immutable. Are there any workarounds for this?
Answer: String objects are immutable, meaning that once a String object is created, its value cannot be lengthened or shortened, nor can any of its characters change. However, there are several methods in the String class that return new modified String objects. By reassigning the original reference to the result of calling one of these methods, we can effectively change the value of a String object.
Q2) String objects can be changed after instantiation.
A)True
B)False
Answer: False
Q3) What is the range of integers that will be generated by the following expression? generator.nextInt(15) + 5;
Answer: This expression will generate a random number in the range 5 to 19 (inclusive).
Q4) Write a statement that computes the square root of a variable called discriminant and stores the value in a variable called result.
Answer: result = Math.sqrt(discriminant);
To view all questions and flashcards with answers, click on the resource link above.

5

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80254
Sample Questions
Q1) A _______________ loop always executes its loop body at least once.
A) while
B) for C) do
D) repeat
E) There are no loop structures with this property in Java.
Q2) Suppose we wanted to process a text file called "input.txt" using the Scanner object. Which of the following lines of code correctly creates the necessary Scanner object?
A) Scanner inputFile = new Scanner("input.txt");
B) Scanner inputFile = new Scanner(new InputFile("input.txt");
C) Scanner inputFile = new Scanner(new File(input.txt);
D) Scanner inputFile = new Scanner(new InputFile(input.txt);
E) Scanner inputFile = new Scanner(new File("input.txt");
Q3) In a nested if statement an else clause is matched to the closest unmatched if. A)True
B)False
Q4) Write a code fragment that determines how many times the character 'A' appears in a String object called name.
Q5) Write a for loop to print the even numbers from 1 to 100 (inclusive).
To view all questions and flashcards with answers, click on the resource link above. Page 6

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80253
Sample Questions
Q1) 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
Q2) When an object is passed to a method, the actual and formal parameters become aliases.
A)True
B)False
Q3) Aggregation is sometimes described as a has-a relationship.
A)True B)False
Q4) Write a method called containsPair that takes in three integer parameters and returns true if any two of the input parameters are the same.
Q5) A variable can always be referenced anywhere in a program. A)True B)False
To view all questions and flashcards with answers, click on the resource link above. Page 7

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80252
Sample Questions
Q1) Explain the difference between a Grid Layout and a GridBag Layout.
Q2) The grid layout organizes components into a grid of rows and columns, and also allows components to span more than one cell.
A)True
B)False
Q3) Write a short class that represents a panel with a single slider that has values from 0 to 250, with large tick marks in increments of 50 and small tick marks in increments of 10.
Q4) Should a component ever be disabled? Why or why not?
Q5) 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
Q6) Give an example of a common use of a dialog box.
Q7) Describe the areas of a border layout.
Q8) Explain the difference between check boxes and radio buttons.
Page 8
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/80251
Sample Questions
Q1) Suppose we have an array of String objects identified by the variable names. Which of the following for loops will not correctly process each element in the array.
A) for(int i = 0; i < names.length; i++)
B) for(String name : names)
C) for(int i = 0; i < names.length(); i++)
D) none of these will correctly process each element
E) all of these will correctly process each element
Q2) Which of the statements is true about the following code snippet? int[] array = new int[25];
Array[25] = 2;
A) The integer value 2 will be assigned to the last index in the array.
B) The integer value 25 will be assigned to the second index in the array.
C) The integer value 25 will be assigned to the third value in the array.
D) This code will result in a compile-time error.
E) This code will result in a run-time error.
Q3) Write a line of code that initializes a two-dimensional array of integers using an initializer list.
Q4) Write a method called average that accepts an array of floating point numbers and returns their average.
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) Suppose we create a subclass from a class that has a method called someMethod. If we override someMethod in the subclass, is it possible to access the superclass's version of someMethod? If so, how?
Q2) Inheritance should not be considered in the software design process.
A)True
B)False
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) A child class is allowed to declare a variable with the same name as one that is contained in the parent class.
A)True
B)False
Q5) Java supports multiple inheritance.
A)True
B)False
Q6) What is a shadow variable?
Q7) 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) Are there any differences between extending a class and implementing an interface?
Q2) Can references to interface types be polymorphic? Explain.
Q3) In Java, polymorphic references can be created through the use of __________________ and ________________.
A) inheritance, interfaces
B) inheritance, abstract classes
C) interfaces, abstract classes
D) interfaces, iterators
E) none of the above
Q4) Suppose that Horse is a subclass of Animal, and neither class is abstract. Which of the following is an invalid declaration and initialization?
A) Horse h = new Horse();
B) Horse h = new Animal();
C) Animal a = new Animal();
D) Animal a = new Horse();
E) all of the above are valid
Q5) Give an example of a class that implements the Iterator interface.
Q6) How does inheritance relate to polymorphism in Java?
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) A method that calls itself is a __________________ method.
A) invalid
B) static
C) final
D) recursive
E) public
Q2) The Towers of Hanoi puzzle cannot be solved iteratively.
A)True
B)False
Q3) Which of the following will result from infinite recursion in Java?
A) The program will hang as though there is an infinite loop.
B) The program will throw an ArrayOutOfBoundsException.
C) The program will not compile.
D) The program will run out of memory.
E) none of the above.
Q4) Write a recursive definition for K(n), which represents the product of all of the even integers less than or equal to n.
Q5) All recursive methods must have a base case.
A)True
B)False
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) A finally clause is always required in a try-catch block.
A)True
B)False
Q2) Consider the following code fragment.
String s;
for(int i = 0; i < s.length(); i++)
System.out.println(s.charAt(i));
What exception will be thrown by this code and why?
Q3) Which of the following methods are part of the Exception class and can be used to give information about a thrown exception?
A) getInfo
B) printInfo
C) printStackTrace
D) getStackTrace
E) none of the above
Q4) What is the difference between an exception and an error?
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?
Page 13
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/80259
Sample Questions
Q1) ____________________ is the process of arranging a group of items into a defined order.
A) Searching
B) Sorting
C) Selecting
D) Helping
E) none of the above
Q2) Which of the following algorithms has a worst case complexity of O(n log<sub>2</sub>n)?
A) insertion sort
B) selection sort
C) bubble sort
D) merge sort
E) none of the above
Q3) Which of the following algorithms has a time complexity of O(log<sub>2</sub> n)?
A) insertion sort
B) selection sort
C) bubble sort
D) linear search
E) binary search
To view all questions and flashcards with answers, click on the resource link above. Page 14

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80258
Sample Questions
Q1) Explain how a binary tree can be implemented using an array.
Q2) Which of the following tree traversals traverses the subtrees from left to right and then visits the root?
A) Preorder
B) Inorder
C) Postorder
D) Level-order
E) none of the above
Q3) What is the root of a tree?
Q4) A _________________ can be used as the basis for an expert system.
A) queue
B) stack
C) ternary tree
D) 4-ary tree
E) decision tree
Q5) In a tree, a node that does not have any children is called a leaf.
A)True
B)False
Q6) What is a disadvantage of implementing a tree as an array using computed links?
Q7) What is a decision tree?
To view all questions and flashcards with answers, click on the resource link above. Page 15

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80248
Sample Questions
Q1) Which of the following methods removes an element from a queue?
A) enqueue
B) dequeue
C) first
D) pop
E) push
Q2) Write a push method for a stack implemented as a linked structure. You may assume that the implementation has the top element of the stack referenced by a LinearNode<T> reference top and that an integer variable count keeps track of the number of elements in the stack.
Q3) In an ideal implementations of a stack and a queue, all operations are
A) O(1)
B) O(n)
C) O(n log n)
D) O(n<sup>2</sup>)
E) it depends on the operation
Q4) List the five basic operations on a stack.
Q5) What is wrong with implementing a queue via an array where index 0 represents the front of the queue?
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/80247
Sample Questions
Q1) Describe the steps involved in performing a right rotation on a node in a binary search tree.
Q2) When adding a new element to a binary search tree, the element is added as a(n)
A) internal node
B) subtree
C) leaf
D) root
E) none of the above
Q3) Explain how to add an element to a binary search tree.
Q4) Explain how heap sort works.
Q5) Why is it important to keep a binary search tree balanced?
Q6) A heap sort sorts elements by constructing a heap out of them, and then removing them one at a time from the root.
A)True
B)False
Q7) What is a binary search tree?
Q8) 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 17

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80256
Sample Questions
Q1) Can a tree ever have a cycle? Explain.
Q2) A(n) ___________________ is a two-dimensional array that can be used to represent a graph.
A) adjacency list
B) adjacency matrix
C) digraph list
D) graph node
E) none of the above
Q3) 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
Q4) A spanning tree of a graph does not necessarily include all of the edges of the graph.
A)True
B)False
Q5) What is the difference between a directed graph and an undirected graph?
Page 18
To view all questions and flashcards with answers, click on the resource link above.