0% found this document useful (0 votes)
253 views

CS129 Quiz 1-3

The quiz contains multiple choice questions testing knowledge of object-oriented programming concepts like inheritance, polymorphism, encapsulation, and design patterns. Many questions ask about relationships between classes like aggregation, composition, generalization and association. Correct answers identify characteristics of object-oriented principles and patterns like singleton, builder, strategy, and observer.

Uploaded by

Rambert C. Ginez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
253 views

CS129 Quiz 1-3

The quiz contains multiple choice questions testing knowledge of object-oriented programming concepts like inheritance, polymorphism, encapsulation, and design patterns. Many questions ask about relationships between classes like aggregation, composition, generalization and association. Correct answers identify characteristics of object-oriented principles and patterns like singleton, builder, strategy, and observer.

Uploaded by

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

QUIZ 1

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

3. TRUE – The constructor and the class have same names.

4. FALSE - C++ (Simula) is the first object oriented programming language.

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.

7. TRUE – Encapsulation is a way to hide members of a class for protection.

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

10. TRUE - The constructor is called only once.

11. TRUE – All classes have constructors

12. TRUE – The constructor is automatically called when an object is created or instantiated

13. FALSE – An object is a definition (instance) of a class.

14. FALSE – The default access modifier is “private” (default)

15. TRUE – In the definition, class A extends class B, the child class is A

16. FALSE – to make a variable read-only, a setter method is provided. (encapsulation?)

17. TRUE – To “protected” access modifies allows a variable to be visible to the child class only.

18. TRUE – Aggregation allows a class to contain a user-defined member variable.

19. FALSE - Child class have less (more) functionality than parent class.

20. TRUE – With inheritance, a child class can extend the parent class

21. TRUE – Java supports multiple inheritance of interfaces

22. TRUE – Constructors can’t be inherited of interfaces.

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

25. TRUE – Polymorphism allows a method to have different implementations

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

30. TRUE – Inheritance allows us to reuse existing codes


QUIZ 2

1. TRUE - A use case represents an internal view of the system


2. TRUE - In composition relationship, Class A and class B have the same lifetime
3. FALSE - The symbol ‘- - - >’ is used to denote realization (dependency)
4. FALSE - The “extends” (includes) relationship is commonly used when a case compulsorily need the behavior of
another
5. TRUE - A use-case diagram actor represents a human and other systems
6. Both generalization and dependency describe an “is a” relationship.
7. TRUE - UML is a graphical language for expressing object-oriented designs.
8. TRUE - Behavioral modeling describes the interaction in the system
9. FALSE - Class Diagram is a graphical representation of the (static) dynamic view that shows a collection of
declarative model and their contents and relationship
10. TRUE - Aggregation is a situation where object of class B retains an existence independent of Class A
11. FALSE – Association (Dependency) is a relationship between two things in which change in one element also
affects the other
12. TRUE - The purpose of activity diagram’s swim-lane is to show the flow of activities in the system
13. FALSE - In composition (aggregation), the part can be shared with other wholes
14. FASLE - Association represent the dynamic (static) relationship between two classes along with the multiplicity
relation between objects
15. TRUE - A simple association typically corresponds to an instance variable in class A of the target class B type

GENERALIZATION – G
ASSOCIATION – A
AGGREGATION – AG
COMPOSITION – C

1. Passenger rides a taxi A


2. A bank account is either savings or current account G
3. Man owns a car AG
4. Photo contains colors C
5. Plant needs sunlight and water AG?
QUIZ 3

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.

You might also like