Design Principles Mid

1 / 9

How can you ensure that a software system maintains adherence to design principles as it evolves over time?

Select the correct answer

1

Design principles are maintained by avoiding the use of design patterns.

2

Adherence to design principles is achieved by frequent refactoring.

3

Ensuring adherence to design principles can be achieved through regular code reviews and automated testing.

4

Adherence to design principles is maintained by writing extensive documentation.

Explain the Law of Demeter.

Select the correct answer

1

The Law of Demeter suggests writing documentation for every class.

2

The Law of Demeter advises that objects should only interact with their immediate friends.

3

The Law of Demeter focuses on minimizing memory usage.

4

The Law of Demeter means optimizing code for speed.

What are some common code smells that may indicate violations of software design principles?

Select the correct answer

1

Common code smells include duplicated code, large classes, and long methods.

2

Common code smells are about missing documentation.

3

Common code smells include too many comments.

4

Common code smells include using modern libraries and frameworks.

What do you understand by the Open-Closed Principle (OCP)?

Select the correct answer

1

The Open-Closed Principle states that software entities should be open for extension but closed for modification.

2

The Open-Closed Principle means code should be easily readable.

3

The Open-Closed Principle is about testing code extensively.

4

The Open-Closed Principle suggests using only open-source libraries.

What is the "Principle of Least Astonishment" in user interface design?

Select the correct answer

1

The 'Principle of Least Astonishment' suggests that a system should behave in a way that users expect.

2

The 'Principle of Least Astonishment' focuses on code optimization.

3

The 'Principle of Least Astonishment' means avoiding the use of complex algorithms.

4

The 'Principle of Least Astonishment' means minimizing the number of features in software.

Explain the concept of "High Cohesion and Low Coupling" in software design.

Select the correct answer

1

High Cohesion means each module has a single responsibility, while Low Coupling means minimal dependencies between modules.

2

High Cohesion is about reducing code duplication, Low Coupling is about reusing modules.

3

High Cohesion means faster execution, Low Coupling means better memory management.

4

High Cohesion focuses on user interfaces, Low Coupling focuses on databases.

Explain Separation of Concerns.

Select the correct answer

1

Separation of Concerns involves dividing a program into distinct sections, each addressing a separate concern.

2

Separation of Concerns is about documenting every function in detail.

3

Separation of Concerns means ensuring data consistency.

4

Separation of Concerns focuses on optimizing code for speed.

Explain composition over inheritance.

Select the correct answer

1

Composition over inheritance encourages using design patterns.

2

Composition over inheritance favors using object composition rather than inheritance.

3

Composition over inheritance suggests writing extensive tests first.

4

Composition over inheritance means preferring simple algorithms.

What is "Cohesion" in software design, and why is it important?

Select the correct answer

1

Cohesion describes the speed at which code executes.

2

Cohesion refers to how closely related the responsibilities of a single module are.

3

Cohesion is about using consistent naming conventions in code.

4

Cohesion means ensuring code compatibility with different systems.