The correct answer is: A. need to have been painted.
The other options are incorrect because they do not express the urgency of the situation. The walls of the house are in need of immediate attention, and the only option that conveys this is "need to have been painted."
- "Should be painted" is a more general statement that does not necessarily indicate a pressing need.
- "Should have been painted" is a past-tense construction that suggests that the walls should have been painted at some point in the past, but it does not necessarily mean that they need to be painted now.
- "Ought to have been painted" is similar to "should have been painted," but it is even more tentative. It suggests that the walls should have been painted at some point in the past, but it does not necessarily mean that they need to be painted now.
In conclusion, the correct answer is "need to have been painted." This option expresses the urgency of the situation and conveys the need for immediate action.