Clean Code | Set 2 Questions and Answers with 100% Correct
Answers | Latest Version
Question 1.
messy code is okay to meet a deadline. You can clean it up later (true/false)
Correct Answer: false!
Question 2.
names should vary in small ways (true/false)
Correct Answer: false!
Question 3.
duplicate code can often be eliminated with a function (true/false)
Correct Answer: true!
Question 4.
attributions in the code can be useful (true/false)
Correct Answer: false!
Question 5.
interspersed comments make the code easier to read (true/false)
Correct Answer: false!
Question 6.
variables should be kept private so others cannot depend on them (true/false)
Correct Answer: true!
Question 7.
exceptions should provide context to determine the source and location of an error
(true/false)
Correct Answer: true!
Question 8.
challenges with third party software include: (select all that apply)
- learning the third party software
- integrating the third party software
- third party vendors must share our domain terms
- third party software must be rewritten using our domain terms
Correct Answer: - learning the third party software
- integrating the third party software!
,Question 9.
readability is the key to clean tests (true/false)
Correct Answer: true!
Question 10.
methods that manipulate more instance variables are more cohesive (true/false)
Correct Answer: true!
Question 11.
a parallel redesign is usually required to fix messy code (true/false)
Correct Answer: false!
Question 12.
use number series (a1, a2,... aN) to distinguish names (true/false)
Correct Answer: false!
Question 13.
a function that handles errors should do nothing else (true/false)
Correct Answer: true!
Question 14.
details should appear at the top of the file before the high-level concepts (true/false)
Correct Answer: false!
Question 15.
chains of method calls make code easier to read (true/false)
Correct Answer: false!
Question 16.
returning a special case object is preferred to returning null (true/false)
Correct Answer: true!
Question 17.
the provider of third party code and the user of the provided interface have a tension
related to different objectives (true/false)
Correct Answer: true!
Question 18.
in TDD, you write all of the tests before you write any code (true/false)
, Correct Answer: false!
Question 19.
smaller classes are easier to comprehend and test (true/false)
Correct Answer: true!
Question 20.
productivity decreases asymptotically to zero over time with messy code (true/false)
Correct Answer: true!
Question 21.
comments that explain intent behind a decision can be useful (true/false)
Correct Answer: true!
Question 22.
dummy scopes/bodies do not need to be visible (true/false)
Correct Answer: false!
Question 23.
data structures and objects provide similar capabilities (true/false)
Correct Answer: false!
Question 24.
one boundary of our systems is the interface to third party software (true/false)
Correct Answer: true!
Question 25.
tests lessen the fear of making changes to the code (true/false)
Correct Answer: true!
Question 26.
classes should begin with a list of public static constants if any (true/false)
Correct Answer: true!
Question 27.
keeping code clean at all times is not a cost effective solution (true/false)
Correct Answer: false!
Answers | Latest Version
Question 1.
messy code is okay to meet a deadline. You can clean it up later (true/false)
Correct Answer: false!
Question 2.
names should vary in small ways (true/false)
Correct Answer: false!
Question 3.
duplicate code can often be eliminated with a function (true/false)
Correct Answer: true!
Question 4.
attributions in the code can be useful (true/false)
Correct Answer: false!
Question 5.
interspersed comments make the code easier to read (true/false)
Correct Answer: false!
Question 6.
variables should be kept private so others cannot depend on them (true/false)
Correct Answer: true!
Question 7.
exceptions should provide context to determine the source and location of an error
(true/false)
Correct Answer: true!
Question 8.
challenges with third party software include: (select all that apply)
- learning the third party software
- integrating the third party software
- third party vendors must share our domain terms
- third party software must be rewritten using our domain terms
Correct Answer: - learning the third party software
- integrating the third party software!
,Question 9.
readability is the key to clean tests (true/false)
Correct Answer: true!
Question 10.
methods that manipulate more instance variables are more cohesive (true/false)
Correct Answer: true!
Question 11.
a parallel redesign is usually required to fix messy code (true/false)
Correct Answer: false!
Question 12.
use number series (a1, a2,... aN) to distinguish names (true/false)
Correct Answer: false!
Question 13.
a function that handles errors should do nothing else (true/false)
Correct Answer: true!
Question 14.
details should appear at the top of the file before the high-level concepts (true/false)
Correct Answer: false!
Question 15.
chains of method calls make code easier to read (true/false)
Correct Answer: false!
Question 16.
returning a special case object is preferred to returning null (true/false)
Correct Answer: true!
Question 17.
the provider of third party code and the user of the provided interface have a tension
related to different objectives (true/false)
Correct Answer: true!
Question 18.
in TDD, you write all of the tests before you write any code (true/false)
, Correct Answer: false!
Question 19.
smaller classes are easier to comprehend and test (true/false)
Correct Answer: true!
Question 20.
productivity decreases asymptotically to zero over time with messy code (true/false)
Correct Answer: true!
Question 21.
comments that explain intent behind a decision can be useful (true/false)
Correct Answer: true!
Question 22.
dummy scopes/bodies do not need to be visible (true/false)
Correct Answer: false!
Question 23.
data structures and objects provide similar capabilities (true/false)
Correct Answer: false!
Question 24.
one boundary of our systems is the interface to third party software (true/false)
Correct Answer: true!
Question 25.
tests lessen the fear of making changes to the code (true/false)
Correct Answer: true!
Question 26.
classes should begin with a list of public static constants if any (true/false)
Correct Answer: true!
Question 27.
keeping code clean at all times is not a cost effective solution (true/false)
Correct Answer: false!