

![]()


Object-Oriented Programming (OOP) introduces students to the fundamental concepts and principles of designing and building software using the object-oriented paradigm. The course covers key topics such as classes, objects, encapsulation, inheritance, polymorphism, and abstraction, emphasizing how these features facilitate modular, reusable, and maintainable code. Through hands-on programming assignments and projects, students learn to write and analyze programs using an object-oriented language, debug and test their code, and apply design patterns to solve real-world problems efficiently. This course provides foundational skills required for advanced software development and lays the groundwork for further study in computer science.
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

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80262
Sample Questions
Q1) An interpreter is a program that translates code that is written in one language into equivalent code in another language.
A)True
B)False
Answer: False
Q2) Classes can be created from other classes by using _______________ .
A) encapsulation
B) polymorphism
C) inheritance
D) attributes
E) machine code
Answer: C
Q3) In Java, total, ToTal and TOTAL are all different identifiers.
A)True
B)False
Answer: True
Q4) 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) What are some reasons that you might want to declare a variable as final?
Answer: A variable that is declared as final is one that cannot be reassigned throughout the program. You might want to declare a variable as final if its value will not change often. This will make it so you cannot accidentally change the value by reassigning it which can cause errors. It also will allow you to change the variable in a single place in the program if and when the value does change.
Q2) Which of the following are examples of invalid string literals?
A) "Hello World!"
B) "4 score and 7 years ago, our forefathers brought forth..."
C) "z"
D) ""
E) none of the above
Answer: E
Q3) Write a short program that declares a single integer variable called age and assigns it a value equal to your age. Also have it print out your age using the age variable. The output of your program should look similar to the following: I am 30 years old.
Answer: 11edd9cf_f07e_e94c_84e8_d51ecd69a191_TB2841_00
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) Write a single line that creates a wrapper for an int variable num. Answer: Integer numWrapper = new Integer(num);
Q2) Write a short program that allows the user to enter the base and height of a triangle and outputs the hypotenuse, formatted to three decimal places. Answer: import java.util.Scanner; import java.text.DecimalFormat; public class Hypotenuse { public static void main(String [] args) { double base, height, hypotenuse; Scanner input = new Scanner(System.in); DecimalFormat fmt = new DecimalFormat("0.###"); System.out.print("Please enter the base: "); base = input.nextDouble(); System.out.print("Please enter the height: "); height = input.nextDouble(); hypotenuse = Math.sqrt(Math.pow(base,2) + Math.pow(height,2)); System.out.println("The hypotenuse is " + fmt.format(hypotenuse) + "."); }//end main }//end class
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) Rewrite the following for loop as a while loop. for(int i = 0; i < MAX; i++) //loop body
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) Write a code fragment that allows a user to continue inputting numbers until she enters a sentinel value of 0. Then print the sum of all the numbers she entered. You may assume that a Scanner object called input has already been created.
Q4) It is possible to implement a switch statement using if statements. A)True B)False
Q5) Write a code fragment that determines how many times the character 'A' appears in a String object called name.
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) Explain why a static method cannot refer to an instance variable.
Q2) Which of the following types of methods do not have any return type (not even a void return type)?
A) methods declared as static
B) methods declared as public
C) methods declared as private
D) constructors
E) all of the above have return types
Q3) A variable can always be referenced anywhere in a program.
A)True
B)False
Q4) A method that has multiple definitions is an __________________ method. A) overloaded B) overridden C) overlooked D) overclocked
E) none of the above
Q5) Write a method called countSpaces that takes in a String as a parameter and returns an integer that represents the number of space characters (' ') contained in the string, false otherwise..
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) Describe the difference between a heavyweight container and a lightweight container. Give an example of each.
Q2) A(n) ___________________ is an object that defines a screen element used to display information or allow the user to interact with a program in a certain way.
A) GUI
B) component
C) event
D) listener
E) AWT
Q3) Write a short class that represents a panel with a single radio button that has the option "Yes" and the option "No." By default, the Yes button should be checked.
Q4) Explain the difference between a combo box and a dialog box.
Q5) Explain the difference between check boxes and radio buttons.
Q6) A panel is displayed as a separate window, but a frame can only be displayed as part of another container.
A)True
B)False
Q7) What is the difference between a mnemonic and a tool tip?
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 that takes in an arbitrary number of String objects, and then prints out all of them that have over 10 characters.
Q2) Write the declaration for an array of doubles called averages that is initialized with an initializer list.
Q3) Which of the following statements will assign the first command-line argument sent into a Java program to a variable called argument?
A) argument = System.getFirstArgument();
B) argument = System.getArgument[1];
C) argument = System.getArgument[0];
D) argument = args[0];
E) argument = args[1];
Q4) It is possible to store 11 elements in an array that is declared in the following way. int[] array = new int[10];
A)True
B)False
Q5) Write a method called containsPair that accepts an array of integers as a parameter and returns true if it contains two integers that are equal.
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) What is an abstract class, and why might it be useful in an inheritance hierarchy?
Q2) Explain the relevance of the Object class to the Java programming language.
Q3) All Java classes are subclasses of the ___________________ class.
A) String
B) java.lang
C) Java
D) Class
E) Object
Q4) Compare and contrast the private visibility modifier to the protected visibility modifier. Why is the protected visibility modifier a better choice in an inheritance hierarchy?
Q5) 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?
Q6) 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
To view all questions and flashcards with answers, click on the resource link above. Page 10

Available Study Resources on Quizplus for this Chatper
39 Verified Questions
39 Flashcards
Source URL: https://quizplus.com/quiz/80249
Sample Questions
Q1) Give an example of a class that implements the Iterator interface.
Q2) Which of the following methods are included with any object that implements the Iterator interface?
A) next
B) hasNext
C) toString
D) all of the above
E) a and b
Q3) The commitment to execute certain code to carry out a method invocation is referred to as _________________.
A) execution
B) binding
C) polymorphism
D) inheritance
E) none of the above
Q4) Late binding is _______________ than _______________ .
A) more efficient, compile-time binding
B) less efficient, compile-time binding
C) more efficient, run-time binding
D) less efficient, run-time binding
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
Q1) The Fibonacci sequence is defined as the sum of the two previous elements of the sequence, with the first and second numbers in the sequence being 0 and 1 respectively. Write a recursive method that computes the nth Fibonacci number.
Q2) A solution with exponential complexity is ____________________ .
A) efficient B) inefficient C) easy to implement D) difficult to implement E) none of the above
Q3) Which of the following is a proper recursive definition of x raised to the y power?
A) x<sup>y</sup> = x*x<sup>y-1</sup>
B) x<sup>y</sup> = x*x<sup>y-2</sup>
C) x<sup>y</sup> = x*x<sup>y-1</sup> for y > 1; x<sup>y</sup> = x for y = 1
D) x<sup>y</sup> = x*x<sup>y-1 </sup>for all x E) none of the above
Q4) The Fibonacci sequence is defined as the sum of the two previous elements of the sequence, with the first and second numbers in the sequence being 0 and 1 respectively. Write a recursive mathematical definition of the Fibonacci numbers.
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(n) _____________________ is an object that defines an erroneous situation from which the program usually cannot recover.
A) error
B) exception
C) interface
D) try block
E) catch block
Q2) In practice, it is important to catch all exceptions that might be thrown by a program.
A)True
B)False
Q3) What is exception prorogation, and how does it work in Java?
Q4) A(n) ________________ is an ordered sequence of bytes.
A) exception
B) error
C) input-output flow
D) stream
E) none of the above
Q5) How does a method throw an exception?
Q6) Is the Exception class a subclass of the Error class? Explain.
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) Which of the following is not a sorting algorithm?
A) Bubble sort
B) Quick sort
C) Merge sort
D) Selection sort
E) all of the above are sorting algorithms
Q2) 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];
Q3) Write a method that accepts an integer and an array of integers, and returns true if the integer is contained in the array. You may assume that the array is sorted, and your method should use a binary search..
Q4) 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) A balanced binary tree with m elements will have height ______________ .
A) 2m
B) 2<sup>m</sup>
C) log<sub>m</sub> 2
D) log<sub>2</sub> m
E) none of the above
Q2) A _________________ is a nonlinear structure in which elements are organized into a hierarchy.
A) graph
B) tree
C) queue
D) stack
E) linked-list
Q3) What is a decision tree?
Q4) If a tree has order 4, what does this mean?
Q5) What is a disadvantage of implementing a tree as an array using computed links?
Q6) What are the leaves of a tree?
Q7) What is the root of a tree?
Q8) What does it mean for a tree to be balanced?
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) Which of the following is not a valid postfix expression?
A) 5 4 +
B) 6 5 4 + -
C) 4 + 5
D) 8 2 + 2 /
E) all of the above are valid postfix expressions
Q2) It is only possible to implement a queue using an array-based structure.
A)True
B)False
Q3) What exception is thrown if the pop method is called on an empty stack?
A) EmptyStackException
B) NoSuchElementException
C) ArrayOutOfBoundsException
D) EmptyCollectionException
E) none of the above
Q4) What is wrong with the java.util.Stack implementation of a stack?
Q5) List the five basic operations on a stack.
Q6) A postfix expression can be easily evaluated using a queue.
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) In a maxheap, the largest element in the structure is always
.

A) a leaf
B) an internal node
C) the root
D) the left child of the root
E) the right child of the root
Q2) Explain how heap sort works.
Q3) 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
Q4) Finding an element in a binary search tree always requires O(log<sub>2</sub> n) comparisons.
A)True
B)False
Q5) What is a binary search tree?
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 graph in which every edge is connected to every other edge is said to be
.
A) sparse
B) complete
C) full
D) balanced
E) connected
Q2) Consider the following undirected graph. vertices: 1, 2, 3, 4, 5 edges: (1,2),(3,4), (2,4), (2, 3), (3,5), (4,5)
Write out an adjacency matrix for this graph.
Q3) A breadth-first traversal of a graph uses which of the following data structures?
A) binary search tree
B) stack
C) queue
D) array
E) none of the above
Q4) What data structure is used to support a depth-first traversal of a graph?
Q5) Explain how a breadth-first traversal of a graph works.
To view all questions and flashcards with answers, click on the resource link above. Page 19