Practice Questions on Design Patterns, MVC And Coupling and Cohesion

MCQs

1. Which of following patterns is not used to create an object?
a) Factory method
b) Prototype
c) Abstract factory
d) Strategy

2. Which of the following pattern is used to provide different implementations of an algorithm?
a) Factory method
b) Prototype
c) Abstract factory
d) Strategy

3. Which pattern is used to provide different implementations for the steps of an algorithm?
a) Factory method
b) Template
c) Abstract factory
d) Strategy

4. Pattern used to create an object on the network is __
a) Factory method
b) Prototype
c) Abstract factory
d) Proxy

5. Pattern for converting from one interface into another interface
a) Factory method
b) Adapter
c) Abstract factory
d) Strategy

6. _ is used for creating only one instance of a class

7.Which pattern does NOT have loose coupling with the client classes
a) Factory method
b) Adapter
c) Abstract factory
d) Strategy

8. A class with high cohesion has
a) methods which are not related to each other
b) methods which are related to each other
c) methods which are used in many other classes
d) all the above

9. Implementing MVC leads to __
a) low coupling and low cohesion
b) low coupling and high cohesion
c) high coupling and low cohesion
d) none of the above

10. When developing a software with GUI which MVC
implementation is the best?
a) (m+v) + c
b) (m) + (v+c)
c) (m+v+c)
d) (m+c) + v

Short Answer Questions

1) How to convert a class to a Singleton?
2) Explain the difference between factory and abstract factory
3) Explain coupling and cohesion.
4) A class has many unrelated methods. How do you correct it? why?
5) A method is doing many unrelated activites. How do you correct it? Why?

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License