nerdexam
(ISC)2

CSSLP · Question #40

Which of the following coding practices are helpful in simplifying code? Each correct answer represents a complete solution. Choose all that apply.

The correct answer is A. Programmers should use multiple small and simple functions rather than a single complex function. B. Software should avoid ambiguities and hidden assumptions, recursions, and GoTo statements. C. Programmers should implement high-consequence functions in minimum required lines of code and. This question asks to identify coding practices that contribute to simplifying code, which inherently improves its readability, maintainability, and security.

Secure Software Implementation

Question

Which of the following coding practices are helpful in simplifying code? Each correct answer represents a complete solution. Choose all that apply.

Options

  • AProgrammers should use multiple small and simple functions rather than a single complex function.
  • BSoftware should avoid ambiguities and hidden assumptions, recursions, and GoTo statements.
  • CProgrammers should implement high-consequence functions in minimum required lines of code and
  • DProcesses should have multiple entry and exit points.

How the community answered

(51 responses)
  • A
    88% (45)
  • D
    12% (6)

Why each option

This question asks to identify coding practices that contribute to simplifying code, which inherently improves its readability, maintainability, and security.

AProgrammers should use multiple small and simple functions rather than a single complex function.Correct

Using multiple small and simple functions instead of one large, complex function promotes modularity, making the code easier to understand, test, debug, and reuse.

BSoftware should avoid ambiguities and hidden assumptions, recursions, and GoTo statements.Correct

Avoiding ambiguities, hidden assumptions, excessive use of recursion, and 'GoTo' statements leads to clearer, more predictable code flow, reducing complexity and making the code less prone to errors or security vulnerabilities.

CProgrammers should implement high-consequence functions in minimum required lines of code andCorrect

Implementing high-consequence functions, which are critical to security or system integrity, in the minimum required lines of code reduces their complexity and attack surface, making them easier to review and verify for correctness.

DProcesses should have multiple entry and exit points.

Processes or functions should ideally adhere to structured programming principles, advocating for a single entry and single exit point to ensure predictable control flow and simplify debugging, rather than having multiple entry and exit points which increase complexity.

Concept tested: Secure coding best practices - code simplification

Source: https://owasp.org/www-project-secure-coding-guidelines/

Topics

#Code simplicity#Best coding practices#Software maintainability#Structured programming

Community Discussion

No community discussion yet for this question.

Full CSSLP Practice