Java OOP - P4

¡Supera tus tareas y exámenes ahora con Quizwiz!

d

A method within a class is only accessible by classes that are defined within the same package as the class of the method. Which one of the following is used to enforce such restriction? (a) Declare the method with the keyword public (b) Declare the method with the keyword private (c) Declare the method with the keyword protected (d) Do not declare the method with any accessibility modifiers (e) Declare the method with the keyword public and private.

d

A package is a collection of (a) Classes (b) Interfaces (c) Editing tools (d) Classes and interfaces (e) Editing tools and interfaces.

c

A process that involves recognizing and focusing on the important characteristics of a situation or object is known as: (a) Encapsulation (b) Polymorphism (c) Abstraction (d) Inheritance (e) Object persistence.

a

Basic Java language functions are stored in which of the following java package? (a) java.lang (b) java.io (c) java.net (d) java.util (e) java.awt

a

Given a class named student, which of the following is a valid constructor declaration for the class? (a) Student (student s) { } (b) Student student ( ) { } (c) Private final student ( ) { } (d) Void student ( ) { } (e) Static void student(){ }.

b

In Java, declaring a class abstract is useful (a) To prevent developers from further extending the class (b) When it doesn't make sense to have objects of that class (c) When default implementations of some methods are not desirable (d) To force developers to extend the class not to use its capabilities (e) When it makes sense to have objects of that class.

d

In object oriented programming new classes can be defined by extending existing classes. This is an example of: (a) Encapsulation (b) Interface (c) Composition (d) Inheritance (e) Aggregation.

d

In object oriented programming new classes can be defined by extending existing classes. This is an example of: (a) Encapsulation (b) Interface (c) Composition (d) Inheritance (e) Aggregation.

b

In object oriented programming, composition relates to (a) The use of consistent coding conventions (b) The organization of components interacting to achieve a coherent, common behavior (c) The use of inheritance to achieve polymorphic behavior (d) The organization of components interacting not to achieve a coherent common behavior (e) The use of data hiding to achieve polymorphic behavior.

a

Object oriented inheritance models the (a) "is a kind of" relationship (b) "has a" relationship (c) "want to be" relationship (d) inheritance does not describe any kind of relationship between classes (e) "contains" of relationship.

e

Polymorphism (a) Is not supported by Java (b) Refers to the ability of two or more objects belonging to different classes to respond to exactly the same message in different class-specific ways (c) Simplifies code maintenance (d) Not simplifies code manintenance (e) Refers to the ability of two or more objects belonging to different classes to respond to exactly the same message in different class -specific ways and simplifies code maintenance.

c

The concept of multiple inheritance is implemented in Java by I. Extending two or more classes. II. Extending one class and implementing one or more interfaces. III. Implementing two or more interfaces. (a) Only (II) (b) (I) and (II) (c) (II) and (III) (d) Only (I) (e) Only (III).

a

The wrapping up of data and functions into a single unit is called (a) Encapsulation (b) Abstraction (c) Data Hiding (d) Polymorphism (e) Message passing.

c

What is the error in the following class definitions? Abstract class xy { abstract sum (int x, int y) { } } (a) Class header is not defined properly. (b) Constructor is not defined. (c) Method is not defined properly (d) Method is defined properly (e) No error.

c

Which of the following does not belong: If a class inherits from some other class, it should (a) Make use of the parent class's capabilities (b) Over-ride or add the minimum to accomplish the derived class' purpose (c) Over-ride all the methods of its parent class (d) Make sure the result "IS-A-KIND-OF" its base class (e) Make sure the result "contains" its base class.

b

Which of the following has a method names flush( )? (a) Input stream (b) Output Stream (c) Reader stream (d) Input reader stream (e) Input output stream.

c

Which of the following is a member of the java.lang package? (a) List (b) Queue (c) Math (d) Stack (e) Process.

b

Which of these field declarations are legal within the body of an interface? (a) Private final static int answer = 42 (b) public static int answer=42 (c) final static answer =42 (d) int answer (e) No error.

b

Which statement is true regarding an object? (a) An object is what classes instantiated are from (b) An object is an instance of a class (c) An object is a variable (d) An object is a reference to an attribute (e) An object is not an instance of a class.


Conjuntos de estudio relacionados

FLORIDA REAL ESTATE 63 HOUR PRACTICE TEST

View Set

Python New Package Introduction (NPI)

View Set

Organizational and Professional Health and Well-Being

View Set

Module 33- Oligopoly in Practice

View Set

Chapter 11 MGH: Aggregate Supply & Demand

View Set