Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Final Exam - Fall 2017, Exams of Pathophysiology

53 Unsolved Short uestions.

Typology: Exams

2021/2022

Uploaded on 02/24/2022

ekaling
ekaling 🇺🇸

4.7

(39)

266 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Object-Oriented Design, IV1350 Exam Questions
Exam Questions
Object-Oriented Design, IV1350
The maximum exam score is 100, grade limits are as follows.
Score Grade
90 A
80 B
70 C
60 D
50 E
The exam questions will be a subset of the questions below. The exam may contain
one or two (but not more) questions that are not listed in this document.
Object-Oriented Analysis
1. Explain the goal of analysis. (5p)
2. What is the purpose of a system sequence diagram? (5p)
3. Create a system sequence diagram for the following scenario. Scenario will be
presented at exam. (5p)
4. Explain what a domain model is and what function it fulfills. (5p)
5. Describe two methods to find class candidates to a domain model. (5p)
6. Specify how you can determine which associations to include in a domain model.
(5p)
7. Specify a guideline for when an abstraction should be modeled as a class and when
it should be modeled as an attribute in the domain model. (5p)
8. Motivate why the following abstractions should be represented as a class or why
they should be represented as an attribute in the domain model. Abstractions will
be presented at exam. (5p)
1 (6)
pf3
pf4
pf5

Partial preview of the text

Download Final Exam - Fall 2017 and more Exams Pathophysiology in PDF only on Docsity!

Exam Questions

Object-Oriented Design, IV

The maximum exam score is 100, grade limits are as follows.

Score Grade 90 A 80 B 70 C 60 D 50 E

The exam questions will be a subset of the questions below. The exam may contain one or two (but not more) questions that are not listed in this document.

Object-Oriented Analysis

  1. Explain the goal of analysis. (5p)
  2. What is the purpose of a system sequence diagram? (5p)
  3. Create a system sequence diagram for the following scenario. Scenario will be presented at exam. (5p)
  4. Explain what a domain model is and what function it fulfills. (5p)
  5. Describe two methods to find class candidates to a domain model. (5p)
  6. Specify how you can determine which associations to include in a domain model. (5p)
  7. Specify a guideline for when an abstraction should be modeled as a class and when it should be modeled as an attribute in the domain model. (5p)
  8. Motivate why the following abstractions should be represented as a class or why they should be represented as an attribute in the domain model. Abstractions will be presented at exam. (5p)

Object-Oriented Design

  1. Explain the goal of design. (5p)
  2. Specify when each of the four different accessibilities (public, private, etc) should be used. (5p)
  3. Explain the difference between public interface and implementation. (5p)
  4. Which part is the public interface and which part is the implementation in a subsystem consisting of many classes and interfaces? (5p)
  5. The following design has low cohesion. Explain why and suggest a change that will give high cohesion. The design will be presented at exam. (5p)
  6. Explain the meaning of encapsulation and give an example of the benefits of en- capsulation. (5p)
  7. Explain the meaning of cohesion and give an example of the benefits of high cohe- sion. (5p)
  8. Explain the meaning of coupling and give an example of the benefits of low cou- pling. (5p)
  9. Explain why it is not good that a method has greater dependency on another class than the one in which it is found. (5p)
  10. Explain the meaning of polymorphism. (5p)
  11. What are the advantages of using polymorphism? (5p)
  12. Give an example where polymorphism is used. Implement the example in a pro- gram, you do only have do code classes relevant for the polymorphism. (10p)
  13. Suppose we have a class, call it Server, which has some desired functionality. Sup- pose further that we want to be able to replace it with another class, OtherServer, which performs the same task but in a different way. It must be possible to switch between Server and OtherServer without having to recompile the classes that call them. Write a program which solves this problem with the help of polymorphism. (10p)
  14. Give an example of how you can use an interface to give different classes a common public interface. Write a program that demonstrates how objects of the classes can be called using polymorphism. (10p)
  15. The classes Person and Airplane shall have the property to to print information about themselves on a printer. Show how to design this using an interface for the property to print. Draw class and interaction diagrams. You do not need to use correct class or method name to manage printouts. (5p)
  1. Is there any occasion when it is better to make everything in a class static instead of making it a singleton? If yes, which? (5p)
  2. Name three important characteristics of a controller. (5p)
  3. Why can it cause problems to inherit classes that are not intended to be inherited? Give two different reasons. (5p)
  4. What conditions must be met to make it appropriate to create a new class hierarchy using inheritance? Neither superclass nor subclass exist before, the question is about designing a new class hierarchy.
  5. Suppose you are about to code a particular class and find that you have written another class with nearly the functionality that you now are developing. This means that the two classes in large parts contain the same code, but in smaller parts have different code. Explain in detail why this may be a problem and how to solve it. (5p)
  6. Suppose you are about to code a certain functionality, and that in a program library you are using there is a class that has almost the sought functionality. Is there any reason to still use that class and, if so, how can you add the functionality it is missing?
  7. a) Suppose you have the class hierarchy shown below, how can you change the program to use composition instead of inheritance? The functionality should not be changed. Answer with class diagram or code. (5p)

b) Explain why composition is more appropriate than inheritance if the super- class is not intended to be inherited. (5p)

  1. Explain why exceptions should only be used when an error has occurred. (5p)
  2. Explain when an inner class is appropriate. Give a concrete example of using an inner class. (5p)

Object-Oriented Programming

  1. Implement the following class diagram/communication diagram/sequence diagram in correct code. You are required to use the strongest possible encapsulation. The diagram will be presented at the exam. (10p)
  2. Explain why duplicated code may cause problems (it’s not enough to write that it “is almost impossible to maintain”) and how you can eliminate the duplicated code. (5p)
  3. Explain why long methods may cause problems and how you can split long meth- ods. (5p)
  4. Why is it inappropriate that methods have long parameter lists? Explain how long parameter lists can be shortened. (5p)
  5. Suppose your program consists of a few large classes that have many fields with primitive data. Why is this a problem and what can you do about it? (5p)
  6. Why is it a problem if a large part of the input parameters to methods are primitive data instead of objects. Explain how you can solve that problem. (5p)
  7. Describe where in the code you would write comments. Explain both why you want comments where you place them and why you do not want comments in other places. (5p)
  8. Assume that your program contains a user interface where the user enters an ID as a string. Specify why it is a good practice to convert the string to an object that represents the ID. Which object should be responsible for the conversion from string to ID? Motivate! (5p)
  9. Explain how you want to name packages and how you want to divide the source code in packages. Suppose you’re talking about a new program, you do not need to worry about any previous package structure. (5p)
  10. How would you like to package utility classes? Indicate in which package(s) you would place a class that parses strings and a class that handles URLs. (5p)

Object-Oriented Architecture

  1. Explain how you can use the patterns MVC and Layer to create a good architecture. (10p)
  2. Explain which the three different parts of the MVC pattern are, what they should contain and how they can communicate with each other. (10p)
  3. Explain why objects in the model never shall call objects in the view when the MVC pattern is used. (5p)