Java OOP - 4

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

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(){ }.

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.

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.

a

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.

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.

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.

b

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.

b

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.

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).

c

What is garbage collection in the context of Java? (a) The operating system periodically deletes all of the java files available on the system. (b) Any package imported in a program and not used is automatically deleted. (c) When all references to an object are gone, the memory used by the object is automatically reclaimed. (d) The JVM checks the output of any Java program and deletes anything that doesn't make sense. (e) When all references to an object are gone the memory used by the object is not reclaimed.

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.

c

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.

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.

d

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.

e


Conjuntos de estudio relacionados

Chapter 9: Internet Control Message Protocol Version 4 (ICMPV4)

View Set

Skin Integrity And Wound Care: Implement And Take Action; Evaluate

View Set