CS 535 Object-Oriented Programming & Design Spring Semester, 1999 Some Review Questions |
||
---|---|---|
© 1999, All Rights Reserved, SDSU & Roger Whitney San Diego State University -- This page last updated 06-Apr-99 |
Some Review Questions CS 535 has changed from past semesters. Here are some exam questions from related courses. I have removed questions that clearly were not related to this course. Some of the questions may be marginally related to this course. I have kept the original numbering on the problems.
CS 635
Exam, Spring 1998
7. What is Interface Coupling? Give two ways to reduce it.
8. What is the difference between internal object coupling and cohesion of an object.
9. Define procedural cohesion.
Final Exam, Spring 1997
6. What is control coupling? Give an example. Give one way to reduce control coupling.
7. Explain one of the following types of cohesion: Logical, Temporal, Procedural, Communication, and Sequential. (Coincidental and Functional are left off the list on purpose.) Give an example.
8. Beginning Java programmers often create an interface (or an abstract class) to hold constants. Then each class that uses one or more constants inherits the interface (abstract class). What type(s) of cohesion does (or could) such an interface (abstract class) exhibit?
9. What is a primitive method? Why are they considered desirable?
CS 535
Fall 1997
Final
3a. What is polymorphism?
b. Explain how to achieve polymorphism in Java or C++.
6. We have two classes A and B. What relationship between A and B do the following phrases indicate. Please indicate the role of A and B in the relationship. For example: A is the parent of B.
a. A is-kind-of B
b. A is-analogous-to B
c. A has-a B
d. A depends-upon B
8. a. What is a scenario?
b. What do we use scenarios for in object-oriented design?
9. Identify the classes in the following description of a refrigerator. List at least one responsibility for each class.
A refrigerator has a motor, a temperature sensor, a light and a door. The motor turns on and off primarily as prescribed by the temperature sensor. However, the motor stops when the door is opened. The motor restarts when the door is closed if the temperature is too high. The light is turned on when the door opens and is turned off when the door is closed.
Fall 1996
Midterm Exam
8) We have two classes A and B. What relationship between A and B do the following phrases indicate. Please indicate the role of A and B in the relationship. For example: A is the parent of B.
a) Is-kind-of
b) is-analogous-to
c) has-a
9) True or False . The average number of fields per class should be less than 6.
Fall 1995
Midterm Exam
4) Explain the object-oriented meaning of the following terms. a) client-server b) responsibilities c) scenario 6) We have two entities A and B. What relationship between A and B do the following phrases indicate. Please indicate the role of A and B in the relationship. For example: A is the parent of B. a) A is a B b) A is part of B c) A uses B d) A is kind of B
Final Exam
3) What problem does multiple inheritance cause? How does C++ solve the problem?
4) What are the major steps in the Wirfs-Brock design process?
5) What is the difference between a superclass and a subsystem?
6) a) What is an abstract class?
b) How do you indicate an abstract class in C++?
7) Given classes A and B, what is the most likely relationship between A and B indicated by the phrases:
a) A is a kind of B
b) A uses B
c) A is similar to B
d) A depends on B
e) A has knowledge of B
Fall 1994
Final Exam
Mini-Adventure (MA). The game MA consists of a maze of rooms. A room consists of four walls and one or more doors. Doors can be either open, close, or closed and locked. Some locked doors are opened by a key, others are opened by a magic phrase. Each key opens only one door, except for the master key. Doors lead into other rooms. Rooms are rectangular shaped. Long skinny rooms are called hallways. Rooms may contain gold coins, keys, and/or scrolls with magic phrases. When picked up, scrolls self destruct in a fixed amount of time. This time differs for each scroll. The goal of the game is to explore the rooms and collect as much gold as possible. A player can move around using commands as: goUp, goDown, goLeft, goRight, gotoX where X can be Door, key, scroll, and pickUpX where X can be key, scroll, and gold. Each time a game is played a new maze is created and the player starts in a randomly selected room. A player can see on the screen only the contents of the current room and the outline of rooms they have already been in.
2 a. Give a list of potential classes for the MA game.
b. Pick a class from part a. and give a list of responsibilities for the class,
3. Give a detailed scenario for the game MA involving the class in problem 2b.
4. a. What is an abstract class?
b. What is the purpose of abstract classes in object-oriented programming?
5. Define the following terms in object-oriented programming.
a. client-server
b. contracts
c. protocol
6. What is permitted and what is not permitted by the law of Demeter?
7. a. Why do some object-oriented experts recommend programmers avoid case (and if) statements?
b. Give two alternative mechanisms to case (and if) statements.
Fall 1993
Final Exam
1) Explain the object-oriented meaning of the following terms.
a) abstraction
b) encapsulation
c) information hiding
2) What problem(s) does multiple inheritance have that single inheritance does not?
3) a) What is polymorphism?
b) Give an example of polymorphism in C++.
4) Why is polymorphism important in object-oriented programming?
5) We have two classes A and B. What do the following relationships indicate about the two classes:
a) A is-a B
b) A has-a B
c) A is-kind-of B
d) A is-analogous-to B
e) A depends-upon B
6) a) What is a scenario?
b) What role(s) do scenarios play in object-oriented design.
7) Identify the classes in the following description of a refrigerator. List at least one responsibility for each class.
A refrigerator has a motor, a temperature sensor, a light and a door. The motor turns on and off primarily as prescribed by the temperature sensor. However, the motor stops when the door is opened. The motor restarts when the door is closed if the temperature is too high. The light is turned on when the door opens and is turned off when the door is closed.
8) a) What is a subsystem?
b) What is the purpose of a subsystem in the Wirfs-Brock object-oriented design process?
c) Why are subsystems found toward the end of the process, rather than at the beginning?
9) What is a contract? Give an example.
10) Briefly describe the steps in the Wirfs-Brock object-oriented design process.
Copyright ©, All rights reserved.
1999 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.
Previous    visitors since 06-Apr-99    Next