Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

Training Effectiveness Assessment

Employee Id: Date:

Employee Name: Technology: Object Oriented Design


Principles
Project: Level: Beginner to Intermediate

1. Which of the following is NOT one of the four principles used to guide component-level design?
a. Parsimonious Complexity Principle
b. Dependency Inversion Principle
c. Open Closed Principle
d. Interface Segregation Principle

2. Which of these criteria are useful in assessing the effectiveness of a particular design notation?
a. Maintainability
b. Modularity
c. Simplicity
d. All The above

3. Which one of the following is NOT true about Tight Coupling?


a. Tightly coupled classes cannot work independent of each other.
b. Making changes in one class is difficult because it could launch a wave of changes with the tightly
coupled classes
c. if your business layer contains code related to data access, changes to data access will affect
business logic
d. Easier to test because you have to deal with implementation details of something you’re not trying
to test.

4. What does LSP stand for and what does it state?


a. LSP stands for “Liskov's Substitution Principle” and it states Subtypes must be substitutable for
their base types.
b. LSP stands for “Liskov's Substitution Principle” and it states Super types must be substitutable for
their sub types.
c. LSP stands for “Less Substitution Principle” and it states Subtypes must be substitutable for their
base types.
d. LSP stands for “Less Substitution Principle” and it states Super types must be substitutable for their
sub types.

5. Dependency Inversion Principle states


a. Low level modules should not depend upon high level modules. Rather, both should inter depend
on each other.
b. Low level modules should not depend upon high level modules. Rather, both should depend upon
abstractions.
c. High level modules should not depend upon low level modules. Rather, both should depend upon
abstractions.
d. High level modules should not depend upon low level modules. . Rather, both should inter depend
on each other.

© Changepond Technologies Confidential Page 1


Training Effectiveness Assessment

6. Go through the below code snippets, and identify which design principle is violated and rewrite the
code using that specific design principle
namespace SolidPrinciples
{
public class BankAccount
{
private string accountNumber;
private double amount;

public BankAccount(string accountNumber, double amount)


{
this.accountNumber = accountNumber;
this.amount = amount;
}

public void Withdraw(double amount)


{
this.amount -= amount;
}

public void Deposit(double amount)


{
this.amount += amount;
}

public string GetAccountNumber()


{
return accountNumber;
}

public double GetAmount()


{
return amount;
}
}
}
Violates:
Corrected Code:

© Changepond Technologies Confidential Page 2


Training Effectiveness Assessment

© Changepond Technologies Confidential Page 3


Training Effectiveness Assessment

7. Go through the below code snippets, and identify which design principle is violated and rewrite the
code using that specific design principle

public class GetUserService


{
public string FindUsers(UserSearchType type)
{
String Result;
switch (type)
{
case UserSearchType.AllUsers:
// load the “Result” variable here
break;
case UserSearchType.AllActiveUsers:
// load the “Result” variable here
break;
case UserSearchType.ActiveUsersThatCanEditQuotes:
// load the “Result” variable here
break;
}
Return Result
}
}

Violates:
Corrected Code:

© Changepond Technologies Confidential Page 4


Training Effectiveness Assessment

Feedback:

Correct Answers: Evaluated By:

Incorrect
Answers:

Date:
Score:

© Changepond Technologies Confidential Page 5

You might also like