OOP questions for Computer Science and MCA students

What are the advantages of object oriented approach?

What is Object Oriented Programming?
  • It is a programming paradigm that uses 'objects' and their interactions to design applications and computer programs.
Features of Object Oriented Programming:
  • It emphasis on data rather than procedure.
  • The objects can communicate with each other through the functions.
  • New data and functions can be easily added whenever necessary.
  • It follows bottom-up approach.
  • The data is hidden and cannot be accessed by external functions.
What is Object Oriented Development?
  • It is the next great advance in software engineering.
  • It reduces development time and resources required to maintain existing applications.
  • It increases code reuse.
  • It provides a competitive advantage to organizations that use it.
There are some key ideas of the object oriented approach are:
  • Encapsulation
  • Objects
  • Class and Inheritance
  • Instances and Instantiation
  • Methods and Messages
Advantages of Object Oriented Approach

1. Simplicity:
  • The software objects model complexity is reduced and the program structure is very clear.
2. Reusability:
  • It is a desired goal of all development process.
  • It contains both data and functions which act on data.
  • It makes easy to reuse the code in a new system.
  • Messages provide a predefined interface to an object's data and functionality.
3. Increased Quality:
  • This feature increases in quality are largely a by-product of this program reuse.
4. Maintainable:
  • The OOP method makes the code more maintainable.
  • The objects can be maintained separately, locating and fixing problems easier.
5. Scalable:
  • The object oriented applications are more scalable than structured approach.
  • It makes easy to replace the old and aging code with faster algorithms and newer technology.
6. Modularity:
  • The OOD systems are easier to modify.
  • It can be altered in fundamental ways without ever breaking up since changes are neatly encapsulated.
7. Modifiability:
  • It is easy to make minor changes in the data representation or the procedures in an object oriented program.
8. Client/Server Architecture:
  • It involves the transmission of messages back and forth over a network.

Write a note on interaction overview diagram.

  • It is a variant of the Activity Diagram where the nodes are the interactions or interaction occurrences.
  • It focuses on the overview of the flow of control of the interactions.
  • It describes the interactions where messages and lifelines are hidden.
  • It looks like activity diagrams that can only have inline interactions or interaction uses instead of invocation actions.
  • UML 2.4 requires branching and joining of branches in interaction overview diagrams to be properly nested.
  • This is more restrictive than in activity diagrams and could be quite difficult to obey.
  • It combines element from activity and interaction diagram.

  • interaction diagram phase

  • The Lifelines and Messages do not appear in this overview level.
Notation

1. Activity Final Node:
  • An activity may have more than one activity final node. The first one reached stops all flows in the activity.
Properties

NameThe name of the activity final node.
VisibilityIt determines where the activity final node appears within different namespaces within the overall model and its accessibility.
DocumentationDescription of activity final node.
IsolateIf true, then the actions in the node execute in isolation from actions outside the node.
LeafIt indicates whether it is possible to further specialize an activity final node.

2. Control Flow
  • It is an edge that starts an activity node after the previous one is finished.
Properties

NameName of the control flow.
SourceNode from which tokens are taken when they traverse the edge.
TargetNode to which tokens are put when they traverse the edge.
WeightThe minimum number of tokens that must traverse the edge at the same time.
GuardSpecification evaluated at runtime to determine if the edge can be traversed.
DocumentationDescription of control flow.
Duration ConstraintIt defines a constraint that refers to a Duration Interval.

3. Decision Node
  • It accepts tokens on an incoming edge and presents them to multiple outgoing edges.
Properties

NameThe name of the decision node.
VisibilityIt determines where the decision node appears within different namespaces within the overall model and its accessibility.
DocumentationDescription of decision node.
IsolateIf true, then the actions in the node execute in isolation from actions outside the node.
LeafIt indicates whether it is possible to further specialize a decision node.

4. Initial Node
  • It is a control node at which flow starts when the activity is invoked.
Properties

NameThe name of the initial node.
VisibilityIt determines where the initial node appears within different namespaces within the overall model and its accessibility.
DocumentationDescription of initial node.
IsolateIf true, then the actions in the node execute in isolation from actions outside the node.
LeafIt indicates whether it is possible to further specialize an initial node.

5. Note
  • It gives the ability to attach various remarks to the elements.
  • It carries no semantic force, but may contain information that is useful to a modeler.
Properties

NameThe name of note.
DocumentationIt specifies a string that is the comment.