









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










1. Software objects share two characteristics of __________ and __________. a. Object, class b. Inheritance, interface c. State, behavior d. Function, method e. Project, package 2. Benefits of modeling using objects in software include a. Code re-use b. Information-hiding c. Modularity d. Pluggability and debugging ease e. All of the above 3. The purpose of a class in object-oriented programming environment is to model the state and behavior of a real-world object. a. True b. False 4. In object-oriented terms what is used as a blueprint to model a real- world object? a. Method b. State c. Class d. Behavior e. Constant 5. Object-oriented programming allows for inheritance so commonly used state and behavior can be reused. The class that is inherited from is the __________ and the new class is the __________. a. Superclass, subclass b. Subclass, superclass c. Interface, subclass d. Class, package e. Extends, implements
6. A declaration statement declares a variable. The following code is a correct example of a declaration statement: double value = 100; a. True b. False 7. How many superclasses can a subclass extend when using inheritance in object-oriented programming using the Java programming language? a. Zero b. One c. Two d. Three e. Unlimited 8. When using inheritance what does the new class inherit when it is derived from another class? a. Object, class b. Inheritance, interface c. Function, method d. State, behavior e. Project, package 9. When implementing an interface in object-oriented programming all __________ must be included in the source code for the class to compile. a. State b. State and behavior c. Superclasses d. Constructors e. Methods 10. What programming best practice should be used when identifying state and behaviors that are derived from another class or defined locally in the new class? a. Comment the code b. Class variables c. Local variables d. Parameters e. None of the above 11. Local variables are commonly used in methods to store a temporary state. Local variables are visible __________. a. Globally b. Within the class c. Outside of the class d. Between the opening and closing braces of the method where they are declared e. Not accessible
b. Backwards c. Forwards d. Conditionally e. None of the above
19. Which of the following is considered a decision-making statement? a. if b. if/else c. if/else if/else d. switch e. All of the above 20. Which of the following is considered a looping statement? a. for b. while c. do/while d. A, B, and C e. None of the above 21. Which of the following is NOT considered branching statements? a. goto b. break c. continue d. return e. All of the above 22. When using the if/else if decision-making statement the else leg is not required. a. True b. False 23. When declaring a class which of the following components are REQUIRED? a. Class name b. Class body using {} c. Parameter list using () d. A and B e. A, B, and C 24. Within a class, a method declaration has up to six components. The REQUIRED elements of a method declaration include __________, __________, __________, __________. a. Modifier, class name, parent class, comma separated list of interfaces implemented b. Class body, constructors, fields, methods
c. Methodโs return type, name, (), {} d. Modifier, return type, name, () e. Encapsulation, return type, name, {}
25. What are the components of a method declaration that comprise the method signature? a. Method return type and method name b. Method name and method parameter list c. Method return type and method parameter list d. Method return type, method name, and method parameter list e. All of the above 26. The object-oriented concept of software reuse allows a class to be created once and used __________. a. As many times as desired to include extending it using inheritance b. Never c. Once unless it is extended using inheritance d. Ten times or less e. Once unless it is implemented using interface 27. A unique aspect of some object-oriented programming languages is not having to explicitly declare a class constructor. This is true with the Java programming language. When instantiating an instance of a class and a class constructor has not been explicitly declared how is the following source code valid? Bicycle bike1 = new Bicycle(); a. It is not valid b. The compiler automatically provides a no-argument constructor c. There would be a compiler error d. There would be a runtime error e. It is considered an overloaded method 28. If a class explicitly declares a constructor that takes 0โฆn parameters when instantiated what happens to the default constructor of the class? a. It still exists and can be used to create instances of the class b. It is automatically created by the Java compiler c. It no longer exists d. All of the above e. None of the above 29. The Java Application Programming Interface (API) includes predefined classes grouped into categories of related classes. a. True b. False 30. Select the statement that is true about the Java programming language.
33. Which of the following is NOT valid regarding methods calls in the Java programming language? a. All methods are automatically public so they can be called whenever from wherever throughout a program b. Use method name by itself to call another method of the same class c. Use variable reference to an object followed by โ.โ and the method name for non-static methods d. Use class name followed by a โ.โ and static method name e. All of the above 34. Regarding object-oriented programming, declaration means that a variable name is associated with an object type and creates an object of that type. a. True b. False 35. When method parameters have the same name as class fields this is called __________. a. Repetition b. Shadowing c. Duplication d. Same name e. Confusion 36. When having to programmatically differentiate a parameter having the same name as a field of a class what keyword can resolve this issue with the compiler when setting the field value equal to the argument value passed into the method? a. keyword b. parameter c. argument d. this e. in 37. Regarding object-oriented programming, when an object is instantiated the keyword new is used, memory is allocated, and a reference to that memory is returned. a. True b. False 38. How are primitive and reference data arguments pass into a method? a. By value b. By reference c. By physical location d. By object location e. None of the above
39. An interface can and should be instantiated. a. True b. False
46. Returning a value from a method that is declared with a return type of void results in a compiler error. a. True b. False 47. Unary operators __________. a. Require two or more operands b. Require one operand c. Are used for incrementing/decrementing a value by one d. Both A and C e. Both B and C 48. The length of an array is established when the array is created. a. True b. False 49. Which of the following declares an array correctly from a syntax perspective? a. String stringArray; b. String[] stringArray; c. String stringArray[]; d. Both A and B e. Both B and C 50. Operators are special symbols that perform specific operations on __________ operands, and return a result. a. One b. One or two c. One, two or three d. Unlimited e. None of the above 51. Interfaces and abstract classes can have objects instantiated from them. a. True b. False 52. Operators with higher precedence are evaluated __________ operators with relatively __________ precedence a. Before, lower b. After, lower c. Before, higher d. After, higher e. None of the above
59. A class that is declared final can be extended or subclassed. a. True b. False
60. When does a method return to the code that invoked it? a. Completes all the statements in the method b. Reaches a return statement c. Throws an exception d. A or B e. A, B, or C 61. Classes that cannot have objects created from them are called what? a. Concrete b. Interfaces c. Inheritance d. Polymorphism e. Abstract 62. An abstract method is a method that is: a. Declared without implementation b. Has no curly braces c. Ends with a semicolon d. A, B, and C e. None of the above 63. A subclass of an abstract class must provide _________ for all abstract methods of the superclass to be considered a concrete class. a. Interfaces b. Implementation c. Guidance d. Comments e. Shadowing 64. What is the automatic access modifier of methods and fields of interfaces? a. Package b. Package-private c. Private d. Public e. Protected 65. What does the keyword final indicated regarding methods or field members of a class? a. They are public b. They are private c. They are modifiable d. They cannot be modified e. None of the above