0
0
Software Engineeringknowledge~20 mins

Software engineering principles - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Software Engineering Principles Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the Single Responsibility Principle

Which of the following best describes the Single Responsibility Principle (SRP) in software engineering?

AA class should have only one reason to change, meaning it should have only one job or responsibility.
BA class should inherit from multiple classes to reuse code efficiently.
CA class should handle all aspects of a program to reduce dependencies.
DA class should be designed to perform multiple unrelated tasks to improve performance.
Attempts:
2 left
💡 Hint

Think about how responsibilities affect the reasons for changing a class.

📋 Factual
intermediate
2:00remaining
Identifying the Open/Closed Principle

What does the Open/Closed Principle (OCP) state about software entities like classes or modules?

AThey should be open for both extension and modification.
BThey should be open for modification but closed for extension.
CThey should be closed for both extension and modification.
DThey should be open for extension but closed for modification.
Attempts:
2 left
💡 Hint

Consider how new features should be added without changing existing code.

🔍 Analysis
advanced
2:30remaining
Applying the Liskov Substitution Principle

Given a base class Bird with a method fly(), and a subclass Penguin that cannot fly, which design violates the Liskov Substitution Principle (LSP)?

APenguin overrides <code>fly()</code> to throw an exception because it cannot fly.
BPenguin does not override <code>fly()</code> and inherits the flying behavior.
CPenguin is designed as a separate class not inheriting from Bird.
DPenguin has a separate method <code>swim()</code> and does not override <code>fly()</code>.
Attempts:
2 left
💡 Hint

Think about substituting a subclass where the base class is expected.

Comparison
advanced
2:30remaining
Comparing Coupling and Cohesion

Which statement correctly compares coupling and cohesion in software design?

AHigh coupling and high cohesion both improve software maintainability.
BLow coupling and low cohesion are ideal for modular design.
CLow coupling and high cohesion improve modularity and maintainability.
DHigh coupling and low cohesion reduce dependencies and improve clarity.
Attempts:
2 left
💡 Hint

Consider how components depend on each other and how focused their tasks are.

Reasoning
expert
3:00remaining
Reasoning about Dependency Inversion Principle

In a system where high-level modules depend directly on low-level modules, which change best applies the Dependency Inversion Principle (DIP)?

ACombine high-level and low-level modules into a single module to reduce dependencies.
BMake both high-level and low-level modules depend on abstractions like interfaces.
CMake low-level modules depend on high-level modules to control behavior.
DRemove all abstractions and let modules communicate directly for simplicity.
Attempts:
2 left
💡 Hint

Think about how to reduce direct dependencies between different levels of modules.