Final answer:
The correct statement to extract the last 10 characters from the string variable str is A) str.substr(str.length()-10, 10), as it correctly calculates the starting index by subtracting 10 from the string's length.
Step-by-step explanation:
To extract the last 10 characters from the string variable str, you would use the method str.substr(str.length()-10, 10). This method call starts the substring at the index that is 10 characters from the end of the string (str.length()-10) and extracts 10 characters from that point. Therefore, the correct answer is A) str.substr(str.length()-10, 10).
The options B) str.substr(10, 10) and D) str.substr(0, 10) would not work as expected because they start at character index 10 and 0, respectively, which would not typically reach the end of the string. Option C) str.substr(str.length()-9, 10) would start one character too late, getting 9 characters from the end and adding an additional character past the end of the string, which is not correct.