FINAL EXAM Flashcards

1
Q

What is the single responsibility principle?

A

A class or module should have only one reason to change, focusing on a single responsibility or functionality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the open closed principle?

A

Software entities should be open for extension but closed for modification, allowing new functionality without altering existing code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the Liskov Substitution Principle?

A

Subtypes should be substitutable for their base types, ensuring that derived classes maintain the behavior of their parent class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the Interface Segregation Principle?

A

Interfaces should be small and focused, preventing the dependency on methods that aren’t relevant to a class’s functionality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the Dependency Inversion Principle?

A

High-level modules should not depend on low-level modules, instead, both should depend on abstractions, promoting flexibility and decoupling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a requirement?

A

Something the system must do in order to
function correctly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a use case?

A

The steps the system takes to complete a
requirement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Use Case Relationships should include?

A

Associations, includes «include», extends «extent» and generalization.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the Model-View-Controller (MVC) pattern?

A

Model-View-Controller (MVC) pattern is a software design pattern that separates the application logic into three interconnected components:

Model: Represents the application’s data and business logic, responsible for retrieving and storing data, as well as processing and managing it.
View: Represents the user interface and presentation of the data, responsible for displaying the data from the Model to the user.
Controller: Acts as an intermediary between the Model and View, responsible for receiving user inputs from the View, processing them, and updating the Model and View accordingly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the Factory Pattern?

A

The Factory pattern is a creational design pattern used in software development that provides an interface for creating objects in a superclass, allowing subclasses to determine which class to instantiate. Instead of calling a constructor directly to create an object, the Factory pattern uses a separate method or class (the “factory”) to create and return instances of different classes based on input parameters or conditions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a singleton pattern?

A

The Singleton pattern is a creational design pattern that ensures a class has only one instance throughout the application’s lifecycle and provides a global access point to that instance. This pattern is useful when a single, shared object is needed to coordinate actions across multiple components or when it’s important to control the number of instances of a class due to resource constraints or to maintain consistency.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The principle that states “Software entities should be open for extension but closed for modification” is known as:

a) Single Responsibility Principle
b) Open Closed Principle
c) Liskov Substitution Principle
d) Dependency Inversion Principle

A

b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A relationship where we can say class B “is-a” class A is best modelled as:

a) Inheritance
b) Aggregation
c) Composition
d) Delegation

A

a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When you only want one instance of a class to exist ever in your program, you should:

a) Use a static variable to represent the single instance
b) Use a singleton pattern
c) Use a factory pattern
d) Use the MVC Pattern

A

b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which design pattern separates an application into three interconnected components: Model, View, and Controller?

a) Singleton Pattern
b) Factory Pattern
c) MVC Pattern
d) Adapter Pattern

A

c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The principle that suggests “High-level modules should not depend on low-level modules; both should depend on abstractions” is known as:

a) Single Responsibility Principle
b) Interface Segregation Principle
c) Liskov Substitution Principle
d) Dependency Inversion Principle

A

d

17
Q

A design pattern that allows an object to change its behavior dynamically at runtime is called:

a) Decorator Pattern
b) State Pattern
c) Observer Pattern
d) Strategy Pattern

A

d

18
Q

Which design pattern allows for the creation of objects without exposing the instantiation logic to the client?

a) Factory Pattern
b) Singleton Pattern
c) Proxy Pattern
d) Bridge Pattern

A

a

19
Q

The principle that states “Classes should be small and focused, preventing the dependency on methods that aren’t relevant to their functionality” is known as:

a) Single Responsibility Principle
b) Open Closed Principle
c) Liskov Substitution Principle
d) Interface Segregation Principle

A

d

20
Q

Which design pattern defines a one-to-many dependency between objects, so that when one object changes state, all its dependents are notified and updated automatically?

a) Observer Pattern
b) Mediator Pattern
c) Command Pattern
d) Chain of Responsibility Pattern

A

a

21
Q

A design pattern that provides a simplified interface to a complex subsystem is called:

a) Facade Pattern
b) Adapter Pattern
c) Proxy Pattern
d) Composite Pattern

A

a

22
Q

Which pattern is used to decouple an abstraction from its implementation so that the two can vary independently?

a) Adapter Pattern
b) Bridge Pattern
c) Decorator Pattern
d) Flyweight Pattern

A

b

23
Q

A design pattern that represents a group of objects as if they were a single instance of the same type is called:

a) Composite Pattern
b) Proxy Pattern
c) Facade Pattern
d) Mediator Pattern

A

a

24
Q

The principle that states “Subtypes should be substitutable for their base types” is known as:

a) Single Responsibility Principle
b) Liskov Substitution Principle
c) Interface Segregation Principle
d) Dependency Inversion Principle

A

b

25
Q

Which design pattern allows for sharing a common state between multiple instances to reduce memory usage?
a) Singleton Pattern
b) Flyweight Pattern
c) State Pattern
d) Proxy Pattern

A

b