




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A set of questions and answers related to software maintainability in c#. It covers topics such as code analyzability, technical debt, naming conventions, self-documenting code, solid principles, design patterns, defensive coding practices, exception handling, and unit testing. This resource is useful for software developers preparing for certification exams or seeking to improve their understanding of maintainable code practices. The questions are designed to test knowledge of key concepts and best practices in c# software development, making it a valuable study aid for both beginners and experienced programmers.
Typology: Exams
1 / 191
This page cannot be seen from the preview
Don't miss anything!





























































































Question 1. Which attribute of software maintainability refers to how easily deficiencies or causes of failures can be diagnosed? A) Stability B) Analyzability C) Changeability D) Conformity Answer: B Explanation: Analyzability is the ease with which you can diagnose deficiencies or causes of failures in software. Question 2. What is the primary business value of high software maintainability?
A) Faster hardware utilization B) Reduced cost of future changes C) Improved marketing strategies D) Increased user interface complexity Answer: B Explanation: High maintainability reduces the cost and risk involved in modifying and updating software. Question 3. Which of the following best defines technical debt? A) The cost of hardware upgrades B) The accumulation of shortcuts and poor design choices in code C) The number of bugs in software
Explanation: Poor maintainability leads to increased costs and risks for making future modifications. Question 5. Which C# naming convention is typically used for class names? A) snake_case B) camelCase C) PascalCase D) kebab-case Answer: C Explanation: PascalCase is the standard for naming classes in C#.
Question 6. What is the recommended naming convention for a method parameter in C#? A) PascalCase B) UPPERCASE C) camelCase D) TitleCase Answer: C Explanation: Method parameters in C# should use camelCase to distinguish them from class names. Question 7. What is a primary goal of self-documenting code? A) To eliminate the need for comments
D) Reduced onboarding time for new developers Answer: C Explanation: Consistent formatting improves readability and maintainability, not technical debt. Question 9. In C#, what should be used for documenting public APIs? A) Inline comments only B) XML documentation comments (///) C) TODO comments D) Block comments only Answer: B
Explanation: XML documentation comments (///) are used to generate documentation for public APIs. Question 10. When should inline comments be used in code? A) To describe every line of code B) Only when code clarity alone is insufficient C) To describe naming conventions D) To duplicate method summaries Answer: B Explanation: Inline comments should clarify code that isn't self- explanatory.
A) Liskov Substitution Principle B) Single Responsibility Principle C) Open/Closed Principle D) Interface Segregation Principle Answer: C Explanation: The Open/Closed Principle advocates for extending functionality without modifying existing code. Question 13. What does the Liskov Substitution Principle state? A) Subtypes must be substitutable for their base types B) A class should be as large as possible C) Methods must always throw exceptions
D) Only interfaces can be inherited Answer: A Explanation: LSP requires that derived classes can be used in place of their base class without issues. Question 14. What is the purpose of the Interface Segregation Principle (ISP)? A) To create large, all-encompassing interfaces B) To force clients to depend on all members of an interface C) To create focused, client-specific interfaces D) To use only abstract classes Answer: C
Question 16. Which pattern is used to create objects without specifying the exact class? A) Decorator B) Strategy C) Factory D) Singleton Answer: C Explanation: The Factory pattern creates objects without exposing the instantiation logic. Question 17. What is the main benefit of the Strategy design pattern?
A) It locks in a single algorithm B) It enables selecting algorithms at runtime C) It increases code size D) It removes the need for interfaces Answer: B Explanation: Strategy allows a family of algorithms to be interchangeable at runtime. Question 18. What is the primary use of the Decorator pattern? A) To add new functionality to objects dynamically B) To create single instances C) To manage database access
Explanation: Validating arguments helps prevent unexpected errors and increases robustness. Question 20. What exception should be thrown if a method argument is null in C#? A) ArgumentOutOfRangeException B) InvalidOperationException C) ArgumentNullException D) DivideByZeroException Answer: C Explanation: ArgumentNullException is used when an argument passed to a method is null and it shouldn’t be.
Question 21. Why should you avoid throwing the generic Exception type? A) It improves error clarity B) It makes debugging easier C) It hides the specific cause of errors D) It is required by the C# language Answer: C Explanation: Throwing generic Exception makes it difficult to determine the actual error cause.
A) ?? (null-coalescing operator) B) ++ C) && D) ?: Answer: A Explanation: The null-coalescing operator (??) returns the right operand if the left is null. Question 24. What does the ?. (null-conditional) operator do in C#? A) Always throws an exception B) Accesses members only if the object is not null C) Converts all values to nullable types
D) Forces a method to be static Answer: B Explanation: ?. safely accesses a member if the object is not null, preventing exceptions. Question 25. Which of the following is a benefit of using pattern matching in C#? A) It makes code harder to read B) It improves type safety and readability C) It disables type checking D) It eliminates all exceptions Answer: B