1.
Whose responsibility is it to ensure unexpected answers are handled?
Correct Answer
D. Programmer
Explanation
The responsibility to ensure unexpected answers are handled lies with the programmer. Programmers are responsible for developing and implementing the code that handles user inputs and processes them accordingly. They need to anticipate and account for unexpected inputs or errors in order to ensure the smooth functioning of the software or application. This involves implementing error handling mechanisms, validating user inputs, and ensuring the program can handle unexpected scenarios gracefully.
2.
If an action is expected and unwanted , what should the programmer do?
Correct Answer
C. Plan for and implement the best method of removing the unwanted action
Explanation
When an action is expected but unwanted, the programmer should plan for and implement the best method of removing the unwanted action. This means the programmer should anticipate the potential issue and come up with a solution to prevent or mitigate it. Ignoring the problem or relying on others, such as a business analyst, is not a suitable approach. Instead, the programmer should take responsibility for addressing the unwanted action and finding the most effective way to eliminate it.
3.
Why are silent discards bad?
Correct Answer
A. Assumes an unknown scenario is ok
Explanation
Silent discards are bad because they assume that an unknown scenario is acceptable. This means that when an unexpected event or error occurs, instead of handling it properly, the system simply discards it without any notification or action. This can be problematic because it prevents proper error handling and troubleshooting, making it difficult to identify and resolve issues. Additionally, regulatory agencies require comprehensive recording of all events and errors, so silent discards can lead to non-compliance. Furthermore, it can be confusing and frustrating for end users who are unaware that their actions or errors are not being acknowledged or addressed.
4.
What are the first steps in defensive programming?
Correct Answer
A. Challenge, understand, eliminate, document all assumptions
Explanation
The first steps in defensive programming involve challenging, understanding, eliminating, and documenting all assumptions. This means questioning any assumptions made during the development process, seeking to understand the reasoning behind them, and then either eliminating them if they are unnecessary or documenting them if they are valid. This helps to ensure that the code is robust and less prone to errors or vulnerabilities.
5.
Which of the following statements is true about mutable data in a multi-threaded environment?
Correct Answer
B. Must be locked and unlocked
Explanation
In a multi-threaded environment, mutable data refers to data that can be modified. To ensure the integrity and consistency of this data, it must be locked and unlocked. This is necessary to prevent race conditions, where multiple threads try to access and modify the data simultaneously, leading to unpredictable and incorrect results. Locking and unlocking the data ensures that only one thread can access and modify it at a time, preventing conflicts and maintaining data integrity. Therefore, the statement "Must be locked and unlocked" is true about mutable data in a multi-threaded environment.
6.
Select TWO of the following things that software quality tools detect
Correct Answer(s)
A. Duplicate code
B. Non-conformance with coding standards
Explanation
Software quality tools are designed to detect and identify issues in software development. Duplicate code is a common problem that can lead to inefficiency, maintenance difficulties, and increased risk of bugs. Non-conformance with coding standards refers to violations of established guidelines, which can affect readability, maintainability, and overall quality of the code. Test coverage is another important aspect that quality tools assess, ensuring that all parts of the code are thoroughly tested. Uncommon bugs, on the other hand, are not typically detected by quality tools as they are unpredictable and require thorough testing and debugging.
7.
Which of these is a benefit of generational garbage collection?
Correct Answer
B. The ability to optimize garbage collection performance
Explanation
Generational garbage collection is a memory management technique where objects are divided into different generations based on their age. This technique allows the garbage collector to focus on the younger generations, which tend to have a higher rate of object allocation and deallocation. By prioritizing the younger generations, the garbage collector can optimize its performance by avoiding unnecessary scanning of older objects that are less likely to be garbage. This results in faster garbage collection and improved overall performance of the application.
8.
Objects with finalizers require two garbage collection cycles to get deallocated
Correct Answer
A. True
Explanation
Objects with finalizers require two garbage collection cycles to get deallocated. This is because when an object has a finalizer, it is not immediately eligible for garbage collection after it becomes unreachable. Instead, it goes through a process called finalization, where the finalizer method is executed. After the finalizer method completes, the object becomes eligible for garbage collection, but it is not immediately deallocated. It requires another garbage collection cycle to actually deallocate the object from memory.
9.
Adding more resources to a single node in the system is called…
Correct Answer
A. Vertical scaling
Explanation
Vertical scaling refers to the process of adding more resources, such as CPU, memory, or storage, to a single node in a system. This allows the node to handle increased workloads and improve performance. It is a common approach to scaling up a system when there is a need for more capacity. Unlike horizontal scaling, which involves adding more nodes to distribute the workload, vertical scaling focuses on increasing the capabilities of a single node.
10.
Mutable objects may be bad for performance in what way?
Correct Answer
C. They require making more frequent defensive copies
Explanation
Mutable objects may be bad for performance because they require making more frequent defensive copies. Defensive copying is a technique used to prevent unwanted changes to an object by creating a separate copy of it. In the case of mutable objects, if defensive copies are not made when passing the object to different parts of the code, any modification made to the object can affect its original state. This can lead to unexpected behavior and bugs, as well as potentially impacting performance due to the additional overhead of creating and managing these copies.
11.
Benchmarking is a critical component of performance tuning
Correct Answer
A. True
Explanation
Benchmarking is a critical component of performance tuning because it allows for the comparison of a system's performance against a standard or competitor. By conducting benchmark tests, organizations can identify areas where their performance falls short and make necessary improvements. Benchmarking helps in setting performance goals, evaluating the effectiveness of changes made, and ensuring that the system is optimized for optimal performance. Therefore, it is true that benchmarking is a critical component of performance tuning.
12.
In general, code performance is more important than good design
Correct Answer
B. False
Explanation
This statement is false. While code performance is important, it is not more important than good design. Good design ensures that the code is organized, modular, and maintainable, making it easier to understand and modify in the future. It also helps in reducing bugs and improving code quality. Code performance, on the other hand, focuses on optimizing the code to run efficiently and quickly. Both good design and code performance are important factors in software development, but good design is crucial for long-term success and maintainability.
13.
Code quality tools remove the need for programmers is visually inspect code.
Correct Answer
B. False
Explanation
Code quality tools do not remove the need for programmers to visually inspect code. While code quality tools can help identify potential issues and improve the overall quality of code, they cannot completely replace the need for human inspection. Programmers still need to review and understand the code to ensure its correctness, readability, and adherence to coding standards. Therefore, the statement is false.
14.
Which term best describes the future cost of design tradeoffs to meet short-term goals
Correct Answer
D. Technical debt
Explanation
Technical debt refers to the future cost that arises from taking shortcuts or making tradeoffs in the design and development process to meet short-term goals. It is similar to financial debt, where the interest accumulates over time and needs to be paid off eventually. In the context of software development, technical debt can result in increased maintenance costs, decreased productivity, and reduced flexibility in the future. Therefore, technical debt is the term that best describes the future cost of design tradeoffs to meet short-term goals.
15.
If an exception is caught and rethrown logging is not necessary
Correct Answer
B. False
Explanation
If an exception is caught and rethrown, it is still necessary to log the exception. Catching and rethrowing an exception means that the exception is caught at one point in the code and then rethrown to be caught at a higher level. Logging the exception allows for better error tracking and debugging, as it provides information about where the exception occurred and what caused it. Therefore, it is important to log the exception even if it is caught and rethrown.
16.
Maps or Dictionaries are best under which circumstance?
Correct Answer
C. Random access is needed
Explanation
Random access is needed when there is a requirement to quickly access and retrieve specific elements from a data structure, without the need to iterate through the entire structure. In the case of Maps or Dictionaries, random access allows for efficient lookup and retrieval of values based on their associated keys. This is particularly useful when there is a need to access specific data elements in no particular order, making Maps or Dictionaries the best choice in such circumstances.
17.
Select TWO of the following which are disadvantages of inserting timing calling into code
Correct Answer(s)
B. They do not measure actual CPU time
C. They require an application to be rebuilt
Explanation
Inserting timing calls into code has two disadvantages: it does not measure actual CPU time and it requires an application to be rebuilt. Timing calls may not accurately measure the actual CPU time because they only measure the time taken by the specific code being timed, not taking into account other processes or system overhead. Additionally, inserting timing calls requires modifying the code and rebuilding the application, which can be inconvenient and time-consuming for developers.
18.
A 2x speedup of a method invocation should always be considered valuable
Correct Answer
B. False
Explanation
A 2x speedup of a method invocation should not always be considered valuable because it depends on the specific context and requirements of the application. While faster execution can be beneficial in many cases, there may be situations where speed is not the highest priority. For example, if the method is rarely used or if the performance gain is negligible compared to the effort required to achieve it, the value of the speedup may be limited. Additionally, optimizing for speed can sometimes lead to trade-offs in other areas such as code complexity or maintainability.
19.
A disadvantage of Sonar is its lack of configurability
Correct Answer
B. False
Explanation
Sonar actually offers a high level of configurability, which allows users to customize and adjust its settings to meet their specific needs. This configurability is one of the advantages of Sonar, as it enables users to tailor the system to their unique requirements and optimize its performance. Therefore, the statement that Sonar lacks configurability is false.
20.
Select three of the following that are true when developing software logging:
Correct Answer(s)
A. An overhead
B. Required
C. Expensive
Explanation
When developing software logging, it is true that logging can introduce overhead to the system, as it requires additional resources to capture and store log messages. Logging is also often considered a required practice in software development, as it helps in troubleshooting and debugging. However, logging can be expensive in terms of storage and processing costs, especially when dealing with large-scale applications. It is not true that all log messages are displayed, as log levels and filters can be implemented to control which messages are shown.