• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 28 pages
Exam (elaborations)

Advanced Object Oriented Programming TEST QUESTIONS & ANSWERS ALREADY GRADED A+ 2025 Terms in this set (174) Intent of Command Pattern To encapsulate a function call as an object. Consequence of Command Pattern Decouples objects that invoke a given opera

Document preview thumbnail
Preview 3 out of 28 pages

Advanced Object Oriented Programming TEST QUESTIONS & ANSWERS ALREADY GRADED A+ 2025 Terms in this set (174) Intent of Command Pattern To encapsulate a function call as an object. Consequence of Command Pattern Decouples objects that invoke a given operation with ones that know how to perform it. Intent of the Interpreter Pattern Define a representation for a languages grammar along with an interpreter that uses the representation to interpret sentences of that language. Consequence of Interpreter Pattern It's easy to change and extend the grammar (generally just add a new class). Intent of the Iterator pattern It provides a way to access elements of an aggregate collection without exposing the underlying representation. Consequence of the Iterator pattern They support variations in the interpretation of a collection or aggregate. With complex collections the desired type of traversal may change and using this pattern makes it easier to change the traversal algorithm. What is a robust iterator? An iterator that ensures that insertions and removals won't interfere with traversal, and does so without copying the collection. What is the intent of the Memento Pattern? Without violating encapsulation (private variables), it allows one to capture and externalize an object's internal state so that the object can later be restored to that state.

Content preview

Advanced Object Oriented
Programming TEST QUESTIONS &
ANSWERS ALREADY GRADED A+ 2025


Terms in this set (174)

Intent of Command To encapsulate a function call as an object.
Pattern

Consequence of Decouples objects that invoke a given operation with ones that
Command Pattern know how to perform it.

Intent of the Interpreter Define a representation for a languages grammar along with
Pattern an interpreter that uses the representation to interpret
sentences of that language.


Consequence of It's easy to change and extend the grammar (generally just add
Interpreter Pattern a new class).

Intent of the Iterator It provides a way to access elements of an aggregate
pattern collection without exposing the underlying representation.



Consequence of the They support variations in the interpretation of a collection or
Iterator pattern aggregate. With complex collections the desired type of
traversal may change and using this pattern makes it easier to
change the traversal algorithm.




What is a robust iterator? An iterator that ensures that insertions and removals won't
interfere with traversal, and does so without copying the
collection.



Without violating encapsulation (private variables), it
What is the intent of the
allows one to capture and externalize an object's internal
Memento Pattern?
state so that the object can later be restored to that state.

,Consequence of the It provides encapsulation boundaries. And prevents the
Memento Pattern exposure of contents while enabling an object to store its
state.


What is the intent of the To allow an object to alter its behavior when its
State Pattern? internal state changes. The object will appear to
change its class.


Consequence of the State It localizes the state-specific behavior and partitions behavior for
Pattern different states.

What is the intent of the It defines a family of algorithms, encapsulating each one
Strategy Pattern? and then makes them interchangeable. The algorithms
are also decoupled from clients.


Consequence of the They create families of related algorithms and can leverage
Strategy Pattern inheritance to simplify implementation of commonly-used
functionality.


What is the intent of the To define a new operation without changing the classes of
Visitor Pattern? the elements on which it operated to. It represents an
operation to be performed on elements of an object
structure as a class.


Consequence of the The adding of new operations becomes easy as it removes the
Visitor Pattern task of modifying existing classes.

What is the intent of the To compose objects into tree structures and represent part-
Composite Pattern? whole hierarchies. It lets clients treat individual objects and
compositions of objects uniformly.



Consequence of the They define a class hierarchy of primitive and composite
Composite Pattern objects.

Shearing Layer The state in which between layers where they change from
one speed to another. One layer may be changing slower
than another.

, Program to Interface
Two main design principles
Favor Composition over Inheritance


Program to Interface We don't know what something does. In fact it is better
that we don't know as each time an operation happens
there is a different implementation of the interface.
Example: Accept => Turtle, Accept => Visitor


Favor Composition over Composition gives us flexibility like the strategy pattern.
Inheritance Instead of creating subclasses to store priority at compile
time, use a priority class to change it during runtime.



Coupling One class knowing about the other.


Ex. Turn Expression knowing about the Memento.
(coupled). Also Expressions and Visitors.

Cohesion This is good. We want lots of it. When looking at a class or
function, what is the task that we are trying to accomplish?
Putting "PrintStudents" in a priority queue will make it less
cohesive.


The interpreter pattern is False. It is not going to be as efficient as assembly code.
efficient.

Difference between State Structure is the same. State expects that the object should
and Strategy pattern change its state frequently while the Strategy typically does
not.


Is adding a new Visitor Yes but if you add a new type of visit or the grammar
easy? changes, you must go to each visitor class and change the
grammar/new type to visit.


What design pattern Iterator. We don't know the structure because the iterator
reduces coupling handles that.
between classes?

Document information

Uploaded on
February 23, 2025
Number of pages
28
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$15.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Quizlettt
5.0
(1)
Sold
1
Followers
0
Items
319
Last sold
6 months ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions