You are on page 1of 3


Q.1.What do the letters AWT stand for?

A.1.AWT stands for Abstract Windowing Toolkit and it a portion of the Java library.

Q.2.Explain the relationship between the various parts in the manipulation of a

layout manager.

A.2. In the manipulation of the layout manager there are three different
mechanisms: inheritance, composition and implementation of an interface.
Inheritance links the application clas to the parent window class. This allows the
code written in the AWT class to perform application specific actions by invoking
methods in the application class that override methods in the parent class. The fact
that composition is used to link the container with the layout manager makes the
link between these two items very flexible and dynamic-the programmer can easily
change the type of layout manager being used by a container. Finally the fact that
the layout manager is an interface means that the programmer is free to develop
alternative layout managers instead of extending this class every time.

Q.3.What is a listener? When does a listener get invoked?

A.3.A listener is an object whose sole purpose is to sit and wait for an event to
occur. When an event occurs, the listeners are notified, and they take the
appropriate action.

Q.4.What purpose is being addressed by the mouse adapter?

A.4. More often than not, programmers are interested in only one or two events
that a mouse does (like a mouse click, mouse enter, mouse exit, mouse press,
mouse release etc.) not all the possible events defined by the interface.

The mouse adapter provides empty implementations, allowing the programmer to

redefine only the events of interest.

Q.1.How are object connections related to name visibility?

A.1.Visibility describes the characterization of names-the handles by which objects

are accessed. An object is visible in a certain context if its name is legal and
denotes the object.

Q.2.What does the term coupling mean?

A.2. Coupling refers to the extent to which one component uses another to perform
actions. A general goal in designing is to reduce coupling between software.

Q.3.Why is internal data coupling a bad idea?

A.3.Internal data coupling is considered bad because it makes it difficult to

understand a class in isolation and requires one to go through several classes or
blocks of code to understand the functionality of another.

Q.4.What is the difference between file scope (package in some languages) and
program scope?

A.4.There are two varieties of global variables depending on their scope in a code.
Those that have a file scope are used only inside one file but those with a program
scope can be potentially modified anywhere in a program.

Q.5.What is sequence coupling?

A.5. Sequence coupling is when objects are linked by the fact that one must be
manipulated before the other, but otherwise they have no connection.

Q.6.What is component coupling? Why do we say that this coupling is only one way?

A.6. Component coupling occurs when one class maintains a data field or value that
is an instance of another class.

This kind of coupling is one way because here the container clearly has knowledge
of the class of value it maintains, but the element being held should have no
knowledge of the container in which it is being used.

Q.7.What is parameter coupling?

A.7.Parameter coupling occurs when one class must invoke services and routines
from another and the only relationships are the number and the type of parameters
supplied and the type of value returned.

Q.8.What is the term used for the relationship between a parent class and a child

A.8.Subclass coupling is the term used for the relationship between a parent class
and a child class.

Q.9.What is cohesion?

A.9. Cohesion refers to the extent to which the actions of a component seem to be
tied together in purpose. Generally a goal is to increase cohesion within a software
Q.10.What are the varieties of cohesion?

A.10. The varieties of cohesion are:

-Coincidental cohesion

-Logical cohesion

-Temporal cohesion

-Communication cohesion

-Sequential cohesion

-Functional cohesion

-Data cohesion

Q.11.What type of data access is ruled out by the Law of Demeter?

A.11. What is ruled out by the Law of Demeter is one object going in and directly
manipulating the internal data values of another object.

Instead, all access to data values in another component should be made through
procedures - thereby reducing data coupling to the weaker parameter coupling.

Q.12. What is the difference between class level and object level visibility?

A.12.In class level visibilities, all instances of a class are treated in the same
manner. An instance of a class is always permitted access to the data fields of other
instances of the same class.

In object level visibility, an individual objects are the basic units of control. Here no
object is permitted access to the inner state of another object, even if both are
instances of the same class.

Q.13.What is the distinction between a subclass client and a user client?

A.13. User clients create instances of the class and pass messages to these classes.
Subclass clients create new classes based on the class.

Q.14.What capabilities is a friend permitted in C++ that other objects are not?

A.14. In C++ a friend (class or method) is allowed access to all parts of a class.
They are allowed to read and write the private and protected fields within an object.
This is not possible with objects which are not declared as a friend of another class
or function.