



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A comprehensive set of review questions for the cps 202 final exam, covering key concepts in object-oriented programming, design patterns, and java gui programming. Each question includes a verified answer, making it an excellent resource for students preparing for the exam. The questions cover topics such as inheritance, polymorphism, interfaces, inner classes, layout managers, and event handling.
Typology: Exams
1 / 5
This page cannot be seen from the preview
Don't miss anything!
The header public boolean equals(Date otherDate) is best described as an: A. overload of the equals method B. override of the equals method C. masking of the equals method D. overbooking of the equals method - Correct answer A The Model-Delegate design pattern only works with GUI programming (T/F) - Correct answer F Most, but not all, of the wrapper classes are spelled the same as the keyword for the primitive data type that they "wrap," but with an initial capital letter. Which wrappers don't follow this rule? A. Float, Double B. Integer, Short, Long C. Integer, Character D. Character, Byte - Correct answer C An instance variable of a class can be of an array type (T/F) - Correct answer T A copy constructor should: (1) be a constructor with a single argument of the same type as the class (2) create an entirely spearate object, with identical data values as in the original object (3) never use the new operator (because it causes data leaks) (4) be created when a class contains instance variables that are of non-primitive types A. Only statement (3) is false B. All four statements are true C. (1) and (2) are true D. Only statement (4) is false - Correct answer A The Model-View-Controller design pattern only works with GUI programming (T/F) - Correct answer F Which of the following is true? A. An interface may not have any instance variables B. An interface may not have any constructors C. An interface may have abstract methods
D. All of the above E. None of the above - Correct answer D A common use of inner classes is A. clean up B. burn down C. helper D. all of the above - Correct answer C In even the most basic Java GUI programming, the JFrame class contains many methods that must be overridden (T/F) - Correct answer F A button fires events known as A. static events B. passive events C. dormant events D. action events - Correct answer D A Java generic is a class or method that includes a type as a parameter (T/F) - Correct answer T The ___ manager is the simplest layout manager in Java. It arranges components one after the other, going from left to right, in order in which you add them A. BorderLayout B. FlowLayout C. GridLayout D. AbsoluteLayout - Correct answer B Anonymous classes are not supported in Java (T/F) - Correct answer F A list is an abstract data type that is sequential, homogeneous, and dynamic (T/F) - Correct answer T The most common relationships among classes are inheritance, composition, association, and aggregation (T/F) - Correct answer T In the Model-View-Controller pattern, a passive View contains a reference to the Controller, but not to the model (T/F) - Correct answer F The first node in a linked list is often referred to as the ___ node. A. head B. tail
D. all of the above E. none of the above - Correct answer D Encapsulation is a type of information hiding in which the internal representation of an object is generally hidden from view outside of the object's definition (T/F) - Correct answer T Polymorphism refers to the ability to associate multiple meanings to one method name by means of the late binding mechanism (T/F) - Correct answer T Method overloading is when two or more methods of the same class have the same name but differ in number or type of parameters (T/F) - Correct answer T Objects are created from a class with a constructor (T/F) - Correct answer T An object is to a class as a house is to a blueprint (T/F) - Correct answer T The class is a record structure that is enhanced with instance methods that can be used to manipulate the fields of the record (T/F) - Correct answer T Consider the following code and select the correct description. int[] s = new int[]{42}; int[] t = s; A. t is a shallow copy of s B. t is a deep copy of s C. s is a deep clone of t D. s is a shallow clone of t - Correct answer A With static binding, the decision of which definition of a method to use with a calling object is made at compile time based on the type of the variable naming the object (T/F) - Correct answer T Dynamic binding is also known as late binding because there is a substantial delay in program execution that makes everything late (T/F) - Correct answer F When overloading a method, the number of parameters may be changed (T/F) - Correct answer T With ___ binding, the decision of which definition of a method to use with a calling object is made at compile time based on the type of the variable naming the object. A. late B. dynamic C. static
D. foot - Correct answer C A deep copy of an object is a copy that has references in common with the original object (T/F) - Correct answer F