CS129 Quiz 1-3
CS129 Quiz 1-3
1.TRUE – OOP Views a program as a group of objects that have certain properties and can perform certain functions
2. FALSE – Aggregation is a class relationship which is also known as “is-a” (has-a) relationship
5. FALSE – Static members of a class can be accessed (without) using an object instance of that class
6. TRUE – Constructors can be overload, which means that more than one constructor can be defined in a class.
8. FALSE – When a class defines its own constructor, the default constructor is overridden (over written)
9. FALSE – Constructor parameters may be passed to the parent class using the “base” (new) keyword
12. TRUE – The constructor is automatically called when an object is created or instantiated
15. TRUE – In the definition, class A extends class B, the child class is A
17. TRUE – To “protected” access modifies allows a variable to be visible to the child class only.
19. FALSE - Child class have less (more) functionality than parent class.
20. TRUE – With inheritance, a child class can extend the parent class
23. TRUE – The object class is the root of the inheritance hierarchy in java.
24. TRUE – Through polymorphism, a child class may redefine the behavior of a class
26. FALSE – Inheritance allows a program to acquire all properties and behavior of a class. (not all)
27. FALSE – To implement polymorphism, the child class must overwrite (override) the method of the parent class
28. TRUE – with polymorphism, the object may be determined and created during runtime
29. FALSE – Objects are stored in the stack (heap) portion of the computer memory
GENERALIZATION – G
ASSOCIATION – A
AGGREGATION – AG
COMPOSITION – C
1. COHESION - It describes how closely all the routines or all code in a routine support a central purpose
2. STRATEGY - In this pattern, a class behavior or its algorithm can be changed at a run time
3. BUILDER - This pattern helps us to separate the construction of a complex objects from its representation so
that the same construction process can create different representations.
4. SINGLETON - It is useful when a single, global point of access to a limited resource is required.
5. STRUCTURAL - These design patterns describe how objects and classes can be combined and form a large
structure.
6. ADAPTER - In this pattern, two incompatible types can communicate between each other
7. FACTORY - This pattern is used to delegate the object creation process to another object
8. OBSERVER - This is used to ensure that when one object is modified, its dependent objects are to be notified
automatically
9. COUPLING - It describes how tightly a class or routine is related to other classes or routines
10. SINGLETON - This pattern works properly when synchronization mechanism is applied
11. DECORATOR - This pattern allows adding of new functionality in an existing object without altering its structure
12. FAÇADE - This design pattern provides a simple interface to complex and large code
13. STATE - The vending machine is one good example of this pattern
14. SINGLETON - Design pattern whose construction is declared “private”
15. DESIGN PATTERNS - These are the best practices used by experienced objects-oriented software developers
16. IMPLEMENTATION - Design patterns are primarily based on the object-oriented principle “program to an
interface not an _____.
17. BUILDER - This pattern is useful when constructing a very complex object
18. COHESION? - It is used to centralize class selection code.
19. INEHRITANCE - Design patterns favors composition over _____.
20. BAD - Our programs must be designed to support good cohesion and _____ coupling.