oop

13
If you are working on a business process that needs to be automated, how do you begin designing the system using objects? Choice 1 The internal representation of data is typically deferred to later in the design process. Choice 2 Start by looking at the primary function of the system and break that functionality down into more and more specific steps. Choice 3 Begin by identifying potential objects, their attributes, and their behaviors. Choice 4 Ask the business user to rewrite the document and to include any necessary objects in the new version. Choice 5 The program should be designed according to a conceptual hierarchy, with the upper levels indicating the most general features of the problem. OO Concepts, Question 1 of 40 Scenario Your department has decided to use a traditional relational database system to store objects rather than an object-oriented database. Referring to the scenario above, which one of the following is NOT a key consideration when storing objects in a relational database? Choice 1

Upload: naila-khan

Post on 25-Nov-2014

604 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: OOP

If you are working on a business process that needs to be automated, how do you begin designing the system using objects? Choice 1

The internal representation of data is typically deferred to later in the design process. Choice 2

Start by looking at the primary function of the system and break that functionality down into more and more specific steps. Choice 3

Begin by identifying potential objects, their attributes, and their behaviors.

Choice 4

Ask the business user to rewrite the document and to include any necessary objects in the new version. Choice 5

The program should be designed according to a conceptual hierarchy, with the upper levels indicating the most general features of the problem.

     OO Concepts, Question 1 of 40

Scenario Your department has decided to use a traditional relational database system to store objects

rather than an object-oriented database. Referring to the scenario above, which one of the following is NOT a key consideration when storing objects in a relational database? Choice 1

Storing inherited attributes Choice 2

Modifying and storing lifecycle triggers Choice 3

Storing aggregated objects Choice 4

Storing the relationships between objects

Page 2: OOP

Choice 5

Modifying and storing class level attributes

 

Page 3: OOP

OO Concepts

Progress:

 

Object request brokers can typically process which one of the following object-initiated requests?

Choice 1 Re-locate an object.

Choice 2 Shut down the server.

Choice 3 Create an object on the workstation.

Choice 4 Send a message to another object.

Choice 5 Open an unnamed port through a firewall.

 

OO Concepts

Progress:

 

Page 4: OOP

Scenario For encapsulation and maintainability, you wish to include a set of integer error codes in your objects for indicating the current state.

Referring to the scenario above, where are the error codes located?

Choice 1 Outside of the class definition, as global variables

Choice 2 Inside the class, as public member constants

Choice 3 You do not need to define them, just return the errors; self-documenting code will identify them.

Choice 4 In the class, as instance variables

Choice 5 In a separate external file named "err_codes"

Which one of the following statements demonstrates the OO concept of encapsulation? Choice 1

If you ask an object to do something, you do not care how it does it, only that it gets done Choice 2

Two objects that belong to the same class can share some of the same data. Choice 3

If two objects coexist within an application, each has its own data Choice 4

If one object makes a request of another object, the request should include all information necessary to fulfill the request Choice 5

An abstract class cannot be directly instantiated.

Page 5: OOP

You have categorized the classes in an accounting application into the groups shown above.  Which class types do you expect to change if you add a new report to the UI, while everything else remains the same? Choice 1

System and interface classes only Choice 2

Persistence classes only Choice 3

Interface classes only Choice 4

Business, system, and  persistence classes Choice 5

Business and persistence classes only

Dragon

Dragons, such as the one above, have wings like a bird and scales like a lizard. In object-oriented verbiage, we say this is an example of which one of the following? Choice 1

Polymorphism Choice 2

Inheritance

Page 6: OOP

Choice 3

Encapsulation Choice 4

Multiple inheritance Choice 5

Aggregation

     OO Concepts, Question 7 of 40

Referring to the above, which one of the following statements describes the relationship between classes A and B? Choice 1

Objects of class B always have at least one object of class A. Choice 2

Objects of class B always have at least one object of class A as a part of them. Choice 3

Objects of class A have one or more objects of class B as a part of them.  An object of class B can belong to objects of class A. Choice 4

An object of class B includes one and only one object of class A. Choice 5

An object of class A can belong to zero or more objects of class B.

Page 7: OOP

The Customer class shown above does not satisfy the principle of encapsulation.  What do you need to do to all data members in order to satisfy encapsulation? Choice 1

Make them static. Choice 2

Make them private Choice 3

Make them virtual. Choice 4

Make them local. Choice 5

Make them public.

Which one of the following is a demonstration of the fact that "Animal" and all of its derived classes have method "walk" with same signature ? Choice 1

Page 8: OOP

Abstraction Choice 2

Aggregation Choice 3

Cardinality Choice 4

Optionality Choice 5

Polymorphism

Assume that all objects are instantiated properly at runtime (no null references). Referring to above code, what is wrong with the code found within the getAddress() method of class Employee? Choice 1

The code is correct, and everything is legal. Choice 2

Method getAddress() from class Location is not accessible to object employee. Choice 3

This is very inefficient code. Choice 4

A cast is required to convert the result from the Address type. Choice 5

This is a violation of the Law of Demeter.

Page 9: OOP

Assuming that all objects are instantiated properly at runtime by appropriate constructors (no null references), what is wrong with the code within the getCity() method of the Employee class?

Choice 1

The Employee object depends too much on the internal structure of Location object. Choice 2

A cast is required to convert the city to a String. Choice 3

Method getCity() from class Address is not accessible to object employee. Choice 4

This would be very inefficient. Choice 5

This is a violation of the Liskov Substitution Principle.

Page 10: OOP

 

OO Concepts

Progress:

 

Definition In C++ a method M of class A can be designated as a friend of an unrelated (by inheritance) class B.  This gives method M direct access to private data members of class B.

Referring to the above definition, what object-oriented programming principle do friend methods violate?

Choice 1 Cohesion

Choice 2 Inheritance

Choice 3 Encapsulation

Choice 4 Abstraction

Choice 5 Aggregation

Page 11: OOP