Object Oriented Programming CS

Document Sample
scope of work template
							                  Krishna Institute of Engineering & Technology
                            Department of Computer Application
                                           Subject: OOPs
                                           Semester: IV (A)
                                           Tutorial Sheet 1

Q.1. Prepare a class diagram from the instance diagram in following figure.




Q.2. Prepare a class diagram from the instance in following figure. Explain your multiplicity decisions.
   Each point has an x coordinate and a y coordinate. What is the smallest number of points required
   to construct a polygon? Does it make a different whether or not a given point may be shared
   between several polygons? How can you express the fact that point are in a sequence?




Q.3. Consistent with the object diagram that you prepared in Q.No. 2, draw an instance diagram for
   two triangles with a common side under the following conditions:
   a. A point belongs to exactly one polygon.
   b. A point belongs to one or more polygons

Q.4. Prepare a class diagram from the instance diagram in following figure. Explain your multiplicity
   decisions. How does your diagram express the fact that points are in a sequence?




Q.5.Prepare object diagrams showing at least 10 relationships among the following object classes.
   Include associations. Aggregations and generalizations. Use qualified associations and show
   multiplicity balls in yours diagrams. You do not need to show attributes or operations. Use
   association names where needed. As you prepare the diagram, you may add additional object
   classes.
   a. School, playground, principal, school, classroom,, book, student, teacher, cafeteria, restroom,
       computer, desk chair ruler door, swing.
Created By: Vipin Kumar                                                                   Jai Shani Dev
   b. Castle, moat, drawbridge, tower, ghost, stairs, dungeon, floor, corridor, room, window, stone,
      lord, lady, cook.
   c. Expression, constant, variable, function, argument list, relational operator, term, factor,
      arithmetic operator, statement program.
   d. File system, file, directory, file name, ASCII file, executable file, directory file, disk drive, track,
      sector.
   e. Automobile, engine, wheel, brake, brake light, door, battery, muffler, tail pipe
   f. Gas furnace, blower, blower motor, room thermostat, furnace thermostat, humidifier, humidity
      sensor, gas control, blower control, hot air vents.
   g. Chess piece, rank, file square, board, move, position, sequence of moves
   h. Sink, freezer, refrigerator, table, light, switch, window, smoke alarm, burglar alarm, cabinet,
      bread, cheese, ice, door, kitchen

                                             Tutorial Sheet 2

Q.1 Categorize the following relationship into generalization, aggregation, or association. Beware,
   there may be ternary or n-ary associations in the list so do not assume every relationship involving
   three or more object classes is a generalization. Defend your answers.
   a. A country has a capital city.
   b. A dining philosopher is using a fork.
   c. A file is an ordinary file or a directory file.
   d. Files contain records.
   e. A polygon is composed of an ordered set of points.
   f. A drawing object is text, a geometrical object, or a group.
   g. A person uses a computer language on a project.
   h. Modems and keyboards are input/ output devices.
   i. Object classes may have several attributes.
   j. A person plays for a team in a certain year.
   k. A route connects two cities.
   l. A student takes a course from a professor.

Q.2.Prepare an object diagram for graphical document editor that supports grouping, which is a
   concept used in a variety of graphical editors. Assume that a document is composed of several
   sheets. Each sheet contains drawing objects, including text, geometrical objects and groups. A
   group is simply a set of drawing objects, possibly including other groups. A group must contain at
   least two drawing objects. A drawing object can be a direct member of at most one group.
   Geometrical object include circles. ellipses, rectangles. Lines and squares.

Q.3. A directory file contains information about files in a directory, including both ordinary files as well
   as other directory files. Prepare an object diagram which models directory files and ordinary files.
   Since a directory plus a file name uniquely identifies a file, you will probably want to use file name
   as qualifier.

Q.4. Following figure is a portion of a met model which describes generalization. A generalization is
   associated with several generalization roles, which are the roles that object classes play in
   generalization relationships. Role type is either subclass or superclass. Does this model support
   multiple inheritances? Explain your answer.



Created By: Vipin Kumar                                                                        Jai Shani Dev
    Generalization                 Generalization role               Object class
    Discriminator                  role type                         class name




Q.5. Prepare a portion of an object diagram for a library book checkout system that shows the date a
   book is due and the late charges for an overdue book as derived objects.

                                            Tutorial Sheet 3

Q.1. Write scenarios for the following activities:
   (a.) Moving a bag of corn, a goose, and a fox across a river in a boat. Only one thing may be
   carried in the boat at a time. If the goose is left alone with the corn, the corn will be eaten. If the
   goose is left alone with the fox, the goose will be eaten. Prepare two scenarios, one in which
   something gets eaten and one in which everything is safely transported across the river.
   (b.) Getting ready to take a trip in your car. Assume an automatic transmission. Don’t forget your
   seat belt and emergency brake.
   (c.) An elevator ride to the top floor.
   (d.) Operation of car cruise control. Include an encounter with show moving traffic that requires
   you to disengage and then resume control.

Q. 2. The direction control for some of the toy electric trains was accomplished by interrupting the
   power to the train. Prepare state diagram for the headlight and wheels of the train, corresponding
   to the following scenario.
   Power is off, train is not moving.
   Power is turn on, train moves forward and train headlight shines.
   Power is turn off, train stops and headlight goes out.
   Power is turn on, headlight shines and train does not move.
   Power is turn off, headlight goes out.
   Power is turn on, train runs backward with its headlight shining.
   Power is turn off, train stops and headlight goes out.
   Power is turn on, headlight shines and train does not move.
   Power is turn off, headlight goes out.
   Power is turn on, train runs forward with its headlight shining.

Q.3. A simple digital watch has a display and two buttons to set it, the A button and the B button. The
   watch has two modes of operation, display time and set time. In the display time mode, hours and
   minutes are displayed, separated by a flashing colon. The set time mode has two submodes, set
   hours and set minutes. The A button is used to select modes. Each time it is pressed the modes
   advances in the sequence: display, set hours, set minutes, display etc. Within the sub modes, the
   B button is used to advance the hours or minutes once each time it is pressed. Buttons must be
   released before they can generate another event. Prepare a state diagram of the watch.

Q.4. Describe the meaning of the data flow diagram in following figure.




Created By: Vipin Kumar                                                                    Jai Shani Dev
Q.5. Prepare a data flow diagram for computing the volume and surface area of a cylinder. Inputs are
   the height and radius of the cylinder. Output is volume and surface area. Discuss several ways of
   implementing the data flow diagram.


                                           Tutorial Sheet 4

Q.1.   Differentiate between the SA / SD methodology and the Jackson’s Structured Development
       methodology with proper illustrations.

Q.2.   With the help of proper illustrations differentiate between the concepts of association and
       aggregation.

Q.3.   List the features of the Object Oriented Programming? What are the Object – Oriented
       Languages? List any five such languages along with their specific characteristics.
Q4.    What do you mean by the State Diagram and the Event Trace Scenario? Draw the Event
       Trace Scenario for a Phone Call and the State Diagram for Phone Line.

Q5.    What do you mean by translation of the object – oriented design into an implementation?
       Discuss the major steps during the translation process. List the Critical Success Factors for the
       aforesaid translation.


                                            Tutorial Sheet 5
Q.1    What is a constructor? How does it differ from a method? Can we overload constructors?
Q.2    What is the difference between Overloading and Overriding?
Q.4    What is type casting? What are its uses? What are the objects on which casting can be
       applied?
Q.5    What are arrays? How can values be stored in them?
Q.6    Is it possible to overloaded methods? Explain.
       a) Static and Final
Q.5    Write down C++ features that are not supported by Java.
Q.6    What is a modifier? Explain the different modifiers used in Java.

Created By: Vipin Kumar                                                                   Jai Shani Dev
                                           Tutorial Sheet 6

Q.1   WAP to create a class named as Bank, which should hold three variables namely Deposit,
      Withdraw and Balance; all of integer type. The class Bank should inherit the Exception class.
      Create another class named as Operation, to accept the amount to be withdrawn by the user.
      If the amount to be withdrawn by the user is greater than the balance amount then a message
      “Invalid Transaction” should be printed on the screen.
Q.2   WAP to create an abstract class named as shapes, which contain as abstract method, named
      as Area. Use this abstract method in classes denoting different kinds of triangles i.e. Right
      Angled Triangle, Isosceles Triangle, Scalene Triangle and Equilateral Triangle to find out there
      area.
Q.3   WAP to create a class named as Polygon, which contains a method as compute. The method
      named as Compute should allow the user to find out each integer angle of any polygon. The
      Polygon class should also contain a method named as Total to find out the sum of all angles in
      the polygon. Inherit this class into classes resembling polygons i.e. Pentagon, Hexagon,
      Heptagon, Octagon, Nonagon and Decagon and calculate the value of each integer angle and
      the sum of angles.
                                           Tutorial Sheet 7

Q.1   What is multithreading?
Q.2   What is the working of run, start, stop, yield, sleep, wait, suspend, resume, notify, notifyAll,
      getPriority, setPriority, join, isAlive etc. methods?
Q.3   What is Inter-Threaded Communication?
Q.4   What is dead lock?
Q.5   How threads are scheduled? How they are affected by priorities?
Q.6   What is an applet? And also explain the life cycle of Applet?


                                            Tutorial Sheet 8

Q.1   What do you mean by I/O?
Q.2   What are the differences between reader/writer and input/output stream classes?
Q.3   What is Java-Bean? And differentiate Java-Bean and Enterprise Java Beans?
Q.4   What do you mean by Client/Server Architecture. And how can we establish connection
      between Client & Server by using Java Programming?
Q.5   What are Servlets? And what is the life cycle of servlet?
Q.6   What do you mean by protocol dependent and protocol independent Servlet?




Created By: Vipin Kumar                                                                     Jai Shani Dev

						
Related docs
Other docs by nikeborome
DTU artefact
Views: 164  |  Downloads: 0
WCPT News March COPY
Views: 5  |  Downloads: 0
Minerals Not Rocks
Views: 93  |  Downloads: 0
UW Website Designers
Views: 1  |  Downloads: 0
feb web master
Views: 184  |  Downloads: 0
GURPS Metric
Views: 154  |  Downloads: 0