100% found this document useful (1 vote)
266 views13 pages

CSC 312 Test Answers

This document contains the answers to a CSC 312 test from the 2018/2019 academic session. It includes answers to 14 multiple choice and short answer questions covering topics like object-oriented design, analysis, the evolution of object-oriented concepts, what makes a language object-oriented, types of abstraction, encapsulation, and benefits of the object model.

Uploaded by

Kc Mama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
266 views13 pages

CSC 312 Test Answers

This document contains the answers to a CSC 312 test from the 2018/2019 academic session. It includes answers to 14 multiple choice and short answer questions covering topics like object-oriented design, analysis, the evolution of object-oriented concepts, what makes a language object-oriented, types of abstraction, encapsulation, and benefits of the object model.

Uploaded by

Kc Mama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

CSC 312 2018/2019 academic session

TEST ANSWERS
1. Write briefly on the following concepts: (The object model p14. Sec1)

Ans: Object oriented design and Object oriented analysis

i. Object-oriented design (OOD) is a method of design


encompassing the process of object oriented decomposition and a
notation for depicting both logical and physical as well as static and
dynamic models of the system under design.
ii. Object-oriented analysis (OOA) is a method of analysis that
examines requirements from the perspective of the classes and
objects found in the vocabulary of the problem domain

2. Define an object in terms of its composition and integrity.

3. According to Levy, enumerate any three (3) events that contributed to the
evolution of OO concepts (The object model p11. CH2)

Ans:

i. Advances in computer architecture, including capability systems and


hardware support for operating systems concepts
ii. Advances in programming languages, as demonstrated in Simula,
Smalltalk, CLU, and Ada
iii. Advances in programming methodology, including modularization
and information hiding

4. What are the conditions that determine if a given programming language is


object oriented or not?(The object model p13 CH2)

Ans: A language is object-oriented if and only if it satisfies the


following requirements:

i. It supports objects that are data abstractions with an interface of


named operations and a hidden local state.
ii. Objects have an associated type [class].
iii. Types [classes] may inherit attributes from supertypes [superclasses]

5. Elucidate on the two sweeping trends that were historically responsible for
the evolution of the object model.(The object model p2 Sec1)

Ans: two sweeping trends responsible for evolution of object


model:

1 2018/2019 CSC312 test answered by TK


i. The shift in focus from programming-in-the-small to programming-
in-the large
ii. The evolution of high-order programming languages

{----more explanation needed----}

6. Describe the topology of the following generations of programming


languages.(The object model p1-2 Sec1)

i. Second generation (1959-1961)


ii. The generation Gap (1970-1980)

7. In transitioning from algorithmic decomposition to OO decomposition,


subprograms emerged as abstraction mechanism rather than ordinary labour-
saving devices. Explain the three key consequences of this development in the
1960s. (The object model p10. Sec1)

Ans:

8. What do you understand by the twin principle of least commitment and


that of least astonishment as applicable to the activity of abstraction? (The
object model p16 Sec1)

Ans:

An abstraction focuses on the outside view of an object and so serves to


separate an object’s essential behavior from its implementation. Abelson and
Sussman call this behavior/implementation division an abstraction barrier
achieved by applying the principle of least commitment, through which
the interface of an object provides its essential behavior, and nothing more.
We like to use an additional principle that we call the principle of least
astonishment, through which an abstraction captures the entire behavior of
some object, no more and no less, and offers no surprises or side effects that
go beyond the scope of the abstraction. {----more precise explanation
needed----}

9. Enumerate the four spectrum of abstraction you know (The object model
p17 CH2)

Ans: Spectrum of abstraction

i. Entity abstraction: An object that represents a useful model of a


problem domain or solution domain entity
ii. Action abstraction: An object that provides a generalized set of
operations, all of which perform the same kind of function

2 2018/2019 CSC312 test answered by TK


iii. Virtual machine abstraction An object that groups operations
that are all used by some superior level of control, or operations that
all use some junior-level set of operations
iv. Coincidental abstraction: An object that packages a set of
operations that have no relation to each other

10. Justify he essence of encapsulation and the concepts of separation of


concerns (The object model p23 CH2)

Ans: Encapsulation is the process of compartmentalizing the elements of an


abstraction that constitute its structure and behavior; encapsulation serves to
separate the contractual interface of an abstraction and its implementation.

{//Encapsulation provides explicit barriers among different abstractions


and thus leads to a clear separation of concerns.----more explanation
needed----}

11. What is the overall goal of decomposition into modules and its technical
concerns? (The object model p28 Sec1)

Ans:

As Britton and Parnas have observed, “The overall goal of the


decomposition into modules is the reduction of software cost by allowing
modules to be designed and revised independently. . . . Each module’s
structure should be simple enough that it can be understood fully; it should be
possible to change the implementation of other modules without knowledge of
the implementation of other modules and without affecting the behavior of
other modules; [and] the ease of making a change in the design should bear a
reasonable relationship to the likelihood of the change being needed”

12. The two most important hierarchies in complex systems are


generalization/specialization and aggregation. Discuss. (The object model p35
Sec1 & Principles of object oriented programming p15 CH1.3)

Ans {//Whereas these “is a” hierarchies denote generalization/specialization


relationships, “part of” hierarchies describe aggregation relationships.}

i. "Is-a" or "inheritance" (sometimes also called "generalization")


relationships capture a hierarchal relationship between classes of
objects. For instance, a "fruit" is a generalization of "apple",
"orange", "mango" and many others. We say that fruit is an
abstraction of apple, orange, etc. Conversely, we can say that since
apples are fruit (i.e. an apple "is-a" fruit), that they inherit all the
properties common to all fruit, such as being a eshy container for the
seed of a plant.

3 2018/2019 CSC312 test answered by TK


ii. Aggregations are a special type of associations in which the two
participating classes don’t have an equal status, but make a ”whole-
part” relationship. An Aggregation describes how the class that takes
the role of the whole, is composed (has) of other classes, which take
the role of the parts. For Aggregations, the class acting as the whole
always has a multiplicity of one. In UML, Aggregations are
represented by an association that shows a rhomb on the side of the
whole.
“…the idea that one object can be built from (aggregated from)
other objects.”

13. Explain any one of the three minor elements of object model (The object
model p16 Sec1)

{// The object model encompasses the principles of abstraction,


encapsulation, modularity, hierarchy, typing, concurrency, and persistence.
By themselves, none of these principles are new. What is important about the
object model is that these elements are brought together in a synergistic way
}

Ans: There are three minor elements of the object model (By minor, we mean
that each of these elements is a useful, but not essential, part of the object
model.):

i. Typing: Typing is the enforcement of the class of an object, such


that objects of different types may not be interchanged, or at the
most, they may be interchanged only in very restricted ways.
4 2018/2019 CSC312 test answered by TK
ii. Concurrency: Concurrency is the property that distinguishes an
active object from one that is not active.
iii. Persistence: Persistence is the property of an object through which
its existence transcends time (i.e., the object continues to exist after
its creator ceases to exist) and/or space (i.e., the object’s location
moves from the address space in which it was created).

14. In applying the object model, five benefits are eminent. Identify any three
of them. (The object model p44 Sec 1)

Ans: benefits of object model

i. The use of the object model helps us to exploit the expressive power
of object-based and object-oriented programming languages.
ii. The use of the object model encourages the reuse not only of
software but of entire designs, leading to the creation of reusable
application frameworks.
iii. The use of the object model produces systems that are built on stable
intermediate forms, which are more resilient to change. This also
means that such systems can be allowed to evolve over time, rather
than be abandoned or completely redesigned in response to the first
major change in requirements.
iv. Pragmatics, explains further how the object model reduces the risks
inherent in developing complex systems. This benefit accrues
primarily because integration is spread out across the lifecycle rather
than occurring as one major event. The object model’s guidance in
designing an intelligent separation of concerns also reduces
development risk and increases our confidence in the correctness of
our design.
v. The object model appeals to the workings of human cognition. As
Robson suggests, “Many people who have no idea how a computer
works find the idea of object-oriented systems quite natural”

15. What does UML stands for and how does it helps a software developer?
(Notational UML p3 CH5)

Ans:

UML: The Unified Modelling Language, is a graphical modelling


language that provides us with a syntax for describing the major elements
(called artifacts in the UML) of software systems. OR UML is a standard
language for specifying, visualizing, constructing, and documenting the
artifacts of software systems.

5 2018/2019 CSC312 test answered by TK


For a software developer, UML makes it possible to describe a scenario or
formulate an architecture and then unambiguously communicate those
decisions to others.{----more explanation CAN be added----}

16. On a given project, over time, what are the three levels of maturity in which
the system design could evolve? (Notation UML p8)

Ans: On a given project, over time, the system’s design will evolve:

 From conceptual: The conceptual model captures the system in terms of


the domain entities that exist (or will exist) and their association with
other such entities of your system. The conceptual level of modeling is
performed using the terminology of your business domain and should
be technology-agnostic.
 …through logical: The logical view of a system takes the concepts
created in the conceptual model and establishes the existence and
meaning of the key abstractions and mechanisms that will determine
the system’s architecture and overall design.
 …to physical levels of maturity: The physical model of a system
describes the concrete software and hardware composition of the
system’s implementation. Obviously, the physical model is technology-
specific.

17. UML diagrams are classified into compartments. Explain these


classifications

6 2018/2019 CSC312 test answered by TK


{----explanation needed ----}

18. Given the UML models/diagrams below, describe how they can be built
and applied to practical problems using suitable illustrations.

i. Class diagrams ii. Component diagram

iii. Use case diagram iv. State machine diagram

v. Sequence diagram vi. Activity diagram

7 2018/2019 CSC312 test answered by TK


8 2018/2019 CSC312 test answered by TK
9 2018/2019 CSC312 test answered by TK
10 2018/2019 CSC312 test answered by TK
11 2018/2019 CSC312 test answered by TK
19. Design patterns are categorized into thee. List and give four examples of
patterns each (Design patterns p3 TOC)

Ans: categories of design patterns and examples

i. Creational design patterns: ii. Structural design pattern


- Abstract factory - Adapter
- Builder - Bridge
- Prototype - Composite
- Singleton - Façade

iii. Behavioral design pattern


- Mediator
- Iterator
- Observer
- Interpreter

20. What is a design pattern and how would you as a developer benefit from
one? (Design patterns p12 Intro)

Ans:

Design patterns are proven architectures for constructing flexible and


maintainable object-oriented software. The field of design patterns tries to
enumerate those recurring patterns, encouraging software designers to reuse
them to develop better-quality software using less time, money and effort.

As a software developer design patterns will be of benefit to me by

12 2018/2019 CSC312 test answered by TK


 making it easier to reuse successful designs and architectures.
 Expressing proven techniques as design patterns makes them more
accessible to developers of new systems.
 Design patterns will help me choose design alternatives that make a
system reusable and avoid alternatives that compromise reusability.
 Design patterns will help me improve the documentation and
maintenance of existing systems by furnishing an explicit specification
of class and object interactions and their underlying intent.

Put simply, design patterns help a designer get a design "right" faster.

21. In each category of design patterns, describe any one example of a design
pattern, specifying the nature of the problem it addresses, its solution and how
it can be adopted to real-world scenarios.(Design patterns p64)

Ans:

NOTE
1. Questions 2, 6, 7 and 21 are not answered but might be during tutorials
2. Questions having comments “..more explanation needed” might not be
revisited, thus more read should be done on them.
3. Answers provided to the questions are sourced from four (4) materials
provided by the course lecturers.
4. This document is subject to modification as suggestions, criticism and
more elaborations are welcomed.
5. This document is NOT answers to exams questions (rather, already
written test), thus you are advised to read on CSC312 entirely.
6. Shun any form of exam malpractice, keep this document away from
exams hall.

13 2018/2019 CSC312 test answered by TK

You might also like